"Hybrid" updates of home-manager profile managed with NixOS

I am a happy user of home-manager, using its NixOS module, because this is how I prefer to configure my system.

It’s good, except that I find updating my user configuration is annoyingly slow, because I need to rebuild and activate the full NixOS system just to make a home-manager profile change.

Under this configuration, is there any way I can rebuild my home-manager profile, without doing a full NixOS rebuild? I have tried this:

# default.nix - abridged version of my machines configuration
rec {
  nixos = {
    tethys = import <nixpkgs/nixos> {
      system = "x86_64-linux";
      configuration = ./hosts/tethys.nix;
    };
  };
  machines = builtins.mapAttrs (_: val: val.system) nixos;
  builds = builtins.mapAttrs (_: val: val.config.system.build) nixos;
}

And then:

rodney@tethys:~/ops/laptop $ nix-build default.nix -A nixos.tethys.config.home-manager.users.rodney
/nix/store/5944lfl6d38ybg0axaz3wj9mgcwgraj8-home-manager-files

rodney@tethys:~/ops/laptop $ home-manager switch -f default.nix -A nixos.tethys.config.home-manager.users.rodney
error: attribute 'nixos.tethys.config.home-manager.users.rodney' missing

Any ideas? TIA.

1 Like