Home Manager: Difference between revisions
update example to 24.11 |
Aaronchall (talk | contribs) m remove "note that" - this wiki is all notes and it is redundant |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 16: | Line 16: | ||
Your configuration is stored in <code>~/.config/home-manager/home.nix</code>. Each time you modify it, rerun <code>home-manager switch</code> for changes to have effect. | Your configuration is stored in <code>~/.config/home-manager/home.nix</code>. Each time you modify it, rerun <code>home-manager switch</code> for changes to have effect. | ||
To work correctly, home-manager needs your shell to source <code>~/.nix-profile/etc/profile.d/hm-session-vars.sh</code>. The most convenient way to do so is to have home-manager manage your whole shell configuration, eg <code>programs.bash.enable = true;</code> or <code>programs.zsh.enable = true;</code>. But in this case your whole bashrc is managed with Home Manager: the years of customization you accumulated in your former .bashrc must be migrated to Home Manager options, which may take some time. The quick and dirty way to do the migration is to move your bashrc to some other location and source it from Home Manager: | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ pkgs, ...}: { | { pkgs, ...}: { | ||
Line 60: | Line 60: | ||
home-manager = { | home-manager = { | ||
url = "github:nix-community/home-manager/release-24.11"; | url = "github:nix-community/home-manager/release-24.11"; | ||
inputs.nixpkgs.follows = "nixpkgs" | inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | }; | ||
}; | }; | ||
Line 67: | Line 67: | ||
system = "x86_64-linux"; | system = "x86_64-linux"; | ||
modules = [ | modules = [ | ||
./configuration.nix | |||
home-manager.nixosModules.home-manager | |||
{ | |||
home-manager.useGlobalPkgs = true; | |||
home-manager.useUserPackages = true; | |||
home-manager.users.your-username = import ./home.nix; | |||
} | } | ||
]; | ]; | ||
}; | }; | ||
Line 85: | Line 85: | ||
{ | { | ||
# This value determines the Home Manager release that your | # This value determines the Home Manager release that your | ||
# configuration is compatible with. This helps avoid breakage | # configuration is compatible with. This helps avoid breakage | ||
Line 99: | Line 94: | ||
# changes in each release. | # changes in each release. | ||
home.stateVersion = "24.11"; | home.stateVersion = "24.11"; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |