vimnixsystem.configuration

Can't write ./config file for installing NIX


I'm trying to install NIX to run a software called ARTIQ and am following the instructions given in this page.

https://m-labs.hk/artiq/manual/installing.html#installing-via-nix-linux

I am required to provide a cryptographic signature by amending the ~/.config/nix/nix.conf file. After opening the file using sudo vi ~/.config/nix/nix.conf and amending it, I can't perform

:w! 

it says "can't open file for writing" Could someone please advise me?


Solution

  • Do the directories ~/.config/ and ~/.config/nix/ exist? I suspect one of them or both don't. Exit without saving (:qa!) and create the directories:

    mkdir -p ~/.config/nix
    

    Then edit again:

    vi ~/.config/nix/nix.conf
    

    PS. Do not use sudo to edit files in your $HOME.