justinwoo / nix-shorts

A collection of short notes about Nix, down to what is immediately needed for users.
Creative Commons Attribution Share Alike 4.0 International
440 stars 21 forks source link

Working with Nix Shell: clarification regarding easy-purescript-nix example #13

Open sbellem opened 4 years ago

sbellem commented 4 years ago

Hi,

thanks for this guide. As someone who is totally new to the "nixverse" I was a bit puzzled by the following very simple example, under https://github.com/justinwoo/nix-shorts/blob/master/posts/working-with-nix-shells.md#expressions-as-arguments:

But instead of only top level attributes, you can also put entire expressions in the -p argument. For example, with the easy-purescript-nix project:

$ nix-shell \
    -p 'let ep = import ./default.nix {}; in [ ep.purs ep.spago ]' \
   --run 'which purs; which spago; purs --version; spago version'
/nix/store/some-hash-purescript/bin/purs
/nix/store/some-hash-spago/bin/spago
0.13.3
0.9.0.0

So, if I understood correctly the command has to be run under a clone of the easy-purescript-nix repository. Perhaps adding the necessary git clone ... && cd ... instruction would be helpful.

I can make a small pull request for this if it makes sense.

Thanks!

justinwoo commented 2 months ago

Ah yeah, this really could use a better example that's contained to this repo with an example directory or something.

justinwoo commented 2 months ago

Changed the content to use an example just using nixpkgs: https://github.com/justinwoo/nix-shorts/commit/97fd2516fb4348b7442859c593aff1e954929b59