Home Manager: Difference between revisions

From NixOS Wiki
imported>Krey
No edit summary
imported>Krey
No edit summary
Line 24: Line 24:
   };
   };
</syntaxhighlight>
</syntaxhighlight>
will make Home Manager generate a .config/git/config file for you.
will make Home Manager generate a <code>.config/git/config</code> file for you.


Even for programs for which Home Manager doesn't have configuration options, you can use it to manage your dotfiles, e.g.
Even for programs for which Home Manager doesn't have configuration options, you can use it to manage your dotfiles, e.g.
Line 30: Line 30:
   home.file.".config/i3blocks/config".source = "${my-dotfile-dir}/i3blocks.conf"
   home.file.".config/i3blocks/config".source = "${my-dotfile-dir}/i3blocks.conf"
</syntaxhighlight>
</syntaxhighlight>
This will create a symlink <code>.config/i3blocks/config</code>.


=== Examples ===
=== Examples ===
* [https://github.com/yrashk/nix-home/blob/master/home.nix Yurii Rashkovskii's home.nix]
* [https://github.com/yrashk/nix-home/blob/master/home.nix Yurii Rashkovskii's home.nix]

Revision as of 20:22, 21 April 2018

Home Manager a basic system for managing a user environment using the Nix package manager together with the Nix libraries found in Nixpkgs. Before attempting to use Home Manager please read the warning.

Configuration

Home Manager is can be configured in ~/.config/nixpkgs/home.nix or inside configuration.nix.

For the latter, add the following to your config

  imports = [
    ...
    "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos"
  ];
  home-manager.users.my_username = { ... }

Managing your dotfiles

Home Manager has options to configure many common tools. As an example, adding the following

  programs.git = {
    enable = true;
    userName  = "my_git_username";
    userEmail = "my_git_username@gmail.com";
  };

will make Home Manager generate a .config/git/config file for you.

Even for programs for which Home Manager doesn't have configuration options, you can use it to manage your dotfiles, e.g.

  home.file.".config/i3blocks/config".source = "${my-dotfile-dir}/i3blocks.conf"

This will create a symlink .config/i3blocks/config.

Examples