-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
60 lines (54 loc) · 1.67 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
{
inputs = {
nixpkgs = {
url = github:NixOS/nixpkgs;
};
poetry2nix = {
url = github:nix-community/poetry2nix;
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
flake-utils = {
url = github:numtide/flake-utils;
};
};
outputs = { self, nixpkgs, ...}@inputs: {
overlay = nixpkgs.lib.composeManyExtensions [
inputs.poetry2nix.overlay
];
} // (inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import "${inputs.nixpkgs}/pkgs/top-level" {
localSystem = { inherit system; };
overlays = [ self.overlay ];
};
poetryOverrides = pkgs.poetry2nix.overrides.withDefaults (final: prev: {
pyzbar = prev.pyzbar.overridePythonAttrs (_: {
postPatch = ''
substituteInPlace pyzbar/zbar_library.py \
--replace \
"find_library('zbar')" \
'"${pkgs.lib.getLib pkgs.zbar}/lib/libzbar${pkgs.stdenv.hostPlatform.extensions.sharedLibrary}"'
'';
});
});
extraBuildInputs = [];
poetryArgs = {
projectDir = ./.;
overrides = poetryOverrides;
};
airscan-paperless = pkgs.poetry2nix.mkPoetryApplication
(poetryArgs // { propagatedBuildInputs = extraBuildInputs; });
poetryShell = pkgs.poetry2nix.mkPoetryEnv poetryArgs;
in rec {
defaultPackage = packages.airscan-paperless;
packages.airscan-paperless = airscan-paperless;
devShell = pkgs.mkShell {
inputsFrom = [ poetryShell.env ];
buildInputs = [
pkgs.pyright pkgs.poetry
] ++ extraBuildInputs;
};
}
));
}