flake/meta/modules/sops/default.nix

24 lines
480 B
Nix
Raw Normal View History

2024-09-06 02:01:59 +02:00
{ 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 = ../../../secrets/${builtins.elemAt name_split 0}/${builtins.elemAt name_split 1}.yaml;
} // value)
cfg.secrets;
};
}