quatquatt / nixos

My NixOS config with home-manager, flakes, and readable code
1 stars 0 forks source link

Make home-manager stable with a way to access generations #16

Open quatquatt opened 3 weeks ago

quatquatt commented 3 weeks ago

I had to reinstall because I messed something up and couldn't revert a generation. I need some way to revert home-manager generations, with as few side effects as possible.

Options include:

Standalone (home-manager switch)

quatquatt commented 3 weeks ago

Helpful guide: https://drakerossman.com/blog/how-to-add-home-manager-to-nixos

quatquatt commented 3 days ago

Found the perfect solution here:

https://discourse.nixos.org/t/set-up-nixos-home-manager-via-flake/29710/3 https://github.com/nmasur/dotfiles/blob/master/flake.nix

It's some magic with config that I'll have to figure out, but this is huge.

quatquatt commented 3 days ago

There's a lot of abstraction in the example code with it being moved between files, so here's things brought into the same file for simplicity:

nixosConfigurations.tempest = 
{
    inputs.nixpkgs.lib.nixosSystem = 
    {
        inherit system;
        modules = 
        [
            globals
            inputs.home-manager.nixosModules.home-manager
        ];
    };
};
homeConfigurations.tempest = nixosConfigurations.tempest.config.home-manager.users.${hostVars.username}.home;

Basically the nixosConfigurations declares the home-manager stuff so it's declarative, and then homeConfigurations steals from it for quick reinstalls.