nixpkgs/nixos/tests/radicale.nix
Silvan Mosberger e16a0988bc
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.
2017-08-13 17:23:43 +02:00

40 lines
1.1 KiB
Nix

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/');
'';
})