nix-community / lorri

Your project’s nix-env [maintainer=@Profpatsch,@nyarly]
Apache License 2.0
638 stars 24 forks source link

Cannot write to file with shellHook #69

Open winston0410 opened 2 years ago

winston0410 commented 2 years ago

Describe the bug I am trying to write to a file from the shellHook.

{...}:
pkgs.mkShell {
  shellHook = ''
    echo "hello" >> $HOME/hello
  '';
}

And I cannot find the file after I have entered the dir.

I have tried this example from this issue, which the hook is running.

with import <nixpkgs> {};

mkShell {
  shellHook = ''
  export FOO=BAR
  '';
}

To Reproduce Steps to reproduce the behavior:

  1. lorri init
  2. direnv allow
  3. Paste the code in
    {...}:
    pkgs.mkShell {
    shellHook = ''
    echo "hello" >> $HOME/hello
    '';
    }
  4. Exit and enter again, and check for output

Expected behavior I expect it will generate a file in $HOME/hello

Metadata

$ lorri info
`lorri info --shell-file ./shell.nix`
lorri version: 1.5
GC roots do not exist. Has the project been built with lorri yet?

This is weird. I have built it by exiting  and entering more than once. Not sure if there is any insight from this output
$ uname -a
Linux nixos 5.14.3 #1-NixOS SMP Sun Sep 12 07:01:00 UTC 2021 x86_64 GNU/Linux

Additional context