2018-04-03 06:53:08 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.home-manager;
|
|
|
|
|
2022-06-07 20:45:06 +02:00
|
|
|
in {
|
2022-06-16 12:26:57 +02:00
|
|
|
imports = [ ../nixos/common.nix ];
|
2022-06-07 20:45:06 +02:00
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
{ home-manager.extraSpecialArgs.darwinConfig = config; }
|
|
|
|
(mkIf (cfg.users != { }) {
|
|
|
|
system.activationScripts.postActivation.text = concatStringsSep "\n"
|
|
|
|
(mapAttrsToList (username: usercfg: ''
|
|
|
|
echo Activating home-manager configuration for ${username}
|
|
|
|
sudo -u ${username} -s --set-home ${
|
|
|
|
pkgs.writeShellScript "activation-${username}" ''
|
|
|
|
${lib.optionalString (cfg.backupFileExtension != null)
|
|
|
|
"export HOME_MANAGER_BACKUP_EXT=${
|
|
|
|
lib.escapeShellArg cfg.backupFileExtension
|
|
|
|
}"}
|
|
|
|
${lib.optionalString cfg.verbose "export VERBOSE=1"}
|
|
|
|
exec ${usercfg.home.activationPackage}/activate
|
|
|
|
''
|
2019-05-03 16:11:13 +02:00
|
|
|
}
|
2022-06-07 20:45:06 +02:00
|
|
|
'') cfg.users);
|
|
|
|
})
|
|
|
|
];
|
2018-04-03 06:53:08 +02:00
|
|
|
}
|