Use nix-shell
to set up a temporary environment with
dependencies that aren't needed in your daily environment:
$ nix-shell -p ruby --run "gem install --user vimgolf"
Let's say I want to do a thing, but that thing requires stuff:
$ git clone https://github.com/mszep/pandoc_resume
$ cd pandoc_resume
$ vim resume.md
$ make resume.pdf
make: command not found
Well, shoot. I don't have make
installed. Even if I did,
this project's Makefile
requires both pandoc
and context
, and I don't have those installed either.
I don't really want to have to install make
,
pandoc
, and context
just to try this thing
out. With Nix, I don't have to.
Let's try running make
again, letting Nix handle the
dependencies:
$ nix-shell -p gnumake pandoc texLiveFull --run 'make resume.pdf'
It worked! But now I have make
, pandoc
, and
context
installed, right? I didn't want that.
$ make
make: command not found
$ pandoc
pandoc: command not found
$ context
context: command not found
Nope! Immutable configuration is immutable.
Note: context
might need
mtxrun --generate
to be run once before it's used.