diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-29 19:33:17 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-29 19:33:17 +0900 |
| commit | 8b62e08b44d255fcb15e94bd2ed721f34c65a726 (patch) | |
| tree | f46d60837818f678bfa1ca6934f7ccb60c2b2bf5 /test/configuration.nix | |
| parent | 72c59f92298cf6ec872bb0c93e44bea4efd72aec (diff) | |
test: build test program in nixos config
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'test/configuration.nix')
| -rw-r--r-- | test/configuration.nix | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/test/configuration.nix b/test/configuration.nix index fa1ecca2..93f1b39c 100644 --- a/test/configuration.nix +++ b/test/configuration.nix @@ -5,7 +5,38 @@ ... }: let - testCases = import ./sandbox/case pkgs config.environment.fortify.package.version; + testProgram = + let + inherit (pkgs) + buildGoModule + pkg-config + util-linux + ; + in + buildGoModule rec { + pname = "check-sandbox"; + inherit (config.environment.fortify.package) version; + + src = builtins.path { + name = "${pname}-src"; + path = lib.cleanSource ./.; + filter = path: type: (type == "directory" && lib.hasSuffix "sandbox" path) || (type == "regular" && lib.hasSuffix ".go" path); + }; + vendorHash = null; + + buildInputs = [ util-linux ]; + nativeBuildInputs = [ pkg-config ]; + + preBuild = '' + go mod init git.gensokyo.uk/security/fortify/test >& /dev/null + ''; + + postInstall = '' + mv $out/bin/test $out/bin/fortify-test + ''; + }; + + testCases = import ./sandbox/case lib testProgram; in { users.users = { @@ -42,7 +73,7 @@ in mako # For checking seccomp outcome: - testCases._testProgram + testProgram ]; variables = { |
