From 9da6c0232e22b7fff358db633f6bbc8f97a891e1 Mon Sep 17 00:00:00 2001 From: mtths Date: Wed, 28 Sep 2022 12:00:46 +0200 Subject: [PATCH] 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 --- docs/nix-flakes.adoc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/nix-flakes.adoc b/docs/nix-flakes.adoc index 34b8b0f0..2a0e1da3 100644 --- a/docs/nix-flakes.adoc +++ b/docs/nix-flakes.adoc @@ -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] ----