checks: add age dummy secrets NixOS module
This commit is contained in:
parent
1b3a990866
commit
0025a4bb2a
1 changed files with 33 additions and 0 deletions
33
packages/checks/modules/nixos/age-dummy-secrets.nix
Normal file
33
packages/checks/modules/nixos/age-dummy-secrets.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
|
||||
let
|
||||
t = {
|
||||
string = default: mkOption {
|
||||
type = types.str;
|
||||
inherit default;
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
options.age.secrets = mkOption {
|
||||
type = types.attrsOf (types.submodule ({ name, config, ... }: {
|
||||
options = {
|
||||
file = mkSinkUndeclaredOptions {};
|
||||
owner = t.string "root";
|
||||
group = t.string "root";
|
||||
mode = t.string "400";
|
||||
path = t.string "/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;
|
||||
}
|
Loading…
Reference in a new issue