-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflake.nix
86 lines (82 loc) · 2.76 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
description = "Nix: pdh";
nixConfig.bash-prompt-prefix = "\(nix\)";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, poetry2nix, ... }@inputs:
flake-utils.lib.eachSystem [
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
]
(system:
let
pkgs = import nixpkgs { inherit system; };
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication defaultPoetryOverrides mkPoetryPackages;
overrides = defaultPoetryOverrides.extend
(self: super: {
pdpyras = super.pdpyras.overridePythonAttrs
(
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
}
);
});
projectDir = ./.;
preferWheels = true;
# build the list of depnendencies from poetry lock file
poetryPkgs = mkPoetryPackages {
inherit projectDir preferWheels overrides;
};
in
{
packages = {
cli = mkPoetryApplication {
inherit projectDir preferWheels overrides;
propagatedBuildInputs = [ poetryPkgs.poetryPackages ];
};
module = pkgs.python3Packages.buildPythonPackage {
name = "pdh";
src = self;
projectDir = ./.;
format = "pyproject";
nativeBuildInputs = [
pkgs.python3Packages.poetry-core
pkgs.python3Packages.setuptools
];
propagatedBuildInputs = [
poetryPkgs.poetryPackages
pkgs.python3Packages.setuptools
];
nativeCheckInputs = [
pkgs.python3Packages.pytestCheckHook
];
pythonImportsCheck = [
"pdh"
];
};
default = self.packages.${system}.cli;
};
devShell = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.cli];
packages = with pkgs; [
pre-commit
go-task
(python3.withPackages (ps: with ps; [ self.packages.${system}.module ]))
poetry
docker
cachix
statix
];
shellHook = ''
'';
};
}
);
}