forked from jedbrown/git-fat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
61 lines (58 loc) · 1.77 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
{
description = "Git-fat packaged using poetry2nix";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.poetry2nix = {
url = "github:K900/poetry2nix/new-bootstrap-fixes";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
flake-utils,
poetry2nix,
...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
# see https://github.com/nix-community/poetry2nix/tree/master#api for more functions and examples.
p2n = poetry2nix.legacyPackages.${system};
inherit (p2n) mkPoetryApplication;
pkgs = nixpkgs.legacyPackages.${system};
pypkgs-build-requirements = {
path-py = ["setuptools"];
pytest = ["hatchling"];
pytest-env = ["hatchling" "hatch-vcs"];
pytest-git = ["setuptools"];
};
p2n-overrides = p2n.defaultPoetryOverrides.extend (
self: super:
builtins.mapAttrs (
package: build-requirements:
(builtins.getAttr package super).overridePythonAttrs (old: {
buildInputs =
(old.buildInputs or [])
++ (builtins.map (pkg:
if builtins.isString pkg
then builtins.getAttr pkg super
else pkg)
build-requirements);
})
)
pypkgs-build-requirements
);
in {
packages = {
git-fat = mkPoetryApplication {
projectDir = self;
overrides = p2n-overrides;
};
default = self.packages.${system}.git-fat;
};
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.poetry
pkgs.python310
];
};
});
}