andir / npins

Nix dependency pinning. Very similar to Niv but has a few features that I personally wanted.
European Union Public License 1.2
164 stars 12 forks source link

use with nix-shell? #79

Closed alicebob closed 2 months ago

alicebob commented 2 months ago

Hi,

thanks for npins, it works great.

I have some tools in Makefiles I need to run, which I want to pin with npins.

As a meta example:

nixpin:
    nix-shell -p npins --run "npins upgrade -d build"

This works but doesn't use the nixpins-ed version.

It /does/ work if I add a shell.nix which does the import, and then adds npins to the shell:

nixpin:
    nix-shell --run "npins upgrade -d build"

Anyone know a nice way to not have to add npins to shell.nix? It works now, just easier to keep track of things when they are together.

piegamesde commented 2 months ago

Something like nix-shell -E '(import (import ./npins).pkgs {}).npins'? Also I recommend taking a look at https://github.com/casey/just, it may improve the ergonomics a bit more

alicebob commented 2 months ago

Thanks for the suggestion.

-E doesn't seem to work, it doesn't give me npins, but:

     For  nix-shell, this option is commonly used to give you a shell in which you
     can build the packages returned by the expression.  If  you  want  to  get  a
     shell which contain the built packages ready for use, give your expression to
     the nix-shell --packages convenience flag instead.

Ohwell. It's fine in shell.nix.

(about just, Makefiles are simple enough, changing to something else is a battle I choose not to fight :)