Skip to content

Commit

Permalink
fix(images): improve jupyter and base
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkolenz committed Nov 17, 2024
1 parent bd058f9 commit 10f4fe5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flake-modules/images.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{ config, pkgs, ... }:
{
packages = {
image-base = pkgs.callPackage ../images/base.nix { };
image-base = pkgs.callPackage ../images/base.nix { name = "base"; };
image-jupyter = pkgs.callPackage ../images/jupyter.nix { base = config.packages.image-base; };
image-poetry = pkgs.callPackage ../images/poetry.nix { base = config.packages.image-base; };
image-uv = pkgs.callPackage ../images/uv.nix { base = config.packages.image-base; };
Expand Down
2 changes: 1 addition & 1 deletion images/base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
glibc,
gcc,
nix-ld,
name ? "base",
name,
contents ? [ ],
entrypoint ? [ "/bin/sh" ],
cmd ? [ ],
Expand Down
13 changes: 7 additions & 6 deletions images/jupyter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ let
echo "Remove '${venvPath}' to force venv recreation with 'rm -rf ${venvPath}'"
else
echo "Creating new venv environment in path: '${venvPath}'"
${lib.getExe uv} venv --seed ${venvPath}
${lib.getExe uv} venv \
--seed \
--python ${lib.getExe python3} \
${venvPath}
${lib.getExe uv} pip install \
cbrkit \
jupyterlab \
Expand All @@ -31,7 +34,6 @@ let
torch \
transformers \
;
fi
'';

Expand All @@ -50,14 +52,13 @@ let
);
in
base.override {
name = "jupyter";
entrypoint = [ (lib.getExe entrypoint) ];
contents = [
python3
uv
];
contents = [ uv ];
env = {
VIRTUAL_ENV = venvPath;
UV_PYTHON_PREFERENCE = "only-system";
UV_PYTHON_DOWNLOADS = "never";
PATH = lib.concatStringsSep ":" [
"${venvPath}/bin"
"/usr/local/bin"
Expand Down

0 comments on commit 10f4fe5

Please sign in to comment.