2022-10-03 04:05:07 +00:00
|
|
|
{ config, pkgs, lib, ... }: {
|
2022-05-18 03:34:09 +00:00
|
|
|
|
2022-10-03 04:05:07 +00:00
|
|
|
options = {
|
|
|
|
identityFile = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Path to SSH key for age";
|
|
|
|
default = "${config.homePath}/.ssh/id_ed25519";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
home-manager.users.${config.user}.home.packages = with pkgs; [ age ];
|
|
|
|
|
|
|
|
system.activationScripts.age.text = ''
|
|
|
|
if [ ! -f "${config.identityFile}" ]; then
|
|
|
|
$DRY_RUN_CMD echo -e \nEnter the seed phrase for your SSH key...\n
|
|
|
|
$DRY_RUN_CMD echo -e \nThen press ^D when complete.\n\n
|
|
|
|
$DRY_RUN_CMD ${pkgs.melt}/bin/melt restore ${config.identityFile}
|
|
|
|
$DRY_RUN_CMD chown ${config.user}:wheel ${config.identityFile}*
|
|
|
|
$DRY_RUN_CMD echo -e \n\nContinuing activation.\n\n
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
2022-05-18 03:34:09 +00:00
|
|
|
|
|
|
|
}
|