Discussion:
[Nix-dev] [ANN] Home Manager
Robert Helgesson
2017-07-02 21:58:00 UTC
Permalink
Hi All,

While my little Home Manager project has been online at

https://github.com/rycee/home-manager

since January I haven't really mentioned it much. Although it is far
from complete, I now feel sufficiently confident about its stability and
usefulness to announce it to the wider community.

In short Home Manager is a set of NixOS modules and a command line tool
called `home-manager` that lets you configure your user's environment
similar to how you configure your NixOS system. Since Home Manager uses
the NixOS module system under the hood and therefore supports the nice
things the modules bring, in particular type checking, automatic man
page generation, and merging configurations using the `imports` field.

It is quite similar to nixuser [1] in scope and implementation but
differs in some crucial ways, most notably Home Manager lives in a
separate repository from Nixpkgs which I hope makes it easier to get
started. It also works under NixOS 17.03 (which is the version I mostly
use) and to some extent also other Linux distros and even macOS. Though
I have personally only ever used it under NixOS.

A simple Home Manager configuration may look something like

{ pkgs, ... }:

{
home.packages = [
pkgs.htop
pkgs.fortune
];

programs.emacs = {
enable = true;
extraPackages = epkgs: [
epkgs.nix-mode
epkgs.magit
];
};

programs.firefox = {
enable = true;
enableAdobeFlash = true;
};

services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
};
}

I have also written a more elaborate description of the project on my
website which you can reach at

https://rycee.net/posts/2017-07-02-manage-your-home-with-nix.html

Please have a look and give Home Manager a try if you are feeling
adventurous. Feedback is most welcome!

/rycee

[1] https://github.com/NixOS/nixpkgs/pull/9250
Nicolas Pierron
2017-07-03 23:41:59 UTC
Permalink
Nice work!
Post by Robert Helgesson
In short Home Manager is a set of NixOS modules and a command line tool
called `home-manager` that lets you configure your user's environment
similar to how you configure your NixOS system.
For your information, the module system was made such that you can
re-use it as a submodule.
So technically, you might be able to create a NixOS module for NixOS
which imports the home-manager within NixOS users ;)

This home-manager submodule would have to forward pkgs as a module
argument (as done in NixOS), and import the modules from the
home-manager.
--
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
Robert Helgesson
2017-07-04 21:39:24 UTC
Permalink
Thanks Nicolas!
Post by Nicolas Pierron
For your information, the module system was made such that you can
re-use it as a submodule. So technically, you might be able to create
a NixOS module for NixOS which imports the home-manager within NixOS
users ;)
This home-manager submodule would have to forward pkgs as a module
argument (as done in NixOS), and import the modules from the
home-manager.
Yes, I've been meaning to do this and in principle I think it should
work as you describe. But while the HM activation script should be
sufficiently idempotent to include in `system.activationScripts`, it is
not really written for speed so it may need some tweaking in that area.

Many thanks for your comment :-)

/rycee

Continue reading on narkive:
Loading...