1 { pkgs, lib, config, nixosConfig, ... }:
3 programs.home-manager.enable = true;
9 # Keep only the last generation of the home-manager profile
10 home.activation.delete-generations = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
11 if [ "$(${pkgs.coreutils}/bin/id -u)" = 0 ]
12 then profile="''${NIX_STATE_DIR:-/nix/var/nix}/profiles/per-user/$USER"
13 else profile="''${XDG_STATE_HOME:-$HOME/.local/state}"/nix/profiles
15 ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile "$profile"/home-manager