Hacker News new | past | comments | ask | show | jobs | submit login

IMO the absence of a `--pure` flag (the `-i` flag seems not to work in the same way) makes `nix develop` an unsuitable replacement for `nix-shell`. A few SO threads and nixpkgs issues seem to agree, but if I'm misunderstanding I'd love to learn more.



> IMO the absence of a `--pure` flag (the `-i` flag seems not to work in the same way) makes `nix develop` an unsuitable replacement for `nix-shell`

Ah, right, this is a useful use-case that nix develop doesn't cover.


To be clear, nix-shell --pure serves this use case by accident; it basically drops you into the shell with generic-builder.sh sourced and the build environment for a Nix derivation. This is useful for debugging Nix derivations, and if you are using mkShell you can minimize the pollution, but it's not exactly a development environment tailored for the typical software-engineering workflow.

The tool that (ab)uses nix-shell/nix shell to get this right is devshell [1], which creates an activation script (similar to NixOS itself) that provides a real reproducible development env which works with shells other than bash.

[1] https://github.com/numtide/devshell


It looks like `--store` might be a way to get this, but I'm not sure if thats cross-platform.


`nix develop --store`?

I'm not seeing anything about it (on mobile at least):

- https://nixos.org/manual/nix/unstable/command-ref/new-cli/ni...

- https://nixos.wiki/wiki/Nix_command/develop


Its actually part of the nix config, which is also able to be overridden in the CLI: https://nixos.org/manual/nix/stable/command-ref/conf-file.ht...

Note this will bust your local cache as well as the hydra cache since I'm pretty sure they depend on the store prefix.


Gotcha, thanks.

Not sure how this would help replace `--pure` though.


Yeah now that I think about it youre right :D

It would only "purify" your nix dependencies, but wouldnt purify your environmental ones necessarily.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: