-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
87 lines (69 loc) · 2.12 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
87
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (builtins) attrValues foldl';
inherit (pkgs.lib.lists) intersectLists forEach;
# Like "lib.lists.intersectLists" but takes a list of lists instead of two list arguments.
intersectAll = foldl' (a: b: a b) intersectLists;
# Takes a list of packages and returns the intersection of all platforms supported by those packages.
intersectPlatforms = pkgs: intersectAll (forEach pkgs (pkg: pkg.meta.platforms));
usbreqDeps = attrValues {
inherit (pkgs.python3Packages)
pyusb
inflection
;
};
usbreq = pkgs.python3Packages.buildPythonPackage rec {
pname = "usbreq";
version = "0.2.1";
format = "pyproject";
src = ./.;
meta = {
description = "A USB library for humans";
#platforms = intersectPlatforms (with pkgs.python3Packages; [ pyusb inflection ]);
platforms = intersectPlatforms usbreqDeps;
};
outputs = [
"out"
"doc"
];
pythonImportsCheck = [ "usbreq" ];
propagatedBuildInputs = usbreqDeps;
nativeBuildInputs = attrValues {
inherit (pkgs.python3Packages)
setuptools
wheel
sphinxHook
;
};
# I guess documentation builders are check inputs?
nativeCheckInputs = attrValues {
inherit (pkgs.python3Packages)
sphinx
sphinx-rtd-theme
;
};
};
in {
packages.default = usbreq;
devShells.default = pkgs.mkShell {
inputsFrom = [ usbreq ];
packages = attrValues {
inherit (pkgs.python3Packages)
build
twine
# IPython is a much nicer development experience.
ipython
;
} ++ [
pkgs.pyright
];
};
}
);
}