2017-02-02 23:59:39 +01:00
|
|
|
let
|
2017-07-25 09:01:08 +02: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 23:59:39 +01:00
|
|
|
services.radicale = {
|
|
|
|
enable = true;
|
2017-07-25 09:01:08 +02:00
|
|
|
config = ''
|
2017-02-02 23:59:39 +01:00
|
|
|
[auth]
|
|
|
|
type = htpasswd
|
|
|
|
htpasswd_filename = /etc/radicale/htpasswd
|
|
|
|
htpasswd_encryption = bcrypt
|
2017-07-25 09:01:08 +02:00
|
|
|
|
2017-02-02 23:59:39 +01:00
|
|
|
[storage]
|
2017-07-25 09:01:08 +02:00
|
|
|
filesystem_folder = /tmp/collections
|
|
|
|
|
2017-02-02 23:59:39 +01:00
|
|
|
[logging]
|
2017-07-25 09:01:08 +02:00
|
|
|
debug = True
|
2017-02-02 23:59:39 +01: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 09:01:08 +02:00
|
|
|
environment.etc."radicale/htpasswd".source = pkgs.runCommand "htpasswd" {} ''
|
|
|
|
${pkgs.apacheHttpd}/bin/htpasswd -bcB "$out" ${user} ${password}
|
2017-02-02 23:59:39 +01:00
|
|
|
'';
|
|
|
|
};
|
2017-07-25 09:01:08 +02:00
|
|
|
|
|
|
|
# This tests whether the web interface is accessible to an authenticated user
|
2017-02-02 23:59:39 +01:00
|
|
|
testScript = ''
|
2017-07-25 09:01:08 +02:00
|
|
|
$machine->waitForUnit('radicale.service');
|
|
|
|
$machine->waitForOpenPort(${port});
|
|
|
|
$machine->succeed('curl --fail http://${user}:${password}@localhost:${port}/.web/');
|
2017-02-02 23:59:39 +01:00
|
|
|
'';
|
2017-03-20 17:13:27 +01:00
|
|
|
})
|