I setup a next.js project with pkgs.mkshell, and used nix develop to automatically build the project. However, when I leave the shell, the files persist. How should/can(?) I setup my shell.nix so that files in the directory it drops down into are automatically removed when leaving the ephemeral shell?

  • Atemu@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    WDYM by “directory it drops down into”? nix develop stays in your current working directory.

    If I wanted to clean up state, I’d create a clean task in the build system or build a clean script that I’d wire up to the flake outputs such that you could run nix run .#clean.

    • yboutros@infosec.pubOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      I see, thanks

      As for “drop down”, I was loosely referring to the newly spawned terminal

      clean scripts get the job done. I was thinking of persisting changes to the filesystem state only while the ephemeral shell was live, that way every time I ran nix develop i would check to make sure my project could automatically build, and If there was any state that needed persisting, I would have to commit/push and label those changes somewhere before ending my session