{ pkgs, lib, ... }: let pkgs' = pkgs; testLib = pkgs.callPackage ../common.nix {}; subdomain = "g"; domain = "example.com"; fqdn = "${subdomain}.${domain}"; commonTestScript = testLib.accessScript { inherit fqdn; hasSSL = { node, ... }: !(isNull node.config.shb.grocy.ssl); waitForServices = { ... }: [ "phpfpm-grocy.service" "nginx.service" ]; waitForUnixSocket = { node, ... }: [ node.config.services.phpfpm.pools.grocy.socket ]; # TODO: Test login # extraScript = { ... }: '' # ''; }; base = { imports = [ (pkgs'.path + "/nixos/modules/profiles/headless.nix") (pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix") { options = { shb.backup = lib.mkOption { type = lib.types.anything; }; }; } ../../modules/services/grocy.nix ]; # Nginx port. networking.firewall.allowedTCPPorts = [ 80 443 ]; }; certs = { config, ... }: { imports = [ ../../modules/blocks/ssl.nix ]; shb.certs = { cas.selfsigned.myca = { name = "My CA"; }; certs.selfsigned = { n = { ca = config.shb.certs.cas.selfsigned.myca; domain = "*.${domain}"; group = "nginx"; }; }; }; systemd.services.nginx.after = [ config.shb.certs.certs.selfsigned.n.systemdService ]; systemd.services.nginx.requires = [ config.shb.certs.certs.selfsigned.n.systemdService ]; }; basic = { config, ... }: { shb.grocy = { enable = true; inherit domain subdomain; }; }; https = { config, ...}: { shb.grocy = { ssl = config.shb.certs.certs.selfsigned.n; }; }; in { basic = pkgs.testers.runNixOSTest { name = "grocy-basic"; nodes.server = lib.mkMerge [ base basic { options = { shb.authelia = lib.mkOption { type = lib.types.anything; }; }; } ]; nodes.client = {}; testScript = commonTestScript; }; https = pkgs.testers.runNixOSTest { name = "grocy-https"; nodes.server = lib.mkMerge [ base certs basic https { options = { shb.authelia = lib.mkOption { type = lib.types.anything; }; }; } ]; nodes.client = {}; testScript = commonTestScript; }; }