-
Notifications
You must be signed in to change notification settings - Fork 21
/
flake.nix
65 lines (55 loc) · 1.83 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils?ref=main";
nix-filter.url = "github:numtide/nix-filter?ref=main";
poetry2nix = {
url = "github:nix-community/poetry2nix?ref=master";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system:
let
# pkgs = inputs.nixpkgs.legacyPackages.${system};
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
python = pkgs.python3;
builder = (inputs.poetry2nix.lib.mkPoetry2Nix {
inherit pkgs;
}).mkPoetryApplication;
in {
packages.default = builder {
inherit python;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
src = let filter = inputs.nix-filter.lib;
in filter {
root = ./.;
include = [ "README.md" "poetry.lock" "pyproject.toml" "beangrow" ];
exclude = [ (filter.matchName "__pycache__") ];
};
};
devShells.default = pkgs.mkShell {
packages = [ python ]
++ (with python.pkgs; [ black pip pytest pytest-cov ])
++ (with pkgs; [
engage
nixpkgs-fmt
poetry
pyright
ruff
]) ++ (with pkgs.nodePackages; [ markdownlint-cli ]);
NIX_PYTHON_SITE_PACKAGES = python.sitePackages;
shellHook = ''
export LD_LIBRARY_PATH="${
pkgs.lib.makeLibraryPath [ pkgs.zlib ]
}:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH"
'';
};
});
}