Comments (3)
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.
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.
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)
- error: flake does not provide attribute HOT 2
- Adding a function to iterate over files in git repository?
- can't import config parts like suggested in configuration.nix HOT 3
- Can't make overlays working HOT 2
- Docs for use in WSL? HOT 2
- your-username@your-hostname HOT 4
- Rebuilding with custom packages fails HOT 8
- How to add overlays such as emacs-overlay to primary nixpkgs HOT 1
- flake-newbie - question
- home-manager could not find suitable profile directory. HOT 1
- ~/.config/nixpkgs not found on my nixos. HOT 1
- how to use pkgs.unstable with home-manager? HOT 1
- Example of adding a local package to be recognised by home-manager build is missing HOT 3
- Where are the actual configurations supposed to live with flake? HOT 1
- [Question] Differences between forAllSystems and forEachSystem HOT 3
- What do I change if I want to have my configuration in my home directory instead of /etc? HOT 2
- Newb can't even start HOT 1
- [Suggestion] Example / Project Showcase HOT 4
- `environment.etc` already defined HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nix-starter-configs.