flake/modules/sops/default.nix

28 lines
500 B
Nix
Raw Normal View History

2024-09-06 02:01:59 +02:00
{
2024-10-29 08:55:56 +01:00
pkgs,
lib,
config,
...
}: let
cfg = config.lyn.sops;
in {
2024-09-06 02:01:59 +02:00
options.lyn.sops = with lib; {
secrets = mkOption {
type = types.attrs;
2024-10-29 08:55:56 +01:00
default = {};
2024-09-06 02:01:59 +02:00
};
};
config = {
2024-10-29 08:55:56 +01:00
sops.secrets =
lib.mapAttrs
(name: value: let
name_split = lib.splitString "/" name;
in
2024-09-06 02:01:59 +02:00
{
2024-09-17 02:46:45 +02:00
sopsFile = config.flakePath + /secrets/${builtins.elemAt name_split 0}/${builtins.elemAt name_split 1}.yaml;
2024-10-29 08:55:56 +01:00
}
// value)
2024-09-06 02:01:59 +02:00
cfg.secrets;
};
}