-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
41 lines (36 loc) · 1.2 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
{
# Inspired by https://www.reddit.com/r/NixOS/comments/q71v0e/comment/hgn4sar/
description = "A flake for pythonification";
inputs = {
# Ensure our nixpkgs revision is green in Hydra for both Linux and macOS (i.e. there are
# prebuilt binaries in the cache):
# https://status.nixos.org
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
pythonPackages = pkgs.python3Packages;
in rec {
devShell = pkgs.mkShell rec {
name = "impurePythonEnv";
venvDir = "./.venv";
buildInputs = with pkgs; [
# A Python interpreter including the 'venv' module is required to bootstrap
# the environment.
pythonPackages.python
# This executes some shell code to initialize a venv in $venvDir before
# dropping into the shell
pythonPackages.venvShellHook
];
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements.txt
'';
};
}
);
}