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.
This commit is contained in:
Silvan Mosberger 2017-07-25 09:01:08 +02:00
parent 5bc183ebf8
commit e16a0988bc
No known key found for this signature in database
GPG Key ID: 9424360B4B85C9E7
7 changed files with 112 additions and 86 deletions

View File

@ -101,6 +101,9 @@ rmdir /var/lib/ipfs/.ipfs
<para> <para>
The <literal>mysql</literal> default <literal>dataDir</literal> has changed from <literal>/var/mysql</literal> to <literal>/var/lib/mysql</literal>. The <literal>mysql</literal> default <literal>dataDir</literal> has changed from <literal>/var/mysql</literal> to <literal>/var/lib/mysql</literal>.
</para> </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>
<listitem> <listitem>
<para> <para>

View File

@ -1,4 +1,4 @@
{config, lib, pkgs, ...}: { config, lib, pkgs, ... }:
with lib; with lib;
@ -8,17 +8,35 @@ let
confFile = pkgs.writeText "radicale.conf" cfg.config; 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 in
{ {
options = { options = {
services.radicale.enable = mkOption { services.radicale.enable = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
Enable Radicale CalDAV and CardDAV server 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.
''; '';
}; };
@ -27,13 +45,13 @@ in
default = ""; default = "";
description = '' description = ''
Radicale configuration, this will set the service Radicale configuration, this will set the service
configuration file configuration file.
''; '';
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.radicale ]; environment.systemPackages = [ cfg.package ];
users.extraUsers = singleton users.extraUsers = singleton
{ name = "radicale"; { name = "radicale";
@ -52,11 +70,13 @@ in
description = "A Simple Calendar and Contact Server"; description = "A Simple Calendar and Contact Server";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
script = "${pkgs.radicale}/bin/radicale -C ${confFile} -f"; serviceConfig = {
serviceConfig.User = "radicale"; ExecStart = "${cfg.package}/bin/radicale -C ${confFile} -f";
serviceConfig.Group = "radicale"; User = "radicale";
Group = "radicale";
};
}; };
}; };
meta.maintainers = with lib.maintainers; [ aneeshusa ]; meta.maintainers = with lib.maintainers; [ aneeshusa infinisil ];
} }

View File

@ -297,6 +297,7 @@ in rec {
tests.pumpio = callTest tests/pump.io.nix {}; tests.pumpio = callTest tests/pump.io.nix {};
# tests.quagga = callTest tests/quagga.nix {}; # tests.quagga = callTest tests/quagga.nix {};
tests.quake3 = callTest tests/quake3.nix {}; tests.quake3 = callTest tests/quake3.nix {};
tests.radicale = callTest tests/radicale.nix {};
tests.runInMachine = callTest tests/run-in-machine.nix {}; tests.runInMachine = callTest tests/run-in-machine.nix {};
tests.samba = callTest tests/samba.nix {}; tests.samba = callTest tests/samba.nix {};
tests.sddm = callSubTests tests/sddm.nix {}; tests.sddm = callSubTests tests/sddm.nix {};

View File

@ -1,80 +1,39 @@
let let
port = 5232; user = "someuser";
radicaleOverlay = self: super: { password = "some_password";
radicale = super.radicale.overrideAttrs (oldAttrs: { port = builtins.toString 5232;
propagatedBuildInputs = with self.pythonPackages; in
(oldAttrs.propagatedBuildInputs or []) ++ [ import ./make-test.nix ({ pkgs, lib, ... }: {
passlib name = "radicale";
]; meta.maintainers = with lib.maintainers; [ aneeshusa infinisil ];
});
}; machine = {
common = { config, pkgs, ...}: {
services.radicale = { services.radicale = {
enable = true; enable = true;
config = let home = config.users.extraUsers.radicale.home; in '' config = ''
[server]
hosts = 127.0.0.1:${builtins.toString port}
daemon = False
[encoding]
[well-known]
[auth] [auth]
type = htpasswd type = htpasswd
htpasswd_filename = /etc/radicale/htpasswd htpasswd_filename = /etc/radicale/htpasswd
htpasswd_encryption = bcrypt htpasswd_encryption = bcrypt
[git]
[rights]
[storage] [storage]
type = filesystem filesystem_folder = /tmp/collections
filesystem_folder = ${home}/collections
[logging] [logging]
[headers] debug = True
''; '';
}; };
# WARNING: DON'T DO THIS IN PRODUCTION! # WARNING: DON'T DO THIS IN PRODUCTION!
# This puts secrets (albeit hashed) directly into the Nix store for ease of testing. # This puts secrets (albeit hashed) directly into the Nix store for ease of testing.
environment.etc."radicale/htpasswd".source = with pkgs; let environment.etc."radicale/htpasswd".source = pkgs.runCommand "htpasswd" {} ''
py = python.withPackages(ps: with ps; [ passlib ]); ${pkgs.apacheHttpd}/bin/htpasswd -bcB "$out" ${user} ${password}
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, ... }: { # This tests whether the web interface is accessible to an authenticated user
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 = '' testScript = ''
for my $machine ($py2, $py3) {
$machine->waitForUnit('radicale.service'); $machine->waitForUnit('radicale.service');
$machine->waitForOpenPort(${builtins.toString port}); $machine->waitForOpenPort(${port});
$machine->succeed('curl -s http://someuser:really_secret_password@127.0.0.1:${builtins.toString port}/someuser/calendar.ics/'); $machine->succeed('curl --fail http://${user}:${password}@localhost:${port}/.web/');
}
''; '';
}) })

View File

@ -0,0 +1,34 @@
{ 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 ];
};
}

View File

@ -1,21 +1,27 @@
{ stdenv, fetchurl, pythonPackages }: { stdenv, fetchFromGitHub, python3Packages }:
pythonPackages.buildPythonApplication rec { let
version = "2.1.2";
sha256 = "0gmbnvm17j0ilcnci1k2jh0vkbz5g8xlk9lgia5mlx790048hlm8";
in
python3Packages.buildPythonApplication {
name = "radicale-${version}"; name = "radicale-${version}";
version = "1.1.4"; inherit version;
src = fetchurl { src = fetchFromGitHub {
url = "mirror://pypi/R/Radicale/Radicale-${version}.tar.gz"; owner = "Kozea";
sha256 = "17p0hayyw30pfb81xqvd7jhjm6yrk2dnbgvqagx1nqdsr89ar0ss"; repo = "Radicale";
rev = version;
inherit sha256;
}; };
propagatedBuildInputs = stdenv.lib.optionals (!pythonPackages.isPy3k) [ doCheck = false;
pythonPackages.flup
pythonPackages.ldap
pythonPackages.sqlalchemy
];
doCheck = !pythonPackages.isPy3k; propagatedBuildInputs = with python3Packages; [
vobject
passlib
];
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = http://www.radicale.org/; homepage = http://www.radicale.org/;
@ -29,6 +35,6 @@ pythonPackages.buildPythonApplication rec {
''; '';
license = licenses.gpl3Plus; license = licenses.gpl3Plus;
platforms = platforms.all; platforms = platforms.all;
maintainers = with maintainers; [ edwtjo pSub aneeshusa ]; maintainers = with maintainers; [ edwtjo pSub aneeshusa infinisil ];
}; };
} }

View File

@ -11468,7 +11468,10 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) AppKit Carbon Cocoa; inherit (darwin.apple_sdk.frameworks) AppKit Carbon Cocoa;
}; };
radicale = callPackage ../servers/radicale { }; radicale1 = callPackage ../servers/radicale/1.x.nix { };
radicale2 = callPackage ../servers/radicale/default.nix { };
radicale = radicale2;
rake = callPackage ../development/tools/build-managers/rake { }; rake = callPackage ../development/tools/build-managers/rake { };