diff --git a/services/impermanence.nix b/services/impermanence.nix index 2d33846..45a4b43 100644 --- a/services/impermanence.nix +++ b/services/impermanence.nix @@ -64,4 +64,19 @@ in ]; users = listToAttrs (map persistUser config.machine.administrators); }; + + # link current home manager profile if it exists + # impermanence mounts come after system activation during boot + # we check the persistent location and link to the expected mount point + system.activationScripts.profile-init.text = concatStrings ( + map ( + user: + with user; # bash + '' + if [[ -d /persist/home/${name}/.local/state/nix/profiles/profile ]]; then + ln -sfn /home/${name}/.local/state/nix/profiles/profile /home/${name}/.nix-profile + fi + '' + ) config.machine.administrators + ); }