diff --git a/flake.nix b/flake.nix index 9caf0d9..58b152b 100644 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,30 @@ ''; }; }; + + checks.${system}.test-module = let + test-lib = import "${nixpkgs}/nixos/lib/testing-python.nix" { + inherit system; + }; + in + test-lib.makeTest { + name = "inquisitor-test-module"; + nodes = { + host = { ... }: { + imports = [ self.nixosModules.default ]; + services.inquisitor.enable = true; + }; + }; + testScript = '' + start_all() + host.wait_for_unit("multi-user.target") + # Check that the setup script ran + host.succeed("[ -e /var/lib/inquisitor ]") + # Check that the service came up + host.succeed("systemctl is-enabled inquisitor") + host.succeed("systemctl is-active inquisitor") + ''; + }; }; in (my-flake.outputs-for each systems) // { overlays.default = final: prev: { diff --git a/module.nix b/module.nix index e9043bc..d0d5581 100644 --- a/module.nix +++ b/module.nix @@ -31,7 +31,7 @@ in config = let # Get the inquisitor package from the flake. - inquisitor = flake.packages.${pkgs.stdenv.hostPlatform.system}.default; + inquisitor = flake.packages.${pkgs.stdenv.hostPlatform.system}.env; # Define the inquisitor state directory. stateDir = "/var/lib/inquisitor"; @@ -80,7 +80,7 @@ in if [ -f ${stateDir}/scp-helper ]; then ${pkgs.coreutils}/bin/rm ${stateDir}/scp-helper fi - ln -s -t ${stateDir}/scp-helper ${scp-helper}/bin/scp-helper + ln -s -t ${stateDir} ${scp-helper}/bin/scp-helper ''; # Create a run script for the service.