-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
49 lines (41 loc) · 1.19 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
{
description = "Create Nix development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
# Python 3.12.0 release
python-nixpkgs.url = "github:NixOS/nixpkgs/e2b8feae8470705c3f331901ae057da3095cea10";
pyproject-nix = {
url = "github:nix-community/pyproject.nix";
flake = false;
};
};
outputs = {
self,
python-nixpkgs,
flake-utils,
pyproject-nix,
} @ inputs: let
pyproject = import (pyproject-nix + "/lib") {inherit (python-nixpkgs) lib;};
project = pyproject.project.loadRequirementsTxt {
requirements = ./dev_requirements.txt;
};
in
flake-utils.lib.eachDefaultSystem (system: let
python = python-nixpkgs.legacyPackages.${system}.python3;
pythonEnv = python-nixpkgs.legacyPackages.${system}.python3.withPackages (
pyproject.renderers.withPackages {
inherit project python;
}
);
in {
formatter = python-nixpkgs.legacyPackages.${system}.alejandra;
devShells.default = python-nixpkgs.legacyPackages.${system}.mkShell {
packages = [
pythonEnv
];
shellHook = ''
python --version
'';
};
});
}