diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index 12363e999218..4648681597cf 100644 --- a/nixos/doc/manual/release-notes/rl-2009.xml +++ b/nixos/doc/manual/release-notes/rl-2009.xml @@ -504,6 +504,16 @@ systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www" ]; In the resilio module, has been changed to listen to [::1] instead of 0.0.0.0. + + + Radicale's default package has changed from 2.x to 3.x. An upgrade + checklist can be found + here. + You can use the newer version in the NixOS service by setting the + package to radicale3, which is done + automatically if stateVersion is 20.09 or higher. + + diff --git a/nixos/modules/services/networking/radicale.nix b/nixos/modules/services/networking/radicale.nix index 30bf22586f86..5af035fd59e0 100644 --- a/nixos/modules/services/networking/radicale.nix +++ b/nixos/modules/services/networking/radicale.nix @@ -8,8 +8,10 @@ let 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 config.system.stateVersion "17.09" then { + defaultPackage = if versionAtLeast config.system.stateVersion "20.09" then { + pkg = pkgs.radicale3; + text = "pkgs.radicale3"; + } else if versionAtLeast config.system.stateVersion "17.09" then { pkg = pkgs.radicale2; text = "pkgs.radicale2"; } else { @@ -35,8 +37,9 @@ in defaultText = defaultPackage.text; description = '' Radicale package to use. This defaults to version 1.x if - system.stateVersion < 17.09 and version 2.x - otherwise. + system.stateVersion < 17.09, version 2.x if + 17.09 ≤ system.stateVersion < 20.09, and + version 3.x otherwise. ''; }; diff --git a/nixos/tests/radicale.nix b/nixos/tests/radicale.nix index c81e78a8f994..1d3679c82a20 100644 --- a/nixos/tests/radicale.nix +++ b/nixos/tests/radicale.nix @@ -14,9 +14,6 @@ let [storage] filesystem_folder = /tmp/collections - - [logging] - debug = True ''; }; # WARNING: DON'T DO THIS IN PRODUCTION! @@ -49,13 +46,18 @@ in services.radicale.extraArgs = [ "--export-storage" "/tmp/collections-new" ]; + system.stateVersion = "17.03"; }; radicale2_verify = lib.recursiveUpdate radicale2 { - services.radicale.extraArgs = [ "--verify-storage" ]; + services.radicale.extraArgs = [ "--debug" "--verify-storage" ]; + system.stateVersion = "17.09"; }; radicale2 = lib.recursiveUpdate (common args) { system.stateVersion = "17.09"; }; + radicale3 = lib.recursiveUpdate (common args) { + system.stateVersion = "20.09"; + }; }; # This tests whether the web interface is accessible to an authenticated user @@ -117,6 +119,22 @@ in retcode == 0 and "VCALENDAR" in output ), "Could not read calendar from Radicale 2" - radicale.succeed("curl --fail http://${user}:${password}@localhost:${port}/.web/") + radicale.succeed("curl --fail http://${user}:${password}@localhost:${port}/.web/") + + with subtest("Check Radicale 3 functionality"): + radicale.succeed( + "${switchToConfig "radicale3"} >&2" + ) + radicale.wait_for_unit("radicale.service") + radicale.wait_for_open_port(${port}) + + (retcode, output) = radicale.execute( + "curl --fail http://${user}:${password}@localhost:${port}/someuser/calendar.ics/" + ) + assert ( + retcode == 0 and "VCALENDAR" in output + ), "Could not read calendar from Radicale 3" + + radicale.succeed("curl --fail http://${user}:${password}@localhost:${port}/.web/") ''; }) diff --git a/pkgs/servers/radicale/default.nix b/pkgs/servers/radicale/2.x.nix similarity index 88% rename from pkgs/servers/radicale/default.nix rename to pkgs/servers/radicale/2.x.nix index fc98795bbc79..8d36717ec69b 100644 --- a/pkgs/servers/radicale/default.nix +++ b/pkgs/servers/radicale/2.x.nix @@ -2,14 +2,14 @@ python3.pkgs.buildPythonApplication rec { pname = "Radicale"; - version = "2.1.11"; + version = "2.1.12"; # No tests in PyPI tarball src = fetchFromGitHub { owner = "Kozea"; repo = "Radicale"; rev = version; - sha256 = "1k32iy55lnyyp1r75clarhwdqvw6w8mxb5v0l5aysga07fg2mix4"; + sha256 = "14f9ql0fiwapaa4xaslwgk1ah9fzxxan2p1p2rxb4a5iqph1z0cl"; }; # We only want functional tests @@ -31,7 +31,7 @@ python3.pkgs.buildPythonApplication rec { ]; meta = with stdenv.lib; { - homepage = "https://www.radicale.org/"; + homepage = "https://www.radicale.org/2.x.nix"; description = "CalDAV CardDAV server"; longDescription = '' The Radicale Project is a complete CalDAV (calendar) and CardDAV diff --git a/pkgs/servers/radicale/3.x.nix b/pkgs/servers/radicale/3.x.nix new file mode 100644 index 000000000000..7b42bd3be34f --- /dev/null +++ b/pkgs/servers/radicale/3.x.nix @@ -0,0 +1,38 @@ +{ lib, python3, fetchFromGitHub }: + +python3.pkgs.buildPythonApplication rec { + pname = "radicale"; + version = "3.0.3"; + + # No tests in PyPI tarball + src = fetchFromGitHub { + owner = "Kozea"; + repo = "Radicale"; + rev = version; + sha256 = "170mqxlnfzx15img4wb71axq9cnxwllk5cabsv8i008q7wyjqp0n"; + }; + + propagatedBuildInputs = with python3.pkgs; [ + defusedxml + passlib + vobject + python-dateutil + setuptools + ]; + + checkInputs = with python3.pkgs; [ + pytestrunner + pytest + pytestcov + pytest-flake8 + pytest-isort + waitress + ]; + + meta = with lib; { + homepage = "https://www.radicale.org/3.0.html"; + description = "CalDAV and CardDAV server"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f225920cd488..97ba5f088f85 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16348,9 +16348,10 @@ in }; radicale1 = callPackage ../servers/radicale/1.x.nix { }; - radicale2 = callPackage ../servers/radicale { }; + radicale2 = callPackage ../servers/radicale/2.x.nix { }; + radicale3 = callPackage ../servers/radicale/3.x.nix { }; - radicale = radicale2; + radicale = radicale3; rake = callPackage ../development/tools/build-managers/rake { };