How can I declaratively install packages for myself without using home-manager?

TL;DR: I wanna make my own home manager with blackjack and flakes

Hello, people! I am a bit confused.

Summarizing a bit: my usage of home-manager is simply install programs via home.packages list and manually edit dotfiles (I use org mode to help on it). Even when home-manager offers modules, I prefer to edit files by hand.

So my question is: how can I manage my home directory in a more handmade manner?
My idea is to use something like

$> some-nix-command my-config.nix # output: some useful directory like /nix/var/nix/profiles/per-user/<username>/...
$> edit-configuration # something like emacs .bashrc .profile .config/...
$> use-the-system

Also, I want to use as much as possible teh new flakes infrastructure, specially to get rid of NIX_PATH variable.

I was trying to follow the Matej Cotman’s article but I stuck because it uses the old Nix command.

1 Like

I don’t understand what you’re trying to achieve. If you don’t want to use HM modules and instead want to write config files by hand, that’s fine, you can use home.file to have those files symlinked in place.

I found this thread incredibly helpful.

It links to a lot of very nice examples. Personally I’m using method 2) buildEnv. If you have some specific questions about it, feel free to ask.

Very fine, @hmenke. Now I need to adapt it to the flakes format somehow.

@colemickens yes, I can just “forget” those things in HM. But

  • It defeats the purposes of HM;
  • I just want to understand it and do it in my own way. HM looks a bit “hiding the things” to me.

(Nothing against HM, of course. I just think it is not to me.)

@hmenke have you tried to use the new Flakes feature of Nix in that home setup?

1 Like

I don’t think you can use Flakes with it yet because the buildEnv approach (as well as the overlay approach) are based on nix-env. However, you can still use pinning to bypass Nix channels like so

  nixexprs = fetchTarball {
    url = "";
  pkgs = import nixexprs { };

in with pkgs;
buildEnv {
  # ...
Hosted by Flying Circus.