You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another
10000
tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nix-shell: add additional packages to the environment #278
Reacted by Roni Choudhury, Adam Finn Tulinius, Herman Fries, Victor Engmark, Jason Pickens, zopsicle, Ulysses Zhan, RajaRaviVarma, Kamil Monicz and David Moberg
No, combining is not possible. That's because -p is implemented by generating a Nix expression on the fly. So here it generates an expression with buildInputs = [ . foo ];.
Surely it's possible, it's just not what nix-shell currently does right? I'd also like to be able to load the deps in a shell.nix file and also add in other incidental packages I may need (such as my preferred editor, etc.).
If we shouldn't be using nix-shell this way, what's the recommended way to create a shell environment that reflects a project's shell.nix file, plus a few selected packages?
Reacted by Bjørn Forsman, Ellie Hermaszewska, Adam Finn Tulinius, Herman Fries, Reilithion, Brandon Elam Barker, Jason Pickens, Qyriad and David Moberg
This is probably too much information, but I plan to create a derivation in ~/.config/nixpkgs/config.nix that encapsulates my vim config requirements. I'll assign this to a bash alias so that I can quickly produce an environment for vim in addition to my package's requirements.
This is probably too much information, but I plan to create a derivation in ~/.config/nixpkgs/config.nix that encapsulates my vim config requirements. I'll assign this to a bash alias so that I can quickly produce an environment for vim in addition to my package's requirements.
Activity
edolstra commentedon Jun 10, 2014
No, combining is not possible. That's because
-pis implemented by generating a Nix expression on the fly. So here it generates an expression withbuildInputs = [ . foo ];.waxlamp commentedon Jun 2, 2017
Surely it's possible, it's just not what
nix-shellcurrently does right? I'd also like to be able to load the deps in ashell.nixfile and also add in other incidental packages I may need (such as my preferred editor, etc.).If we shouldn't be using
nix-shellthis way, what's the recommended way to create a shell environment that reflects a project'sshell.nixfile, plus a few selected packages?willjp commentedon Aug 16, 2020
I figured out a way to achieve what you're looking for from
nix repl.Using
nix-shell -E(which evaluates a nix expression) you can achieve essentially same behaviour:nix-shell -E 'with import <nixpkgs> {}; runCommand "foo" { buildInputs=(import ./default.nix {}).buildInputs ++ [vim]; } "" 'This is probably too much information, but I plan to create a derivation in
~/.config/nixpkgs/config.nixthat encapsulates my vim config requirements. I'll assign this to a bash alias so that I can quickly produce an environment for vim in addition to my package's requirements.steinybot commentedon Jan 28, 2022
This worked for me:
waxlamp commentedon Feb 3, 2022
Pitometsu commentedon May 23, 2023
But that doesn't work for nix-shell https://whatever.tgz
Doesn't have sense in case of pure shell.
Merge pull request NixOS#278 from kolloch/fix-git-vendoring
Merge pull request NixOS#278 from DeterminateSystems/detsys/eelcodols…
kaddkaka commentedon Nov 13, 2026
@edolstra why was this closed? Is there no way to add the feature to nix-shell? It would be very convenient.