forked from mtlynch/resticpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
47 lines (40 loc) · 1.26 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
{
description = "Create Nix development environment";
# Python 3.12.1 release
inputs.nixpkgs.url = "github:NixOS/nixpkgs/fd04bea4cbf76f86f244b9e2549fca066db8ddff";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.pyproject-nix.url = "github:nix-community/pyproject.nix";
# Don't use the pyproject.nix flake directly to avoid its inputs in our
# closure.
inputs.pyproject-nix.flake = false;
outputs = { self, nixpkgs, flake-utils, pyproject-nix }:
let
pyproject = import (pyproject-nix + "/lib") { inherit (nixpkgs) lib; };
# Load/parse dev_requirements.txt
project = pyproject.project.loadRequirementsTxt {
requirements = ./dev_requirements.txt;
};
in
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
python = pkgs.python312;
pythonEnv = (
# Render requirements.txt into a Python withPackages environment.
pkgs.python3.withPackages (pyproject.renderers.withPackages {
inherit project python;
})
);
in
{
devShell =
pkgs.mkShell {
packages = [
pythonEnv
];
shellHook = ''
python --version
'';
};
});
}