Enabling nix flakes

Enabling flakes in NixOS
Add the following code into your configuration.nix:
{ pkgs, ... }: {
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
}
Enabling flakes in Linux and Windows Subsystem Linux 2 (WSL2)
Make sure nix is installed. Next, install nixUnstable by running the following code:
nix-env -iA nixpkgs.nixFlakes
Then, open your ~/.config/nix/nix.conf or /etc/nix/nix.conf file, depending on whether nix is installed globally or locally, and add:
experimental-features = nix-command flakes

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.