2017-02-02 22:59:39 +00:00
|
|
|
let
|
2017-07-25 08:01:08 +01:00
|
|
|
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 = {
|
2017-02-02 22:59:39 +00:00
|
|
|
services.radicale = {
|
|
|
|
enable = true;
|
2017-07-25 08:01:08 +01:00
|
|
|
config = ''
|
2017-02-02 22:59:39 +00:00
|
|
|
[auth]
|
|
|
|
type = htpasswd
|
|
|
|
htpasswd_filename = /etc/radicale/htpasswd
|
|
|
|
htpasswd_encryption = bcrypt
|
2017-07-25 08:01:08 +01:00
|
|
|
|
2017-02-02 22:59:39 +00:00
|
|
|
[storage]
|
2017-07-25 08:01:08 +01:00
|
|
|
filesystem_folder = /tmp/collections
|
|
|
|
|
2017-02-02 22:59:39 +00:00
|
|
|
[logging]
|
2017-07-25 08:01:08 +01:00
|
|
|
debug = True
|
2017-02-02 22:59:39 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
# WARNING: DON'T DO THIS IN PRODUCTION!
|
|
|
|
# This puts secrets (albeit hashed) directly into the Nix store for ease of testing.
|
2017-07-25 08:01:08 +01:00
|
|
|
environment.etc."radicale/htpasswd".source = pkgs.runCommand "htpasswd" {} ''
|
|
|
|
${pkgs.apacheHttpd}/bin/htpasswd -bcB "$out" ${user} ${password}
|
2017-02-02 22:59:39 +00:00
|
|
|
'';
|
|
|
|
};
|
2017-07-25 08:01:08 +01:00
|
|
|
|
|
|
|
# This tests whether the web interface is accessible to an authenticated user
|
2017-02-02 22:59:39 +00:00
|
|
|
testScript = ''
|
2017-07-25 08:01:08 +01:00
|
|
|
$machine->waitForUnit('radicale.service');
|
|
|
|
$machine->waitForOpenPort(${port});
|
|
|
|
$machine->succeed('curl --fail http://${user}:${password}@localhost:${port}/.web/');
|
2017-02-02 22:59:39 +00:00
|
|
|
'';
|
2017-03-20 16:13:27 +00:00
|
|
|
})
|