FAQ/zh: Difference between revisions
No edit summary Tags: Mobile edit Mobile web edit |
Updating to match new version of source page |
||
| Line 1: | Line 1: | ||
<languages/> | <languages/> | ||
{{cleanup}} | |||
为了避免重复回答那些经常被问到的问题以及处理新手常遇到的麻烦,这些问题被收录在这里。 | 为了避免重复回答那些经常被问到的问题以及处理新手常遇到的麻烦,这些问题被收录在这里。 | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 37: | Line 36: | ||
=== 如何保留构建时依赖/在离线状态下重新构建? === | === 如何保留构建时依赖/在离线状态下重新构建? === | ||
<syntaxhighlight lang="nix"># /etc/nixos/configuration.nix | <syntaxhighlight lang="nix"># /etc/nixos/configuration.nix | ||
{ config, pkgs, lib, ... }: | { config, pkgs, lib, ... }: | ||
| Line 48: | Line 46: | ||
}; | }; | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Check 'man configuration.nix' for these options. Rebuild for these options to take effect: | Check 'man configuration.nix' for these options. Rebuild for these options to take effect: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
List all store paths that form the system closure and realise them: | List all store paths that form the system closure and realise them: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
nix-store -qR $(nix-instantiate '<nixpkgs/nixos>' -A system) | xargs nix-store -r | nix-store -qR $(nix-instantiate '<nixpkgs/nixos>' -A system) | xargs nix-store -r | ||
warning: you did not specify `--add-root'; the result might be removed by the garbage collector | warning: you did not specify `--add-root'; the result might be removed by the garbage collector | ||
<build output and list of successfully realised paths> | <build output and list of successfully realised paths> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Repeat for your user and further profiles: | Repeat for your user and further profiles: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nix-store -qR ~/.nix-profile | xargs nix-store -r</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
The warning can be ignored for profiles that are listed/linked in ''/nix/var/nix/profiles/'' or one of its subdirectories. | The warning can be ignored for profiles that are listed/linked in ''/nix/var/nix/profiles/'' or one of its subdirectories. | ||
</div> | </div> | ||
| Line 94: | Line 95: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
q0yi2nr8i60gm2zap46ryysydd2nhzhp-automake-1.11.1/ | q0yi2nr8i60gm2zap46ryysydd2nhzhp-automake-1.11.1/ | ||
| Line 106: | Line 106: | ||
xvs7y09jf7j48p6l0p87iypgpq470jqw-nixos-build-vms/ | xvs7y09jf7j48p6l0p87iypgpq470jqw-nixos-build-vms/ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<span id="I've_updated_my_channel_and_something_is_broken,_how_can_I_rollback_to_an_earlier_channel?"></span> | <span id="I've_updated_my_channel_and_something_is_broken,_how_can_I_rollback_to_an_earlier_channel?"></span> | ||
| Line 113: | Line 112: | ||
查看可用的各代 channel: | 查看可用的各代 channel: | ||
<syntaxhighlight lang="bash"> | |||
nix-env --list-generations -p /nix/var/nix/profiles/per-user/root/channels | |||
18 2014-04-17 09:16:28 | |||
19 2014-06-13 10:31:24 | |||
20 2014-08-12 19:09:20 (current) | |||
</syntaxhighlight> | |||
<div class="mw-translate-fuzzy"> | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
nix-env --list-generations -p /nix/var/nix/profiles/per-user/root/channels | nix-env --list-generations -p /nix/var/nix/profiles/per-user/root/channels | ||
| Line 120: | Line 127: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
回滚到上一代的方法如下: | 回滚到上一代的方法如下: | ||
</div> | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
nix-env --rollback -p /nix/var/nix/profiles/per-user/root/channels | nix-env --rollback -p /nix/var/nix/profiles/per-user/root/channels | ||
switching from generation 20 to 19 | switching from generation 20 to 19 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
To switch to a particular generation: | To switch to a particular generation: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
nix-env --switch-generation 18 -p /nix/var/nix/profiles/per-user/root/channels | nix-env --switch-generation 18 -p /nix/var/nix/profiles/per-user/root/channels | ||
switching from generation 20 to 18 | switching from generation 20 to 18 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
=== I'm working on a new package, how can I build it without adding it to nixpkgs? === | === I'm working on a new package, how can I build it without adding it to nixpkgs? === | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nix-build -E 'with import <nixpkgs> { }; callPackage ./mypackage.nix { }'</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
You can replace callPackage with callPackage_i686 to build the 32-bit version of your package on a 64-bit system if you want to test that. | You can replace callPackage with callPackage_i686 to build the 32-bit version of your package on a 64-bit system if you want to test that. | ||
</div> | </div> | ||
| Line 153: | Line 161: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nix-build -E 'with import <nixpkgs> { }; enableDebugging fooPackage'</syntaxhighlight> | <syntaxhighlight lang="bash">nix-build -E 'with import <nixpkgs> { }; enableDebugging fooPackage'</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 168: | Line 174: | ||
As root you can run nix-build with the --check flag: | As root you can run nix-build with the --check flag: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">sudo nix-build --check -A ncdu</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
=== How can I manage software with nix-env like with configuration.nix? === | === How can I manage software with nix-env like with configuration.nix? === | ||
</div> | </div> | ||
| Line 178: | Line 185: | ||
</div> | </div> | ||
<ol style="list-style-type: decimal;"> | <ol style="list-style-type: decimal;"> | ||
<li><p>Create a meta package called ''userPackages'' your ''~/.config/nixpkgs/config.nix'' file with the packages you would like to have in your environment:</p> | <li><p><span lang="en" dir="ltr" class="mw-content-ltr">Create a meta package called ''userPackages'' your ''~/.config/nixpkgs/config.nix'' file with the packages you would like to have in your environment:</span></p> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
with (import <nixpkgs> {}); | with (import <nixpkgs> {}); | ||
| Line 195: | Line 201: | ||
} | } | ||
</syntaxhighlight></li> | </syntaxhighlight></li> | ||
<li><p>Install all specified packages using this command:</p> | <li><p><span lang="en" dir="ltr" class="mw-content-ltr">Install all specified packages using this command:</span></p> | ||
<syntaxhighlight lang="bash">nix-env -iA userPackages -f '<nixpkgs>'</syntaxhighlight></li></ol> | <syntaxhighlight lang="bash">nix-env -iA userPackages -f '<nixpkgs>'</syntaxhighlight></li></ol> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 209: | Line 214: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
=== I've downloaded a binary, but I can't run it, what can I do? === | === I've downloaded a binary, but I can't run it, what can I do? === | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Binaries normally do not work out of the box when you download them because they normally just assume that libraries can be found in hardcoded paths such as <code>/lib</code>. However this assumption is incorrect on NixOS systems due to the inner workings of <code>nix</code> - there is no default path, everything gets set to the corresponding version on compile time. | Binaries normally do not work out of the box when you download them because they normally just assume that libraries can be found in hardcoded paths such as <code>/lib</code>. However this assumption is incorrect on NixOS systems due to the inner workings of <code>nix</code> - there is no default path, everything gets set to the corresponding version on compile time. | ||
</div> | </div> | ||
| Line 224: | Line 232: | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.nix-ld = { | programs.nix-ld = { | ||
| Line 230: | Line 237: | ||
libraries = [ pkgs.zlib pkgs.openssl ]; | libraries = [ pkgs.zlib pkgs.openssl ]; | ||
};</syntaxhighlight> | };</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 240: | Line 246: | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.nix-ld = { | programs.nix-ld = { | ||
| Line 246: | Line 251: | ||
libraries = pkgs.steam-run.args.multiPkgs pkgs; | libraries = pkgs.steam-run.args.multiPkgs pkgs; | ||
};</syntaxhighlight> | };</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 256: | Line 260: | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# mybinaryprogram.nix | # mybinaryprogram.nix | ||
| Line 277: | Line 280: | ||
''; | ''; | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
This can be built with: | This can be built with: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nix-build mybinaryprogram.nix</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
And run with: | And run with: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">./result/bin/mybinaryprogram</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Another possibility is using a FHS-compatible Sandbox with [https://nixos.org/nixpkgs/manual/#sec-fhs-environments buildFHSUserEnv] | Another possibility is using a FHS-compatible Sandbox with [https://nixos.org/nixpkgs/manual/#sec-fhs-environments buildFHSUserEnv] | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# fhsUser.nix | # fhsUser.nix | ||
| Line 312: | Line 318: | ||
runScript = "bash"; | runScript = "bash"; | ||
}).env</syntaxhighlight> | }).env</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
the sandbox can be entered with | the sandbox can be entered with | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nix-shell fhsUser.nix</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
If your target application can't find shared libraries inside buildFHSUserEnv, you may run [https://github.com/lexleogryfon/de-generate nix-de-generate] for target application inside FHS, which will generate newenv.nix file, an nix-expression of buildFHSUserEnv with resolved dependencies for shared libraries. | If your target application can't find shared libraries inside buildFHSUserEnv, you may run [https://github.com/lexleogryfon/de-generate nix-de-generate] for target application inside FHS, which will generate newenv.nix file, an nix-expression of buildFHSUserEnv with resolved dependencies for shared libraries. | ||
</div> | </div> | ||
| Line 323: | Line 331: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
=== What are channels and how do they get updated? === | === What are channels and how do they get updated? === | ||
</div> | |||
{{main|Channel branches}} | {{main|Channel branches}} | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 366: | Line 375: | ||
</div> | </div> | ||
<ol start="2" style="list-style-type: decimal;"> | <ol start="2" style="list-style-type: decimal;"> | ||
<li>Once the job succeeds at a particular nixpkgs commit, '''cache.nixos.org''' will download binaries from '''hydra.nixos.org'''.</li> | <li><span lang="en" dir="ltr" class="mw-content-ltr">Once the job succeeds at a particular nixpkgs commit, '''cache.nixos.org''' will download binaries from '''hydra.nixos.org'''.</span></li> | ||
<li>Once the above download completes, the channel updates.</ | <li><span lang="en" dir="ltr" class="mw-content-ltr">Once the above download completes, the channel updates.</span></li> | ||
</ | </ol> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 387: | Line 396: | ||
If you want to know where <nixpkgs> is located: | If you want to know where <nixpkgs> is located: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nix-instantiate --find-file nixpkgs</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
To know the commit, open the .version-suffix file in the nixpkgs location. The hash after the dot is the git commit. | To know the commit, open the .version-suffix file in the nixpkgs location. The hash after the dot is the git commit. | ||
</div> | </div> | ||
| Line 395: | Line 405: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
=== Nixpkgs branches === | === Nixpkgs branches === | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Branches on the nixpkgs repo have a relationship with channels, but that relationship is not 1:1. | Branches on the nixpkgs repo have a relationship with channels, but that relationship is not 1:1. | ||
</div> | </div> | ||
| Line 419: | Line 432: | ||
</div> | </div> | ||
<syntaxhighlight lang="command"> | <syntaxhighlight lang="command"> | ||
NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/release-17.09.tar.gz nix-shell -p $software | NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/release-17.09.tar.gz nix-shell -p $software | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 456: | Line 467: | ||
start a new shell with a private mount namespace (Linux-only) | start a new shell with a private mount namespace (Linux-only) | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">sudo unshare -m bash</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
remount the filesystem with write privileges (as root) | remount the filesystem with write privileges (as root) | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">mount -o remount,rw /nix/store</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
update the file | update the file | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nano <PATH_TO_PACKAGE>/default.nix</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
exit to shell where /nix/store is still mounted read-only | exit to shell where /nix/store is still mounted read-only | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">exit</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Be sure to [https://github.com/NixOS/nixpkgs/issues report the incorrect url] or [https://github.com/NixOS/nixpkgs/pulls fix it yourself]. | Be sure to [https://github.com/NixOS/nixpkgs/issues report the incorrect url] or [https://github.com/NixOS/nixpkgs/pulls fix it yourself]. | ||
</div> | </div> | ||
| Line 489: | Line 504: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nix-prefetch-git https://git.zx2c4.com/password-store</syntaxhighlight> | <syntaxhighlight lang="bash">nix-prefetch-git https://git.zx2c4.com/password-store</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 533: | Line 546: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nixos-rebuild switch --option binary-caches ''</syntaxhighlight> | <syntaxhighlight lang="bash">nixos-rebuild switch --option binary-caches ''</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 545: | Line 556: | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# /etc/nix/nix.conf | # /etc/nix/nix.conf | ||
| Line 551: | Line 561: | ||
build-sandbox-paths = $(nix-store -qR $(nix-build '<nixpkgs>' -A bash) | xargs echo /bin/sh=$(nix-build '<nixpkgs>' -A bash)/bin/bash) | build-sandbox-paths = $(nix-store -qR $(nix-build '<nixpkgs>' -A bash) | xargs echo /bin/sh=$(nix-build '<nixpkgs>' -A bash)/bin/bash) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
On NixOS set the following in ''configuration.nix'': | On NixOS set the following in ''configuration.nix'': | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
nix.settings.sandbox = true; | nix.settings.sandbox = true; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 572: | Line 582: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nix-shell -I nixpkgs=channel:nixpkgs-unstable -p somepackage</syntaxhighlight> | <syntaxhighlight lang="bash">nix-shell -I nixpkgs=channel:nixpkgs-unstable -p somepackage</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
It is possible to have multiple nix-channels simultaneously. To add the unstable channel with the specifier ''unstable'', | It is possible to have multiple nix-channels simultaneously. To add the unstable channel with the specifier ''unstable'', | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos-unstable</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
After updating the channel | After updating the channel | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">sudo nix-channel --update nixos-unstable</syntaxhighlight> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
queries via <code>nix-env</code> will show packages from both ''stable'' and ''unstable''. Use this to install unstable packages into your user environment. The following snippet shows how this can be done in ''configuration.nix''. | queries via <code>nix-env</code> will show packages from both ''stable'' and ''unstable''. Use this to install unstable packages into your user environment. The following snippet shows how this can be done in ''configuration.nix''. | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ config, pkgs, ... }: | { config, pkgs, ... }: | ||
| Line 599: | Line 608: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
This only changes what version of <code>PACKAGE_NAME</code> is available on <code>$PATH</code>. If the package you want to take from unstable is installed through a NixOS module, you must use [[overlays]]: | This only changes what version of <code>PACKAGE_NAME</code> is available on <code>$PATH</code>. If the package you want to take from unstable is installed through a NixOS module, you must use [[overlays]]: | ||
</div> | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ config, pkgs, ... }: | { config, pkgs, ... }: | ||
| Line 615: | Line 625: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Note that this will rebuild all packages depending on the overlaid package, which may be a lot. Some modules offer a <code>services.foo.package</code> to change the actual derivation used by the module without and overlay, and without recompiling dependencies ([https://nixos.org/manual/nixos/stable/options.html#opt-services.gvfs.package example]). | Note that this will rebuild all packages depending on the overlaid package, which may be a lot. Some modules offer a <code>services.foo.package</code> to change the actual derivation used by the module without and overlay, and without recompiling dependencies ([https://nixos.org/manual/nixos/stable/options.html#opt-services.gvfs.package example]). | ||
</div> | </div> | ||
| Line 620: | Line 632: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
If you want to install unfree packages from unstable you need to also set allowUnfree by replacing the import statment above with: | If you want to install unfree packages from unstable you need to also set allowUnfree by replacing the import statment above with: | ||
</div> | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
import <nixos-unstable> { config = { allowUnfree = true; }; } | import <nixos-unstable> { config = { allowUnfree = true; }; } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 637: | Line 650: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">su nano /etc/nixos/configuration.nix</syntaxhighlight> | <syntaxhighlight lang="bash">su nano /etc/nixos/configuration.nix</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Add this line to your configuration file. | Add this line to your configuration file. | ||
</div> | |||
<syntaxhighlight lang="bash">boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ];</syntaxhighlight> | <syntaxhighlight lang="bash">boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ];</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 650: | Line 662: | ||
</div> | </div> | ||
<syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight> | <syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 668: | Line 678: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
=== What does it mean to say that NixOS is "immutable" === | === What does it mean to say that NixOS is "immutable" === | ||
</div> | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | |||
Immutability is a property of data, in general, which means that the data cannot be modified after it is created. In the context of an operating system, it really means that certain parts of the system have this property. In the case of Nix and NixOS, that includes the Nix store, where files can be created but not modified after the time they are created. It does not apply to every part of the operating system, in that users can still modify their own files in their home directory, for example. | Immutability is a property of data, in general, which means that the data cannot be modified after it is created. In the context of an operating system, it really means that certain parts of the system have this property. In the case of Nix and NixOS, that includes the Nix store, where files can be created but not modified after the time they are created. It does not apply to every part of the operating system, in that users can still modify their own files in their home directory, for example. | ||
</div> | </div> | ||
| Line 691: | Line 704: | ||
</div> | </div> | ||
{{:FAQ/Libraries}} | {{:FAQ/Libraries}} | ||
{{:FAQ/nix-env -iA}} | {{:FAQ/nix-env -iA}} | ||
| Line 697: | Line 709: | ||
{{:FAQ/notfound}} | {{:FAQ/notfound}} | ||
<!-- Transclude subpages --> | <!-- Transclude subpages --> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||