Giter VIP home page Giter VIP logo

Comments (3)

ersinakinci avatar ersinakinci commented on June 12, 2024

I went ahead and tried running sudo home-manager switch --flake /etc#... and it resolved the permission error, but now I got a new one: Error: USER is set to "root" but we expect "..."

from nix-starter-configs.

Brisingr05 avatar Brisingr05 commented on June 12, 2024

The "NixOS and Flakes Book" is using the Home Manager NixOS module, i.e. running sudo nixos-rebuild switch --flake rebuilds NixOS as well as Home Manager. Misterio's templates use the standalone version of Home Manager, which requires you to run a separate command, i.e. home-manager switch --flake to rebuild Home Manager, which needs to be run without sudo. The standalone version's default config location is ~/.config/home-manager, so sudo privileges aren't required.

You can move the files from under /etc/nixos to some location in your user's home directory. Then you will require sudo privileges only for rebuilding NixOS, not Home Manager.

from nix-starter-configs.

ersinakinci avatar ersinakinci commented on June 12, 2024

Thanks @Brisingr05. In the end, I kept the Home-Manager-as-a-module setup and I just run sudo nixos-rebuild switch, which instantiates/realizes my Home Manager setup along with everything else. (Or one could run sudo nixos-rebuild switch --flake, but nixos-rebuild switch will search for the flake in /etc/nixos by default.)

Seems like it runs contrary to the spirit of home-manager, which I imagine is supposed to allow for users to manage their own environments.

I changed my mind about this. Centralizing my user's configuration makes it super easy to keep everything in one place and back up my whole setup to a remote git repo. It's more painful/annoying in terms of keystrokes (lots of sudo), but I think for now it's fine.

And at any rate, as I found out the hard way, Home Manager only creates symlinks to your dotfiles instead of copying them into your home folder. Your actual configs are in the Nix store, which are mounted as a read-only immutable filesystem. I think that this design choice blunts any advantage one might gain by running a standalone configuration. It doesn't matter whether the files are owned by root or the user, they're just symlinks and the target files that they point to can't be changed by either.

from nix-starter-configs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.