flake/modules/sops/default.nix
2024-10-29 08:55:56 +01:00

27 lines
500 B
Nix

{
pkgs,
lib,
config,
...
}: let
cfg = config.lyn.sops;
in {
options.lyn.sops = with lib; {
secrets = mkOption {
type = types.attrs;
default = {};
};
};
config = {
sops.secrets =
lib.mapAttrs
(name: value: let
name_split = lib.splitString "/" name;
in
{
sopsFile = config.flakePath + /secrets/${builtins.elemAt name_split 0}/${builtins.elemAt name_split 1}.yaml;
}
// value)
cfg.secrets;
};
}