-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
58 lines (55 loc) · 2.08 KB
/
flake.nix
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
52
53
54
55
56
57
58
# SPDX-FileCopyrightText: 2023 Arnout Engelen <[email protected]>
# SPDX-FileCopyrightText: 2023 Dylan Green <[email protected]>
#
# SPDX-License-Identifier: MIT
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
sbomnix = {
url = "github:tiiuae/sbomnix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs: let
lib = inputs.nixpkgs.lib;
project = self: self.callCabal2nix "LocalSecurityScanner" ./. {};
haskellPackages = pkgs: pkgs.haskell.packages.ghc947.override {
overrides = self: super: {
LocalSecurityScanner = pkgs.haskell.lib.overrideCabal (project self) (drv: {
libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [
inputs.sbomnix.packages."${pkgs.system}".sbomnix
];
});
};
};
supportedSystems = lib.genAttrs
[ "x86_64-linux"
"aarch64-linux"
];
in {
packages = supportedSystems (system: let
pkgs = inputs.nixpkgs.legacyPackages."${system}";
in { default = (haskellPackages pkgs).LocalSecurityScanner; });
devShells = supportedSystems (system: let
pkgs = inputs.nixpkgs.legacyPackages."${system}";
hsPkgs = haskellPackages pkgs;
in {
default = hsPkgs.shellFor {
packages = ps: with ps; [ LocalSecurityScanner ]; buildInputs = with hsPkgs; [ cabal-install ];
propagatedBuildInputs = [ inputs.sbomnix.packages."${system}".sbomnix ];
shellHook = let
ghcidWrapped = pkgs.writeShellScriptBin "ghcid" ''
${hsPkgs.ghcid.bin}/bin/ghcid --command "cabal repl"
'';
ghcidUnwrapped = pkgs.writeShellScriptBin "ghcid-unwrapped" ''
${hsPkgs.ghcid.bin}/bin/ghcid
'';
in ''
# To find freshly-`cabal install`ed executables
export PATH=~/.local/bin:${ghcidWrapped}/bin:${ghcidUnwrapped}/bin:$PATH
'';
};
LocalSecurityScanner = hsPkgs.shellFor { packages = ps: with ps; [ LocalSecurityScanner ]; buildInputs = with hsPkgs; [ cabal-install ghcid multi-containers ]; };
});
};
}