6
[root@nixos:/etc/nix]# sudo chmod 777 /etc/nix/nix.conf
chmod: changing permissions of '/etc/nix/nix.conf': Read-only file system

I remember this is some filesystem / Linux kernel utility to change this, I'm not sure what it's called though?

1 Answer 1

5

This file is managed by Nix - hence it's in the store path - and read only:

readlink -f /etc/nix/nix.conf 
/nix/store/9cidrvc5n3fjf9zplxrwiyh0g9nq07bb-nix.conf

Instead in order to modify this, you need to set the nix.extraOptions in configuration.nix to modify this file.

https://github.com/NixOS/nix/pull/3111


Nix config can also be set at ~/.config/nix/nix.conf though see here for more info: https://nixos.org/manual/nix/unstable/command-ref/conf-file.html

3
  • I'm relatively new to NixOS, and I'm trying to install on MacOS, and I need to edit nix.conf to add some substituters. Where do I find configuration.nix?
    – marcel_g
    Commented Aug 30, 2022 at 10:03
  • Not sure about MacOS, but I think you can instead set it at ~/.config/nix/nix.conf Commented Aug 30, 2022 at 10:31
  • Thanks @chris, I found i could edit /etc/nix/nix.conf using $ sudo vi /etc/nix/nix.conf
    – marcel_g
    Commented Sep 7, 2022 at 9:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .