This issue is in reference to the thaigersprint-2025 branch of eelco.
Current example of shell-session workflow
shell.nix:
let
pkgs = import <nixpkgs> { config = {}; overlays = []; };
in
pkgs.mkShellNoCC {
packages = with pkgs; [
direnv
which
hello
];
}
$ echo "use nix" > .envrc
$ nix-shell
...
$ direnv allow
...
$ which hello
/nix/store/...-hello-...
Currently, the shell-session below cannot be executed successfully because it's not persisted from the previous step. The only way to make it work is to re-launch nix-shell and re-execute direnv allow, which seems unnecessarily repetitive:
$ which hello
/nix/store/...-hello-...
Desired behavior of shell-session workflow
I'd like to avoid having to specify packages in shell.nix in order to work around the fact that nix-shell instances are not persisted across example steps. I'd like to be able to use packages installed in a previous launch of nix-shell in subsequent steps of an example, like so:
shell.nix:
let
pkgs = import <nixpkgs> { config = {}; overlays = []; };
in
pkgs.mkShellNoCC {
packages = with pkgs; [
hello
];
}
$ echo "use nix" > .envrc
$ NIX_SHELL_PRESERVE_PROMPT=1 nix-shell -p direnv which
...
$ direnv allow
...
$ which hello
/nix/store/...-hello-...
This would enable examples to better align with the flow of the documentation.
This issue is in reference to the thaigersprint-2025 branch of eelco.
Current example of shell-session workflow
shell.nix:Currently, the shell-session below cannot be executed successfully because it's not persisted from the previous step. The only way to make it work is to re-launch
nix-shelland re-executedirenv allow, which seems unnecessarily repetitive:Desired behavior of shell-session workflow
I'd like to avoid having to specify packages in
shell.nixin order to work around the fact thatnix-shellinstances are not persisted across example steps. I'd like to be able to use packages installed in a previous launch ofnix-shellin subsequent steps of an example, like so:shell.nix:This would enable examples to better align with the flow of the documentation.