Cheatsheet: Difference between revisions
m →See also: Fix list formatting |
m Replace backticks with proper formatting |
||
Line 40: | Line 40: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Unfortunately, | Unfortunately, <code>nix-store</code> will try to load the entire file into memory, | ||
which will fail if the file size exceeds available memory. | which will fail if the file size exceeds available memory. | ||
If we have root access, we can copy the file to the store ourselves: | If we have root access, we can copy the file to the store ourselves: | ||
Line 83: | Line 83: | ||
=== Evaluate a NixOS configuration without building === | === Evaluate a NixOS configuration without building === | ||
If you only want to evaluate | If you only want to evaluate <code>configuration.nix</code> without building (e.g. to syntax-check or see if you are using module options correctly), you can use: | ||
<syntaxHighlight lang="console"> | <syntaxHighlight lang="console"> | ||
Line 89: | Line 89: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
This creates the | This creates the <code>.drv</code> file that <code>nixos-rebuild build</code> would build. | ||
=== Manually switching a NixOS system to a certain version of system closure === | === Manually switching a NixOS system to a certain version of system closure === | ||
Line 190: | Line 190: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
To initiate the build environment run | To initiate the build environment run <code>nix-shell</code> in the project root directory | ||
<syntaxHighlight lang="console"> | <syntaxHighlight lang="console"> | ||
Line 210: | Line 210: | ||
=== Evaluate packages for a different platform === | === Evaluate packages for a different platform === | ||
Sometimes you want to check whether a change to a package (such as adding a new dependency) would evaluate even on a different type of system. For example, you may want to check on | Sometimes you want to check whether a change to a package (such as adding a new dependency) would evaluate even on a different type of system. For example, you may want to check on <code>x86_64-linux</code> whether a package evaluates for <code>x86_64-darwin</code> or <code>aarch64-linux</code>. | ||
Use the | Use the <code>system</code> argument: | ||
<syntaxHighlight lang="console"> | <syntaxHighlight lang="console"> | ||
Line 242: | Line 242: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
and the following in | and the following in <code>configuration.nix</code>: | ||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> |