mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11:34 +01:00
git: derive ssh-key names from sops secrets file
This commit is contained in:
parent
8a0238af60
commit
8561f6381b
2 changed files with 17 additions and 11 deletions
|
|
@ -17,12 +17,20 @@ in
|
|||
type = lib.types.nonEmptyStr;
|
||||
default = moduleArgs.osConfig.networking.hostName or "";
|
||||
};
|
||||
defaultSopsFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "${self}/users/${config.home.username}/@${cfg.hostName}/secrets.json";
|
||||
};
|
||||
secrets = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
default = cfg.defaultSopsFile |> builtins.readFile |> builtins.fromJSON;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops = {
|
||||
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
|
||||
defaultSopsFile = "${self}/users/${config.home.username}/@${cfg.hostName}/secrets.json";
|
||||
inherit (cfg) defaultSopsFile;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue