meow
This commit is contained in:
parent
93a675c06a
commit
9ca7a8d8f6
20 changed files with 631 additions and 194 deletions
56
secrets/nixos-module.nix
Normal file
56
secrets/nixos-module.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.xyno.secrets;
|
||||
json = builtins.toJSON cfg;
|
||||
|
||||
in
|
||||
{
|
||||
options.xyno.secret-output = lib.mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
options.xyno.secrets = mkOption {
|
||||
type = types.attrsOf (
|
||||
types.submodule {
|
||||
options = {
|
||||
random = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
have the secret be a random hex string with n bytes
|
||||
'';
|
||||
};
|
||||
ageFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
have the secret be a age encrypted file
|
||||
'';
|
||||
};
|
||||
command = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
have the secret be the output of a command (impure grrrrr)
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
config = {
|
||||
systemd.tpm2.enable = true;
|
||||
boot.initrd.systemd.tpm2.enable = true;
|
||||
# TODO: ensure secrets are loaded in activation script
|
||||
|
||||
xyno.secret-output = pkgs.writeFile "xyno-secret.json" json;
|
||||
environment.systemPackages = [
|
||||
pkgs.openssl # needed for random secrets
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue