First time user - where should I create my nix.conf?


I installed single-user nix (because I don’t have systemd) on MX Linux using the command given at Download Nix / NixOS | Nix & NixOS

I started following the quick start at 2. Run a program with Nix . (I uninstalled nix created by the Determinate Systems installer because the non-systemd version requires every nix command to be executed with sudo.)

To execute the commands in that quick start I have had to use the option --extra-experimental-features "nix-command flakes"

I would like to stop doing that. A web search tells me that I can add something to nix.conf in order to permanently allow the use of those features. I don’t have a nix.conf on my system.

I see /etc/nix/nix.conf mentioned a lot but I don’t have an /etc/nix directory. These are all the directories I have that are called nix:

$ find / -type d -name nix

Please would you tell me where I should create the nix.conf file?

I mean, you can just create that directory. Or you can create ~/.config/nix/ and put nix.conf in there.


@crantok having reworked a large part of it, I naturally recommend reading the Nix Reference Manual on all things Nix. It’s the closest you’ll get to the truth before the source code itself. As opposed to all other resources except man nix, getting it from additionally allows matching documentation to your installed version.

Here’s the section on nix.conf that would answer your question: nix.conf - Nix Reference Manual

The manual is not always complete or easy to read, and it will take time to fix everything, but that requires working with it to see what needs improvements. Feel free to open pull requests or report problems.


Thanks both.

In future I’ll assume the manual is correct and then ask if I run into trouble.

As a new user doing web searches, I had the sense that Nix is a moving target and didn’t want to make any assumptions about what information was up to date.

1 Like