Home Manager: Difference between revisions

Malix (talk | contribs)
m fix: name standardization
Cktiel (talk | contribs)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
* install software declaratively in your user profile, rather than using nix-env
* install software declaratively in your user profile, rather than using nix-env
* manage dotfiles in the home directory of your user.
* manage dotfiles in the home directory of your user.
Home Manager has many [https://nix-community.github.io/home-manager/options.xhtml options], which can look daunting at first, but most of those options only boil down to creating some dotfiles and installing some software in a way similar way to nix-env.
Home Manager has many [https://nix-community.github.io/home-manager/options.xhtml options], which can look daunting at first, but most of those options only boil down to creating some dotfiles and installing some software in a similar way to nix-env.


{{Note|Before attempting to use Home Manager [https://github.com/rycee/home-manager#words-of-warning please read the warning].}}
{{Note|Before attempting to use Home Manager [https://github.com/rycee/home-manager#words-of-warning please read the warning].}}
Line 12: Line 12:
=== Installation as a user ===
=== Installation as a user ===


Follow the [https://nix-community.github.io/home-manager/index.xhtml#ch-installation official guide]
Follow the [https://nix-community.github.io/home-manager/installation/standalone.html official guide]


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.
Line 63: Line 63:
     };
     };
   };
   };
   outputs =
   outputs = { self, nixpkgs, home-manager, ... } @ inputs:
    {
      self,
      nixpkgs,
      home-manager,
      ...
    }@inputs:
     {
     {
       nixosConfigurations.<HOSTNAME> = nixpkgs.lib.nixosSystem { # replace <HOSTNAME> with your actual hostname
       nixosConfigurations.<HOSTNAME> = nixpkgs.lib.nixosSystem { # replace <HOSTNAME> with your actual hostname
Line 80: Line 74:
               useGlobalPkgs = true;
               useGlobalPkgs = true;
               useUserPackages = true;
               useUserPackages = true;
              extraSpecialArgs = { inherit inputs; } #If you want access to inputs in your home.nix
               users.<USERNAME> = ./home.nix; # replace <USERNAME> with your actual username
               users.<USERNAME> = ./home.nix; # replace <USERNAME> with your actual username
             };
             };