diff --git a/pkgs/by-name/static-nix-shell/package.nix b/pkgs/by-name/static-nix-shell/package.nix index 5aaf6c987..c33210c20 100644 --- a/pkgs/by-name/static-nix-shell/package.nix +++ b/pkgs/by-name/static-nix-shell/package.nix @@ -105,13 +105,19 @@ in rec { buildPhase = '' runHook preBuild - #^ TODO: each shell should use preBuild to compute a `shellPreamble` die() { echo "$@" exit 1 } + if [ -n "$shellPreamble" ]; then + shellPreamble=" + # --- BEGIN: nix-shell preamble (generated code) --- + $shellPreamble + # --- END: nix-shell preamble (generated code) --- + " + fi substituteInPlace ${srcPath} \ --replace-fail '#!/usr/bin/env nix-shell' '#!${interpreter}' \ --replace-fail \ @@ -241,6 +247,7 @@ in rec { pkgsEnv = [ zsh ] ++ (builtins.attrValues pkgsAsAttrs); pkgExprs = insertTopo "zsh" (builtins.attrNames pkgsAsAttrs); in mkShell ({ + # TODO: generate `shellPreamble` here to reduce wrapping inherit pkgsEnv pkgExprs; interpreter = lib.getExe zsh; } // (removeAttrs attrs [ "pkgs" "zsh" ]) @@ -253,6 +260,7 @@ in rec { pkgsEnv = builtins.attrValues pkgsAsAttrs; pkgExprs = insertTopo "python3" (builtins.attrNames pkgsAsAttrs); in mkShell ({ + # TODO: generate `shellPreamble` here to reduce wrapping inherit pkgsEnv pkgExprs; interpreter = lib.getExe python3; interpreterName = "python3";