radicale: 1.1.4 -> 2.1.2

This commit readds and updates the 1.x package from 1.1.4 to 1.1.6 which
also includes the needed command for migrating to 2.x

The module is adjusted to the version change, defaulting to radicale2 if
stateVersion >= 17.09 and radicale1 otherwise. It also now uses
ExecStart instead of the script service attribute. Some missing dots at
the end of sentences were also added.

I added a paragraph in the release notes on how to update to a newer
version.

Changed files
+112 -86
nixos
doc
manual
release-notes
modules
services
networking
tests
pkgs
servers
radicale
top-level
+3
nixos/doc/manual/release-notes/rl-1709.xml
···
<para>
The <literal>mysql</literal> default <literal>dataDir</literal> has changed from <literal>/var/mysql</literal> to <literal>/var/lib/mysql</literal>.
</para>
</listitem>
<listitem>
<para>
···
<para>
The <literal>mysql</literal> default <literal>dataDir</literal> has changed from <literal>/var/mysql</literal> to <literal>/var/lib/mysql</literal>.
</para>
+
<para>
+
Radicale's default package has changed from 1.x to 2.x. Instructions to migrate can be found <link xlink:href="http://radicale.org/1to2/"> here </link>. It is also possible to use the newer version by setting the <literal>package</literal> to <literal>radicale2</literal>, which is done automatically when <literal>stateVersion</literal> is 17.09 or higher.
+
</para>
</listitem>
<listitem>
<para>
+30 -10
nixos/modules/services/networking/radicale.nix
···
-
{config, lib, pkgs, ...}:
with lib;
···
confFile = pkgs.writeText "radicale.conf" cfg.config;
in
{
options = {
-
services.radicale.enable = mkOption {
type = types.bool;
default = false;
description = ''
-
Enable Radicale CalDAV and CardDAV server
'';
};
···
default = "";
description = ''
Radicale configuration, this will set the service
-
configuration file
'';
-
};
};
config = mkIf cfg.enable {
-
environment.systemPackages = [ pkgs.radicale ];
users.extraUsers = singleton
{ name = "radicale";
···
description = "A Simple Calendar and Contact Server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
-
script = "${pkgs.radicale}/bin/radicale -C ${confFile} -f";
-
serviceConfig.User = "radicale";
-
serviceConfig.Group = "radicale";
};
};
-
meta.maintainers = with lib.maintainers; [ aneeshusa ];
}
···
+
{ config, lib, pkgs, ... }:
with lib;
···
confFile = pkgs.writeText "radicale.conf" cfg.config;
+
# This enables us to default to version 2 while still not breaking configurations of people with version 1
+
defaultPackage = if versionAtLeast "17.09" config.system.stateVersion then {
+
pkg = pkgs.radicale2;
+
text = "pkgs.radicale2";
+
} else {
+
pkg = pkgs.radicale1;
+
text = "pkgs.radicale1";
+
};
in
{
options = {
services.radicale.enable = mkOption {
type = types.bool;
default = false;
description = ''
+
Enable Radicale CalDAV and CardDAV server.
+
'';
+
};
+
+
services.radicale.package = mkOption {
+
type = types.package;
+
default = defaultPackage.pkg;
+
defaultText = defaultPackage.text;
+
description = ''
+
Radicale package to use. This defaults to version 1.x if
+
<literal>system.stateVersion &lt; 17.09</literal> and version 2.x
+
otherwise.
'';
};
···
default = "";
description = ''
Radicale configuration, this will set the service
+
configuration file.
'';
+
};
};
config = mkIf cfg.enable {
+
environment.systemPackages = [ cfg.package ];
users.extraUsers = singleton
{ name = "radicale";
···
description = "A Simple Calendar and Contact Server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
+
serviceConfig = {
+
ExecStart = "${cfg.package}/bin/radicale -C ${confFile} -f";
+
User = "radicale";
+
Group = "radicale";
+
};
};
};
+
meta.maintainers = with lib.maintainers; [ aneeshusa infinisil ];
}
+1
nixos/release.nix
···
tests.pumpio = callTest tests/pump.io.nix {};
# tests.quagga = callTest tests/quagga.nix {};
tests.quake3 = callTest tests/quake3.nix {};
tests.runInMachine = callTest tests/run-in-machine.nix {};
tests.samba = callTest tests/samba.nix {};
tests.sddm = callSubTests tests/sddm.nix {};
···
tests.pumpio = callTest tests/pump.io.nix {};
# tests.quagga = callTest tests/quagga.nix {};
tests.quake3 = callTest tests/quake3.nix {};
+
tests.radicale = callTest tests/radicale.nix {};
tests.runInMachine = callTest tests/run-in-machine.nix {};
tests.samba = callTest tests/samba.nix {};
tests.sddm = callSubTests tests/sddm.nix {};
+21 -62
nixos/tests/radicale.nix
···
let
-
port = 5232;
-
radicaleOverlay = self: super: {
-
radicale = super.radicale.overrideAttrs (oldAttrs: {
-
propagatedBuildInputs = with self.pythonPackages;
-
(oldAttrs.propagatedBuildInputs or []) ++ [
-
passlib
-
];
-
});
-
};
-
common = { config, pkgs, ...}: {
services.radicale = {
enable = true;
-
config = let home = config.users.extraUsers.radicale.home; in ''
-
[server]
-
hosts = 127.0.0.1:${builtins.toString port}
-
daemon = False
-
[encoding]
-
[well-known]
[auth]
type = htpasswd
htpasswd_filename = /etc/radicale/htpasswd
htpasswd_encryption = bcrypt
-
[git]
-
[rights]
[storage]
-
type = filesystem
-
filesystem_folder = ${home}/collections
[logging]
-
[headers]
'';
};
# WARNING: DON'T DO THIS IN PRODUCTION!
# This puts secrets (albeit hashed) directly into the Nix store for ease of testing.
-
environment.etc."radicale/htpasswd".source = with pkgs; let
-
py = python.withPackages(ps: with ps; [ passlib ]);
-
in runCommand "htpasswd" {} ''
-
${py}/bin/python -c "
-
from passlib.apache import HtpasswdFile
-
ht = HtpasswdFile(
-
'$out',
-
new=True,
-
default_scheme='bcrypt'
-
)
-
ht.set_password('someuser', 'really_secret_password')
-
ht.save()
-
"
'';
};
-
-
in import ./make-test.nix ({ lib, ... }: {
-
name = "radicale";
-
meta.maintainers = with lib.maintainers; [ aneeshusa ];
-
-
# Test radicale with bcrypt-based htpasswd authentication
-
nodes = {
-
py2 = { config, pkgs, ... }@args: (common args) // {
-
nixpkgs.overlays = [
-
radicaleOverlay
-
];
-
};
-
py3 = { config, pkgs, ... }@args: (common args) // {
-
nixpkgs.overlays = [
-
(self: super: {
-
python = self.python3;
-
pythonPackages = self.python3.pkgs;
-
})
-
radicaleOverlay
-
];
-
};
-
};
-
testScript = ''
-
for my $machine ($py2, $py3) {
-
$machine->waitForUnit('radicale.service');
-
$machine->waitForOpenPort(${builtins.toString port});
-
$machine->succeed('curl -s http://someuser:really_secret_password@127.0.0.1:${builtins.toString port}/someuser/calendar.ics/');
-
}
'';
})
···
let
+
user = "someuser";
+
password = "some_password";
+
port = builtins.toString 5232;
+
in
+
import ./make-test.nix ({ pkgs, lib, ... }: {
+
name = "radicale";
+
meta.maintainers = with lib.maintainers; [ aneeshusa infinisil ];
+
+
machine = {
services.radicale = {
enable = true;
+
config = ''
[auth]
type = htpasswd
htpasswd_filename = /etc/radicale/htpasswd
htpasswd_encryption = bcrypt
+
[storage]
+
filesystem_folder = /tmp/collections
+
[logging]
+
debug = True
'';
};
# WARNING: DON'T DO THIS IN PRODUCTION!
# This puts secrets (albeit hashed) directly into the Nix store for ease of testing.
+
environment.etc."radicale/htpasswd".source = pkgs.runCommand "htpasswd" {} ''
+
${pkgs.apacheHttpd}/bin/htpasswd -bcB "$out" ${user} ${password}
'';
};
+
+
# This tests whether the web interface is accessible to an authenticated user
testScript = ''
+
$machine->waitForUnit('radicale.service');
+
$machine->waitForOpenPort(${port});
+
$machine->succeed('curl --fail http://${user}:${password}@localhost:${port}/.web/');
'';
})
+34
pkgs/servers/radicale/1.x.nix
···
···
+
{ stdenv, fetchurl, pythonPackages }:
+
+
pythonPackages.buildPythonApplication rec {
+
name = "radicale-${version}";
+
version = "1.1.6";
+
+
src = fetchurl {
+
url = "mirror://pypi/R/Radicale/Radicale-${version}.tar.gz";
+
sha256 = "0ay90nj6fmr2aq8imi0mbjl4m2rzq7a83ikj8qs9gxsylj71j1y0";
+
};
+
+
propagatedBuildInputs = stdenv.lib.optionals (!pythonPackages.isPy3k) [
+
pythonPackages.flup
+
pythonPackages.ldap
+
pythonPackages.sqlalchemy
+
];
+
+
doCheck = !pythonPackages.isPy3k;
+
+
meta = with stdenv.lib; {
+
homepage = http://www.radicale.org/;
+
description = "CalDAV CardDAV server";
+
longDescription = ''
+
The Radicale Project is a complete CalDAV (calendar) and CardDAV
+
(contact) server solution. Calendars and address books are available for
+
both local and remote access, possibly limited through authentication
+
policies. They can be viewed and edited by calendar and contact clients
+
on mobile phones or computers.
+
'';
+
license = licenses.gpl3Plus;
+
platforms = platforms.all;
+
maintainers = with maintainers; [ edwtjo pSub aneeshusa ];
+
};
+
}
+19 -13
pkgs/servers/radicale/default.nix
···
-
{ stdenv, fetchurl, pythonPackages }:
-
pythonPackages.buildPythonApplication rec {
name = "radicale-${version}";
-
version = "1.1.4";
-
src = fetchurl {
-
url = "mirror://pypi/R/Radicale/Radicale-${version}.tar.gz";
-
sha256 = "17p0hayyw30pfb81xqvd7jhjm6yrk2dnbgvqagx1nqdsr89ar0ss";
};
-
propagatedBuildInputs = stdenv.lib.optionals (!pythonPackages.isPy3k) [
-
pythonPackages.flup
-
pythonPackages.ldap
-
pythonPackages.sqlalchemy
];
-
-
doCheck = !pythonPackages.isPy3k;
meta = with stdenv.lib; {
homepage = http://www.radicale.org/;
···
'';
license = licenses.gpl3Plus;
platforms = platforms.all;
-
maintainers = with maintainers; [ edwtjo pSub aneeshusa ];
};
}
···
+
{ stdenv, fetchFromGitHub, python3Packages }:
+
let
+
version = "2.1.2";
+
sha256 = "0gmbnvm17j0ilcnci1k2jh0vkbz5g8xlk9lgia5mlx790048hlm8";
+
in
+
+
python3Packages.buildPythonApplication {
name = "radicale-${version}";
+
inherit version;
+
src = fetchFromGitHub {
+
owner = "Kozea";
+
repo = "Radicale";
+
rev = version;
+
inherit sha256;
};
+
doCheck = false;
+
+
propagatedBuildInputs = with python3Packages; [
+
vobject
+
passlib
];
meta = with stdenv.lib; {
homepage = http://www.radicale.org/;
···
'';
license = licenses.gpl3Plus;
platforms = platforms.all;
+
maintainers = with maintainers; [ edwtjo pSub aneeshusa infinisil ];
};
}
+4 -1
pkgs/top-level/all-packages.nix
···
inherit (darwin.apple_sdk.frameworks) AppKit Carbon Cocoa;
};
-
radicale = callPackage ../servers/radicale { };
rake = callPackage ../development/tools/build-managers/rake { };
···
inherit (darwin.apple_sdk.frameworks) AppKit Carbon Cocoa;
};
+
radicale1 = callPackage ../servers/radicale/1.x.nix { };
+
radicale2 = callPackage ../servers/radicale/default.nix { };
+
+
radicale = radicale2;
rake = callPackage ../development/tools/build-managers/rake { };