sops: Rename secrets option to secretsData

This commit is contained in:
SebastianStork 2026-02-28 00:13:51 +01:00
parent 3af7d23a46
commit 4887e06117
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
5 changed files with 10 additions and 10 deletions

View file

@ -33,7 +33,7 @@ in
enable = lib.mkEnableOption "";
networks = lib.mkOption {
type = lib.types.listOf lib.types.nonEmptyStr;
default = config.custom.sops.secrets.iwd |> lib.attrNames;
default = config.custom.sops.secretsData.iwd |> lib.attrNames;
};
};
};

View file

@ -11,7 +11,7 @@ let
inherit (config.services.syncthing) dataDir;
useSopsSecrets = config.custom.sops.secrets |> lib.hasAttr "syncthing";
useSopsSecrets = config.custom.sops.secretsData |> lib.hasAttr "syncthing";
in
{
options.custom.services.syncthing = {

View file

@ -21,7 +21,7 @@ in
type = self.lib.types.existingPath;
default = "${self}/hosts/${config.networking.hostName}/secrets.json";
};
secrets = lib.mkOption {
secretsData = lib.mkOption {
type = lib.types.anything;
default = cfg.secretsFile |> lib.readFile |> lib.strings.fromJSON;
};
@ -40,12 +40,12 @@ in
config.sops.secrets
|> lib.attrNames
|> lib.map (secretPath: {
assertion = cfg.secrets |> lib.hasAttrByPath (secretPath |> lib.splitString "/");
assertion = cfg.secretsData |> lib.hasAttrByPath (secretPath |> lib.splitString "/");
message = "Sops secret `${secretPath}` is used in a module but not defined in secrets.json";
})
)
++ (
lib.removeAttrs cfg.secrets [ "sops" ]
lib.removeAttrs cfg.secretsData [ "sops" ]
|> lib.mapAttrsToListRecursive (path: _: path |> lib.concatStringsSep "/")
|> lib.map (secretPath: {
assertion = config.sops.secrets |> lib.hasAttr secretPath;