-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathflake.nix
78 lines (78 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
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";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
poetry2nix,
}:
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = (
import nixpkgs {
inherit system;
config = { };
overlays = [
poetry2nix.overlays.default
];
}
);
overrides = pkgs.poetry2nix.overrides.withDefaults (
self: super:
let
buildSystems = {
durations = [ "setuptools" ];
multitail2 = [ "setuptools" ];
pytest-github-actions-annotate-failures = [ "setuptools" ];
flake8-black = [ "setuptools" ];
flake8-isort = [ "hatchling" ];
docker = [
"hatchling"
"hatch-vcs"
];
};
in
pkgs.lib.mapAttrs (
attr: systems:
super.${attr}.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
})
) buildSystems
);
in
rec {
packages.default = pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
inherit overrides;
};
apps.default = {
type = "app";
program = "${packages.default}/bin/pystarport";
};
devShells.default = pkgs.mkShell {
buildInputs = [
(pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
inherit overrides;
})
(pkgs.poetry2nix.mkPoetryEditablePackage {
projectDir = ./.;
editablePackageSources = {
pystarport = ./pystarport;
};
})
];
};
}
));
}