Refactor git credentials secrets

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-02-28 11:00:21 +00:00
parent d8374fe7b7
commit 91104fc4b0
16 changed files with 235 additions and 134 deletions

View File

@@ -2,20 +2,59 @@
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{ inputs, system, ... }:
{
config,
inputs,
system,
...
}:
let
hmConfig = config.home-manager.users.${user};
selfPkgs = inputs.self.packages.${system};
in
{
home-manager.users.${user}.programs.ssh = {
matchBlocks = {
"cldlgn.fyi.sas.com" = {
inherit user;
hostname = "cldlgn.fyi.sas.com";
identityFile = "${home}/.ssh/ssh_sas_ed25519_key";
home-manager.users.${user} = {
sops.secrets = {
"ssh/personal/key" = {
sopsFile = ../../../../../../../secrets/personal/secrets.yaml;
key = "ssh/key";
path = "${home}/.ssh/ssh_personal_ed25519_key";
};
"ssh/personal/pass" = {
sopsFile = ../../../../../../../secrets/personal/secrets.yaml;
key = "ssh/pass";
};
"ssh/sas/key" = {
sopsFile = ../../../../../../../secrets/sas/secrets.yaml;
key = "ssh/key";
path = "${home}/.ssh/ssh_sas_ed25519_key";
};
"ssh/sas/pass" = {
sopsFile = ../../../../../../../secrets/sas/secrets.yaml;
key = "ssh/pass";
};
};
userKnownHostsFiles = with selfPkgs; [ ssh-known-hosts-sas-cldlgn ];
programs = {
ssh = {
matchBlocks = {
"cldlgn.fyi.sas.com" = {
inherit user;
hostname = "cldlgn.fyi.sas.com";
identityFile = "${home}/.ssh/ssh_sas_ed25519_key";
};
};
userKnownHostsFiles = with selfPkgs; [ ssh-known-hosts-sas-cldlgn ];
};
clipbook.bookmarks = {
"Personal SSH Key Passphrase".source = hmConfig.sops.secrets."ssh/personal/pass".path;
"SAS SSH Key Passphrase".source = hmConfig.sops.secrets."ssh/sas/pass".path;
};
};
};
}