Manage github ssh-keys with sops

This commit is contained in:
SebastianStork 2024-07-05 15:04:57 +02:00
parent c1cba95e02
commit ae4a2e5b72
10 changed files with 92 additions and 11 deletions

View file

@ -4,7 +4,7 @@
config,
lib,
...
}:
}@moduleArgs:
{
imports = [ inputs.sops-nix.homeManagerModules.sops ];
@ -13,7 +13,12 @@
config = lib.mkIf config.myConfig.sops.enable {
sops = {
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
defaultSopsFile = "${self}/users/${config.home.username}/secrets.yaml";
defaultSopsFile =
let
hostName = moduleArgs.osConfig.networking.hostName or "";
hostDir = if hostName != "" then "/@" + hostName else "";
in
"${self}/users/${config.home.username}${hostDir}/secrets.yaml";
};
};
}