-
Notifications
You must be signed in to change notification settings - Fork 1
/
shell.nix
33 lines (33 loc) · 1.02 KB
/
shell.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
{
pkgs ? import (builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs/";
ref = "refs/tags/23.11";
}) {},
dev ? true,
}:
let
py310 = pkgs.python310;
poetryExtras = if dev then ["dev"] else [];
poetryInstallExtras = (
if poetryExtras == [] then ""
else pkgs.lib.concatStrings [ " --with=" (pkgs.lib.concatStringsSep "," poetryExtras) ]
);
in
pkgs.mkShell {
name = "gertils-env";
buildInputs = with pkgs; [
poetry
py310
python311
python312
] ++ (if dev then [ pkgs.poetryPlugins.poetry-plugin-export ] else []);
shellHook = ''
# To get this working on the lab machine, we need to modify Poetry's keyring interaction:
# https://stackoverflow.com/questions/74438817/poetry-failed-to-unlock-the-collection
# https://github.com/python-poetry/poetry/issues/1917
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
poetry env use "${py310}/bin/python"
poetry install -vv --sync${poetryInstallExtras}
source "$(poetry env info --path)/bin/activate"
'';
}