depot/packages/checks/modules/nixos/age-dummy-secrets/default.nix

27 lines
773 B
Nix
Raw Permalink Normal View History

{ config, lib, ... }:
with lib;
{
options.age.secrets = mkOption {
type = types.attrsOf (types.submodule ({ name, config, ... }: {
2024-07-17 00:08:35 +03:00
config.path = lib.mkForce "/etc/dummy-secrets/${name}";
}));
};
config.environment.etc = mapAttrs' (name: secret: {
name = removePrefix "/etc/" secret.path;
value = mapAttrs (const mkDefault) {
user = secret.owner;
inherit (secret) mode group;
text = builtins.hashString "md5" name;
};
}) config.age.secrets;
2024-07-17 00:08:35 +03:00
config.system.activationScripts = {
agenixChown.text = lib.mkForce "echo using age-dummy-secrets";
agenixNewGeneration.text = lib.mkForce "echo using age-dummy-secrets";
agenixInstall.text = lib.mkForce ''
ln -sf /etc/dummy-secrets /run/agenix
'';
};
}