Low-level derivations: Difference between revisions

DoggoBit (talk | contribs)
m Switch arguments to named
DoggoBit (talk | contribs)
m Switched more args to named
 
Line 138: Line 138:
=== Standard environment ===
=== Standard environment ===


For practicality purposes, let's compare this to the standard environment way of doing this. Using <code>stdenv.mkDerivation</code>{{cite manual|nixpkgs|sec-using-stdenv|Using stdenv}} gives us access to the common Linux utilities pre-included for us{{cite manual|nixpkgs|sec-tools-of-stdenv|Tools provided by stdenv}}, so we don't have to do the package importing ourselves:
For practicality purposes, let's compare this to the standard environment way of doing this. Using <code>stdenv.mkDerivation</code>{{cite manual|nixpkgs|sec-using-stdenv|title=Using stdenv}} gives us access to the common Linux utilities pre-included for us{{cite manual|nixpkgs|sec-tools-of-stdenv|title=Tools provided by stdenv}}, so we don't have to do the package importing ourselves:


{{File|example.nix|nix|highlight=3|
{{File|example.nix|nix|highlight=3|
Line 158: Line 158:
=== Nixpkgs utilities ===
=== Nixpkgs utilities ===


Even further up the chain of abstractions, [[Nixpkgs]] contains many pre-built utilities for us that handle some of the configuration involved in the standard environment as well. In our case, we can use the <code>writeShellScript</code>{{cite manual|nixpkgs|trivial-builder-writeShellScript|writeShellScript}}:
Even further up the chain of abstractions, [[Nixpkgs]] contains many pre-built utilities for us that handle some of the configuration involved in the standard environment as well. In our case, we can use the <code>writeShellScript</code>{{cite manual|nixpkgs|trivial-builder-writeShellScript|title=writeShellScript}}:


{{File|example.nix|nix|
{{File|example.nix|nix|