-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshell.nix
36 lines (36 loc) · 1.15 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
34
35
36
{
pkgs ? import (builtins.fetchGit {
url = "https://github.com/NixOS/nixpkgs/";
ref = "refs/tags/23.11";
}) {},
dev ? true,
}:
let
py310 = pkgs.python310;
py311 = pkgs.python311;
poetryExtras = if dev then ["dev"] else [];
poetryInstallExtras = (
if poetryExtras == [] then ""
else pkgs.lib.concatStrings [ " --with=" (pkgs.lib.concatStringsSep "," poetryExtras) ]
);
in
pkgs.mkShell {
name = "spotfishing-env";
buildInputs = with pkgs; [
pkgs.zlib
pkgs.stdenv.cc.cc.lib
poetry
py310
py311
] ++ (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"
export LD_LIBRARY_PATH="${pkgs.zlib}/lib:${pkgs.stdenv.cc.cc.lib}/lib"
poetry install -vv --sync${poetryInstallExtras}
source "$(poetry env info --path)/bin/activate"
'';
}