Flakes: Difference between revisions

imported>NobbZ
imported>Alyaeanyx
Add instructions to use nonfree software
Line 438: Line 438:
== Enable unfree software ==
== Enable unfree software ==


Follow the instructions at
Because flake evalutations are hermetic, they will ignore the system configuration on nonfree software and the <code>NIXPKGS_ALLOW_UNFREE</code> environment variable by default.
https://discourse.nixos.org/t/using-non-free-libraries-in-flakes/8632/5
 
To use nonfree software with CLI tools like <code>nix shell</code> or <code>nix run</code>, the <code>--impure</code> flag must be used for Nixpkgs to access the current environment variables:
<syntaxHighlight lang=console>
$ NIXPKGS_ALLOW_UNFREE=1 nix run --impure nixpkgs#discord
</syntaxHighlight>
 
To use nonfree software in a flake, add <code>nixpkgs</code> as an input in your flake and import it with the <code>allowUnfree</code> option:
<syntaxHighlight>
pkgs = import nixpkgs { config = { allowUnfree = true; }; }
</syntaxHighlight>


=== Enable unfree software in home-manager ===
=== Enable unfree software in home-manager ===