Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does nix provide package options / parameters? How do I list them?

Tags:

nix

For example I can query for available package versions of llvm:

$ nix-env -qa llvm
...
llvm-4.0.1
llvm-5.0.2
llvm-6.0.1

With homebrew I can provider an option when installing a package like llvm, in this case the --shared option:

$ brew install llvm --shared

Does nix support providing package specific options like this? Is there a way to list the available options of a package?

like image 541
Erik Avatar asked Oct 23 '25 16:10

Erik


1 Answers

Yes, nix derivations can come with optional arguments. For example, the derivation for LLVM 6 nixpkgs/development/compilers/llvm/6/llvm.nix starts like this:

{ stdenv
, fetch
...
, zlib
, debugVersion ? false
, enableManpages ? false
, enableSharedLibraries ? true
, enableWasm ? true
, darwin
}:

You can supply values for these arguments on the nix-env command line using the options --arg or --argstr, compare the man page. E.g.,

nix-env -iA nixpkgs.llvm --arg enableSharedLibraries false

I'm not aware of an easier way to find out such options than to read the nixpkgs source, unfortunately.

like image 189
robx Avatar answered Oct 26 '25 00:10

robx