-
-
Notifications
You must be signed in to change notification settings - Fork 97
/
flake.nix
55 lines (49 loc) · 1.47 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
{
description = "OWASP dep-scan Nix Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
pyproject-nix = {
url = "github:nix-community/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, pyproject-nix }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
project = pyproject-nix.lib.project.loadPyproject {
projectRoot = ./.;
};
in
{
formatter = forAllSystems ({ pkgs }: pkgs.nixpkgs-fmt);
packages = forAllSystems ({ pkgs }:
let
python = pkgs.python3;
attrs = project.renderers.buildPythonPackage { inherit python; };
in
{
default = python.pkgs.buildPythonPackage (attrs // {
pname = "depscan";
propagatedBuildInputs = attrs.propagatedBuildInputs ++ [ pkgs.cdxgen ];
});
}
);
devShells = forAllSystems ({ pkgs }:
let
python = pkgs.python3;
arg = project.renderers.withPackages { inherit python; extras = [ "dev" ]; };
pythonEnv = python.withPackages arg;
in
{
default = pkgs.mkShell {
packages = [
pkgs.cdxgen
pythonEnv
];
};
});
};
}