1 { name, pkgs, testBase, system,... }:
3 with import ../../lib/testing-python.nix { inherit system pkgs; };
4 runTest ({ config, ... }: {
6 meta = with pkgs.lib.maintainers; {
7 maintainers = [ globin eqyiel ma27 ];
10 imports = [ testBase ];
13 # The only thing the client needs to do is download a file.
15 services.davfs2.enable = true;
16 systemd.tmpfiles.settings.nextcloud = {
17 "/tmp/davfs2-secrets"."f+" = {
19 argument = "http://nextcloud/remote.php/dav/files/${config.adminuser} ${config.adminuser} ${config.adminpass}";
22 virtualisation.fileSystems = {
24 device = "http://nextcloud/remote.php/dav/files/${config.adminuser}";
27 davfs2Conf = (pkgs.writeText "davfs2.conf" "secrets /tmp/davfs2-secrets");
28 in [ "conf=${davfs2Conf}" "x-systemd.automount" "noauto"];
33 nextcloud = { config, pkgs, ... }: {
34 systemd.tmpfiles.rules = [
35 "d /var/lib/nextcloud-data 0750 nextcloud nginx - -"
38 services.nextcloud = {
40 datadir = "/var/lib/nextcloud-data";
45 phpExtraExtensions = all: [ all.bz2 ];
48 specialisation.withoutMagick.configuration = {
49 services.nextcloud.enableImagemagick = false;
54 test-helpers.extraTests = { nodes, ... }: let
55 findInClosure = what: drv: pkgs.runCommand "find-in-closure" { exportReferencesGraph = [ "graph" drv ]; inherit what; } ''
57 grep "$what" graph >$out || true
59 nexcloudWithImagick = findInClosure "imagick" nodes.nextcloud.system.build.vm;
60 nextcloudWithoutImagick = findInClosure "imagick" nodes.nextcloud.specialisation.withoutMagick.configuration.system.build.vm;
62 with subtest("File is in proper nextcloud home"):
63 nextcloud.succeed("test -f ${nodes.nextcloud.services.nextcloud.datadir}/data/root/files/test-shared-file")
65 with subtest("Closure checks"):
66 assert open("${nexcloudWithImagick}").read() != ""
67 assert open("${nextcloudWithoutImagick}").read() == ""
69 with subtest("Davfs2"):
70 assert "hi" in client.succeed("cat /mnt/dav/test-shared-file")
72 with subtest("Ensure SSE is disabled by default"):
73 nextcloud.succeed("grep -vE '^HBEGIN:oc_encryption_module' /var/lib/nextcloud-data/data/root/files/test-shared-file")