Nix Cookbook: Difference between revisions

Line 184: Line 184:
Let's dissect this:
Let's dissect this:


<syntaxHighlight lang="sh">
<syntaxhighlight lang="sh" line="1">
## instantiate bochs into `.drv` files and print the filenames;
## instantiate bochs into `.drv` files and print the filenames;
instantiate=$(nix-instantiate '<nixpkgs>' -A bochs)
instantiate=$(nix-instantiate '<nixpkgs>' -A bochs)


## print all references/requirements, filtering the .drv files (which is where static derivations live)
## print all references/requirements, filtering the .drv files (which is where static derivations live)
requirements=$(nix-store -qR $intantiate | grep '.drv$')
requirements=$(nix-store -qR $instantiate | grep '.drv$')


## keep only the source derivations, since those will have a predefined hash of the output  
## keep only the source derivations, since those will have a predefined hash of the output  
Line 196: Line 196:
## realize those derivations, downloading all sources and storing them in the nix store  
## realize those derivations, downloading all sources and storing them in the nix store  
nix-store -r $sources
nix-store -r $sources
</syntaxHighlight>
</syntaxhighlight>


After that, all sources will be locally stored!
After that, all sources will be locally stored!