We recommend to use #link("https://nixos.wiki/wiki/Flakes")[up-to-date documentation on how to enable flakes], but we also explain how to install it as of 2024-05-07 below. Please note that the way to enable flakes depend on whether you are on NixOS or not.
*If you are using NixOS* and as of 2024-05-07, flakes can be enabled by setting at least the `nix-command` and `flakes` experimental settings in your system configuration file. In other words, your NixOS configuration file should have content similar to the one in the box below.
If you are *not using NixOS*, as of 2024-05-07, flakes can be enabled by setting at least the `nix-command` and `flakes` `experimental-features` in your Nix configuration file.
The Nix configuration file path is `~/.config/nix/nix.conf` on non-NixOS Linuxes.
In other words, your Nix configuration file should have content similar to the one in the box below.
@@ -153,7 +170,11 @@ We recommend to use #link("https://nixos.wiki/wiki/Flakes")[up-to-date documenta
]
)
*Test your flakes configuration.* Launching `nix build 'github:nixos/nixpkgs?ref=23.11#hello'` should create a `result` symbolic link in your current directory. Then, launching `./result/bin/hello` should print `Hello, world!`.
*TestingyourNixflakes.*
-Launching`nix--version` should run successfully and print you the Nix version you have installed.
-Launching`nixflake--version` should run successfully and print you the Nix version you have installed.