forked from the-nix-way/nix-flake-dev-environments
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
44 lines (36 loc) · 1.28 KB
/
flake.nix
File metadata and controls
44 lines (36 loc) · 1.28 KB
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
{
description = "A Nix-flake-based Python development environment";
# GitHub URLs for the Nix inputs we're using
inputs = {
# Simply the greatest package repository on the planet
nixpkgs.url = "github:NixOS/nixpkgs";
# A set of helper functions for using flakes
flake-utils.url = "github:numtide/flake-utils";
mach-nix.url = "github:DavHau/mach-nix";
};
outputs = { self, nixpkgs, flake-utils, mach-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
python = pkgs.python39;
pythonEnv = mach-nix.lib.${system}.mkPython {
requirements = builtins.readFile ./requirements.txt;
};
pythonTools = with pkgs.python39Packages; [ pip virtualenv ];
in {
devShells = {
default = pkgs.mkShell {
# Packages included in the environment
buildInputs = [ pythonEnv ] ++ pythonTools;
# Run when the shell is started up
shellHook = ''
${python}/bin/python --version
'';
};
};
packages = { venv = pythonEnv; };
defaultPackage = mach-nix.lib.${system}.mkPythonShell {
requirements = builtins.readFile ./requirements.txt;
};
});
}