diff options
author | Silvan Mosberger <infinisil@icloud.com> | 2017-07-25 09:01:08 +0200 |
---|---|---|
committer | Silvan Mosberger <infinisil@icloud.com> | 2017-08-13 17:23:43 +0200 |
commit | e16a0988bc18be3997f5c475f373a8ac127d3fa0 (patch) | |
tree | 5d3acb65e70d4a5e36d04901f4296bd78ba29add /nixos/tests/radicale.nix | |
parent | 5bc183ebf868b32b599692a3b651a39d8a97dee3 (diff) | |
download | nixpkgs-e16a0988bc18be3997f5c475f373a8ac127d3fa0.tar nixpkgs-e16a0988bc18be3997f5c475f373a8ac127d3fa0.tar.gz nixpkgs-e16a0988bc18be3997f5c475f373a8ac127d3fa0.tar.bz2 nixpkgs-e16a0988bc18be3997f5c475f373a8ac127d3fa0.tar.lz nixpkgs-e16a0988bc18be3997f5c475f373a8ac127d3fa0.tar.xz nixpkgs-e16a0988bc18be3997f5c475f373a8ac127d3fa0.tar.zst nixpkgs-e16a0988bc18be3997f5c475f373a8ac127d3fa0.zip |
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.
Diffstat (limited to 'nixos/tests/radicale.nix')
-rw-r--r-- | nixos/tests/radicale.nix | 83 |
1 files changed, 21 insertions, 62 deletions
diff --git a/nixos/tests/radicale.nix b/nixos/tests/radicale.nix index 4c2ed8456dd..bec86d2cb28 100644 --- a/nixos/tests/radicale.nix +++ b/nixos/tests/radicale.nix @@ -1,80 +1,39 @@ let - port = 5232; - radicaleOverlay = self: super: { - radicale = super.radicale.overrideAttrs (oldAttrs: { - propagatedBuildInputs = with self.pythonPackages; - (oldAttrs.propagatedBuildInputs or []) ++ [ - passlib - ]; - }); - }; - common = { config, pkgs, ...}: { + 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 = let home = config.users.extraUsers.radicale.home; in '' - [server] - hosts = 127.0.0.1:${builtins.toString port} - daemon = False - [encoding] - [well-known] + config = '' [auth] type = htpasswd htpasswd_filename = /etc/radicale/htpasswd htpasswd_encryption = bcrypt - [git] - [rights] + [storage] - type = filesystem - filesystem_folder = ${home}/collections + filesystem_folder = /tmp/collections + [logging] - [headers] + 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 = with pkgs; let - py = python.withPackages(ps: with ps; [ passlib ]); - 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() -" + environment.etc."radicale/htpasswd".source = pkgs.runCommand "htpasswd" {} '' + ${pkgs.apacheHttpd}/bin/htpasswd -bcB "$out" ${user} ${password} ''; }; - -in import ./make-test.nix ({ lib, ... }: { - 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 - ]; - }; - }; - + + # This tests whether the web interface is accessible to an authenticated user testScript = '' - for my $machine ($py2, $py3) { - $machine->waitForUnit('radicale.service'); - $machine->waitForOpenPort(${builtins.toString port}); - $machine->succeed('curl -s http://someuser:really_secret_password@127.0.0.1:${builtins.toString port}/someuser/calendar.ics/'); - } + $machine->waitForUnit('radicale.service'); + $machine->waitForOpenPort(${port}); + $machine->succeed('curl --fail http://${user}:${password}@localhost:${port}/.web/'); ''; }) |