Linux – How to add home-manager to the configuration.nix

linuxnixnixos

I want to add the home-manager channel to my configuration.nix, then install home-manager

I don't have experience with NixOS. A simple code snippet is much appreciated, if possible.

Best Answer

There is a good article about that in the NixOs Wiki. Basically, you need to import two things in your configuration.nix:

  • The resources from the home-manager's GitHub repository
  • Your own home.nix config (see the README on GitHub for examples)
imports = [
    ...
    (import "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos")
    /path/to/home.nix
  ];

You might also need to add home-manager to your list of packages to be installed.

Related Question