After a decade on Arch Linux I’ve decided to try and move to NixOS. I decided to start with Home Manager: a small step which I can later build on. I’ve wanted to improve my dotfiles configuration for a while anyways.

I set up Home Manager and configured a few programs with it, but now that I understand more of how it works I have a problem: it seems that Home Manager requires Nix to be installed and even with a minimal setup Nix takes GBs of storage and it defaults to install all the programs I wish to use even if the host system already provides them.

I use a bunch of non-Nix systems on which I have a small filesystem or a small Quota: university machines, friends’ VPSs, existings servers and VMs etc. I can’t afford to install Nix and GBs of data just to configure a few dotfiles for the already installed shell, editor etc. The Home Manager I just set up has way too much overhead to be used on these systems.

Is it possible to limit the overhead of Home Manager?

How do you guys deal with it?
Do you configure your dotfiles both with Home Manager (for the systems with Nix) and without (for the systems that don’t), or did you find a better solution?

  • yramagicmanB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    My home manager config has a systemd user unit defined in it that runs on login that does a lot of the “busy-work” of maintaining my NixOS install. You can adapt this to your needs, but for me [this top script](https://gitlab.com/yramagicman/stow-dotfiles/-/blob/master/home.nix?ref\_type=heads#L7) in my home.nix and the [corresponding systemd unit](https://gitlab.com/yramagicman/stow-dotfiles/-/blob/master/home.nix?ref\_type=heads#L198) and [timer](https://gitlab.com/yramagicman/stow-dotfiles/-/blob/master/home.nix?ref\_type=heads#L256) do everything silently in the background. I’ve never had issues with this approach.

    Caveat: There are a few things in that section of my home config that are pretty specific to me. Read carefully and edit as needed.

    The nice thing about nix and home-manager is that it works everywhere, so if you want to yank that section of my configs for your own use it should just work.

  • IRunArchLinuxBTWOPB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I’m thinking that maybe a possible solution to set up my dotfiles on a machine M using Home Manager could be the following could:

    1. Build the Home Manager configuration for M on a NixOS server of mine.

    2. Recursively replace all the symlinks built by Home Manager for M with the files they point to, excluding .nix*. This way the conf is now self-contained and doesn’t depend on the store.

    3. Send all the files generated this way to M.

    This way I could use a single Home Manager configuration to set up dotfiles for both the Nix systems I have access to, and the non-Nix ones with minimal overhead.

    Is there a project that does this, or that solves the issue I raised in any other way? I don’t know Home Manager or Nix well enough to develop something like this myself…