Comments (4)
Hi, here home-manager
acts as a stand-alone installation. If it was a NixOS module then the reference to a home.nix
file would be inside the nixosConfigurations
attrset's modules
:
nixosConfigurations = {
hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.jdoe = import ./home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass
# arguments to home.nix
}
];
};
};
What is discussed in #12 is that apparently a home-manager
needs to be activated when used for the first time.
According to the home-manager
manual section for stand-alone installs using flakes, you should do this first:
$ nix build --no-link <flake-uri>#homeConfigurations.jdoe.activationPackage
$ "$(nix path-info <flake-uri>#homeConfigurations.jdoe.activationPackage)"/activate
Then home-manager
will be correctly sourced on the login shell and subsequent calls to home-manager switch --flake '<flake-uri>#jdoe'
should work.
The manual seems to say that from 21.05
onwards you can do just home-manager switch --flake '<flake-uri>#jdoe'
and it will be expanded to the correct activationPackage
, but it did not work in my case in 22.05
(nor in a nix-darwin
setup). I needed to activate
it first using the above 2 commands before home-manager switch --flake '<flake-uri>#jdoe'
started to work properly.
Before that, my shell was trying to source hm-session-vars.sh
from the wrong path (complained that the file was missing). The activate
step put the files in the correct place.
from nix-starter-configs.
@DavSanchez is correct, this template provides a standalone home-manager config. As they showed, it's pretty simple to use it as a NixOS module instead, if you prefer.
I would add, however, that getting the home-manager
is easier than remembering that big nix build
command: nix shell nixpkgs#home-manager
should get you going.
You can alternatively use the provided shell.nix that automatically provides you with the latest nix
(with flakes and nix-command enabled), git
, and home-manager
. Just run nix develop
or nix-shell
and you should be good to go.
from nix-starter-configs.
Thank you both for your help. Your answers make sense but leave me with some questions.
Doesn't using home-manager as a nixos module subsume the standalone home-manager case?
Plus it would seem to avoid the user not having home-manager like I did.
Are there downsides to using the home-manager module?
from nix-starter-configs.
Are there downsides to using the home-manager module?
The main one is just that you need to rebuild the system (including using sudo
) when changing home configs, but it's mostly a personal preference.
It is worth noting that home-manager works on other distros and darwin, so having the standalone version available is nice to have, even if you mainly use NixOS.
The home-manager nixos module pretty much just creates a user systemd unit that calls the hm activation script, so they're not really incompatible. That means you can even combine the two, e.g. include your home config into your nixos system config, and iterate on it with home-manager switch
.
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
- Home manager permissions/structure questions 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.