Skip to content

Nix shell experience

Posted on:November 4, 2021 at 04:10 PM

Hi,

just learned something nice today. Previously I added default.nix in my projects and configured it.

Going with this project, I realized I can get binaries on the fly.

From nix-shell --help:

....
-packages / -p packages...
  Set up an environment in which the specified packages are present.
  The command line arguments are interpreted as attribute names
  inside the Nix Packages collection. Thus, nix-shell -p libjpeg openjdk will
  start a shell in which the packages denoted by the attribute names
  libjpeg and openjdk are present.

Run this command in your working directory.

nix-shell -p jekyll bundler gem

And oOooo you can start the web server. Of course sometimes, you want to add new $PATH parameter or do some preprocessing stuff, this still requires a default.nix, but still nice to have feature.

See ya.