-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
79 lines (72 loc) · 2.09 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
{
description = "Silicon Heaven CLI";
inputs.pyshv.url = "gitlab:silicon-heaven/pyshv";
outputs = {
self,
flake-utils,
nixpkgs,
pyshv,
}: let
inherit (builtins) match;
inherit (flake-utils.lib) eachSystem defaultSystems filterPackages;
inherit (nixpkgs.lib) head trivial hasSuffix attrValues getAttrs composeManyExtensions;
pyproject = trivial.importTOML ./pyproject.toml;
inherit (pyproject.project) name version;
src = builtins.path {
path = ./.;
filter = path: _: ! hasSuffix ".nix" path;
};
pypi2nix = list: pypkgs:
attrValues (getAttrs (map (n: let
pyname = head (match "([^ =<>;]*).*" n);
pymap = {};
in
pymap."${pyname}" or pyname)
list)
pypkgs);
requires = pypi2nix pyproject.project.dependencies;
package = {python3Packages}:
python3Packages.buildPythonApplication {
pname = pyproject.project.name;
inherit version src;
pyproject = true;
build-system = [python3Packages.setuptools];
propagatedBuildInputs = requires python3Packages;
meta.mainProgram = "shvcli";
};
in
{
overlays = {
noInherit = final: _: {
"${name}" = final.callPackage package {};
};
default = composeManyExtensions [
pyshv.overlays.default
self.overlays.noInherit
];
};
}
// eachSystem (defaultSystems ++ ["armv7l-linux"]) (system: let
pkgs = nixpkgs.legacyPackages.${system}.extend self.overlays.default;
in {
packages.default = pkgs."${name}";
legacyPackages = pkgs;
devShells = filterPackages system {
default = pkgs.mkShell {
packages = with pkgs; [
editorconfig-checker
statix
deadnix
gitlint
ruff
(
python3.withPackages (p:
[p.build p.twine p.mypy] ++ (requires p))
)
];
};
};
checks.default = self.packages.${system}.default;
formatter = pkgs.alejandra;
});
}