Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extending the environment for nix develop #4722

Open
thufschmitt opened this issue Apr 21, 2021 · 2 comments
Open

Allow extending the environment for nix develop #4722

thufschmitt opened this issue Apr 21, 2021 · 2 comments
Labels
feature Feature request or proposal flakes new-cli Relating to the "nix" command nix-shell nix-shell, nix develop, nix print-dev-env, etc UX The way in which users interact with Nix. Higher level than UI.

Comments

@thufschmitt
Copy link
Member

Is your feature request related to a problem? Please describe.

When hacking on a project, I frequently find myself wanting to throw in more stuff than what the devShell in flake.nix specifies.

For example, when working on Nix, I like having clangd and gdb (and bear and rr, etc..) available. I also set a few custom MAKEFLAGS.
Conversely, nickel’s flake has a bunch of dev tools as input of its devShell which might not be useful for everyone (so ideally shouldn't have to be in the flake)

With nix-shell, I handled this (in a non-optimal fashion) by having a (gitignored) my-shell.nix overriding the derivation in shell.nix to add everything I needed.

Now that I use nix develop, this trick isn't possible anymore. However I think flakes are also a good opportunity to make this a first-class pattern.

Describe the solution you'd like

I'm not sure how that should look like, but I'd like to be able to have a local file that would override the devShell in the flake, so that I can have all this extra-stuff without having to patch the flake itself, and ensuring that nix build still exactly builds what's specified in the flake file.

Describe alternatives you've considered

I currently have a convoluted direnv setup that loads another flake (with nix print-dev-env) in addition to the local one to bring more programs in scope. But that's both fragile, invasive, and non standard.

I guess #3978 could also enable this use-case (by having another flake that has the upstream one as input and reexports an overriden version of it), although that would still require a bunch of custom setup.

@edolstra edolstra added UX The way in which users interact with Nix. Higher level than UI. flakes labels Apr 21, 2021
@bjornfor
Copy link
Contributor

guix has a command-line variant for that: guix environment <main-package> --ad-hoc <extra> <developer> <tools>...

Ref. https://guix.gnu.org/manual/en/html_node/Invoking-guix-environment.html

@stale
Copy link

stale bot commented Oct 22, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Oct 22, 2021
@stale stale bot removed the stale label Dec 5, 2022
@roberth roberth added the nix-shell nix-shell, nix develop, nix print-dev-env, etc label Dec 19, 2022
@stale stale bot added the stale label Jun 18, 2023
@fricklerhandwerk fricklerhandwerk added feature Feature request or proposal new-cli Relating to the "nix" command labels Feb 5, 2024
@stale stale bot removed the stale label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal flakes new-cli Relating to the "nix" command nix-shell nix-shell, nix develop, nix print-dev-env, etc UX The way in which users interact with Nix. Higher level than UI.
Projects
None yet
Development

No branches or pull requests

5 participants