-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathflake.nix
52 lines (46 loc) · 1.36 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
{
description = "Create Nix development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
# 3.12.1 release
python-nixpkgs.url = "github:NixOS/nixpkgs/fd04bea4cbf76f86f244b9e2549fca066db8ddff";
# 20.6.1 release
nodejs-nixpkgs.url = "github:NixOS/nixpkgs/78058d810644f5ed276804ce7ea9e82d92bee293";
pyproject-nix = {
url = "github:nix-community/pyproject.nix";
flake = false;
};
};
outputs = {
self,
flake-utils,
python-nixpkgs,
nodejs-nixpkgs,
pyproject-nix,
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = python-nixpkgs.legacyPackages.${system};
python = pkgs.python312;
nodejs = nodejs-nixpkgs.legacyPackages.${system}.nodejs_20;
pyproject = import (pyproject-nix + "/lib") {inherit (pkgs) lib;};
project = pyproject.project.loadRequirementsTxt {
requirements = ./dev_requirements.txt;
};
pythonEnv = pkgs.python3.withPackages (pyproject.renderers.withPackages {
inherit project python;
});
in {
devShells.default = pkgs.mkShell {
packages = [
pythonEnv
nodejs
];
shellHook = ''
echo "node" "$(node --version)"
echo "npm" "$(npm --version)"
python --version
'';
};
formatter = pkgs.alejandra;
});
}