Chris Stryczynski

Software Developer / Consultant

How to explore Nixos nixpkgs using the Nix repl

Posted on: 01/06/2019

Something I wish I’d known sooner is that you can explore the <nixpkgs> using the nix repl:

We have tab completion in there too.

nix repl '<nixpkgs>'
Welcome to Nix version 2.2.2. Type :? for help.

Loading '<nixpkgs>'...
Added 10078 variables.

nix-repl> pkgs.pyth
pkgs.pythia              pkgs.python27            pkgs.python2nix          pkgs.python36            pkgs.python37Packages    pkgs.pythonIRClib
pkgs.python              pkgs.python27Full        pkgs.python3             pkgs.python36Full        pkgs.python3Full         pkgs.pythonInterpreters
pkgs.python-qt           pkgs.python27Packages    pkgs.python35            pkgs.python36Packages    pkgs.python3Packages     pkgs.pythonPackages
pkgs.python-setup-hook   pkgs.python2Full         pkgs.python35Full        pkgs.python37            pkgs.pythonDocs          pkgs.pythonSexy
pkgs.python2             pkgs.python2Packages     pkgs.python35Packages    pkgs.python37Full        pkgs.pythonFull          pkgs.pythonmagick

And nix repl '<nixpkgs>' is the same as doing nix repl and then :l <nixpkgs>.

And if you’re wondering what <nixpkgs> is, it’s just a string!

nix-repl> <nixpkgs>         
/nix/var/nix/profiles/per-user/root/channels/nixos

For a more detailed explanation though have a look at: https://stackoverflow.com/questions/47379654/what-does-the-nixpkgs-string-value-mean-in-nix

Comments

No comments, yet!

Submit a comment