aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/fortify/default.nix
blob: 448794139b5fe901babdf3a4f6ff9cecdbfa35fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  system,
  self,
  nixosTest,
  writeShellScriptBin,
}:

nixosTest {
  name = "fortify";
  nodes.machine = {
    environment.systemPackages = [
      # For go tests:
      self.packages.${system}.fhs
      (writeShellScriptBin "fortify-src" "echo -n ${self.packages.${system}.fortify.src}")
    ];

    # Run with Go race detector:
    environment.fortify.package =
      let
        inherit (self.packages.${system}) fortify;
      in
      fortify.overrideAttrs (previousAttrs: {
        GOFLAGS = previousAttrs.GOFLAGS ++ [ "-race" ];

        # fsu does not like cgo
        disallowedReferences = previousAttrs.disallowedReferences ++ [ fortify ];
        postInstall =
          previousAttrs.postInstall
          + ''
            cp -a "${fortify}/libexec/fsu" "$out/libexec/fsu"
            sed -i 's:${fortify}:${placeholder "out"}:' "$out/libexec/fsu"
          '';
      });

    imports = [
      ./configuration.nix

      self.nixosModules.fortify
      self.inputs.home-manager.nixosModules.home-manager
    ];
  };

  # adapted from nixos sway integration tests

  # testScriptWithTypes:49: error: Cannot call function of unknown type
  #           (machine.succeed if succeed else machine.execute)(
  #           ^
  # Found 1 error in 1 file (checked 1 source file)
  skipTypeCheck = true;
  testScript = builtins.readFile ./test.py;
}