mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
sops: Align home module with system module
This commit is contained in:
parent
2db3be17a6
commit
2f4a83a906
5 changed files with 12 additions and 15 deletions
|
|
@ -7,36 +7,35 @@
|
|||
}@moduleArgs:
|
||||
let
|
||||
cfg = config.custom.sops;
|
||||
|
||||
absoluteSecretsPath = "${self}/${cfg.secretsFile}";
|
||||
in
|
||||
{
|
||||
imports = [ inputs.sops.homeManagerModules.sops ];
|
||||
|
||||
options.custom.sops = {
|
||||
enable = lib.mkEnableOption "";
|
||||
agePublicKey = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = "";
|
||||
};
|
||||
hostName = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = moduleArgs.osConfig.networking.hostName or "";
|
||||
};
|
||||
secretsFile = lib.mkOption {
|
||||
agePublicKey = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = "users/${config.home.username}/@${cfg.hostName}/secrets.json";
|
||||
default =
|
||||
"${self}/users/${config.home.username}/@${cfg.hostName}/keys/age.pub" |> lib.readFile |> lib.trim;
|
||||
};
|
||||
secretsFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "${self}/users/${config.home.username}/@${cfg.hostName}/secrets.json";
|
||||
};
|
||||
secrets = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
default = absoluteSecretsPath |> lib.readFile |> lib.strings.fromJSON;
|
||||
default = cfg.secretsFile |> lib.readFile |> lib.strings.fromJSON;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops = {
|
||||
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
|
||||
defaultSopsFile = absoluteSecretsPath;
|
||||
defaultSopsFile = cfg.secretsFile;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue