docs: explain how to enable flakes on NixOS

Since `nix.conf` is generated when using NixOS, it cannot be edited.

Instead we add the instructions described by Xe in
https://xeiaso.net/blog/nix-flakes-1-2022-02-21
This commit is contained in:
mtths 2022-09-28 12:00:46 +02:00 committed by Robert Helgesson
parent 68ea28d330
commit 9da6c0232e
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -13,12 +13,24 @@ The support is still experimental and may change in backwards incompatible ways.
* Enable experimental features `nix-command` and `flakes`.
+
Either set in `nix.conf`
** When using NixOS, add the following to your `configuration.nix` and rebuild your system.
+
[source,nix]
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
+
** If you are not using NixOS, add the following to `nix.conf` (located at `~/.config/nix/` or `/etc/nix/nix.conf`).
+
[source,bash]
experimental-features = nix-command flakes
+
or pass them to `nix` and `home-manager` by
You may need to restart the Nix daemon with, for example, `sudo systemctl restart nix-daemon.service`.
+
** Alternatively, you can enable flakes on a per-command basis with the following additional flags to `nix` and `home-manager`:
+
[source,console]
----