refactor: removing needless module complexity

This commit is contained in:
cnst
2024-10-27 09:14:34 +01:00
parent d8f810ee05
commit 4887feccfd
175 changed files with 920 additions and 1118 deletions

View File

@@ -0,0 +1,58 @@
{
config,
lib,
inputs,
pkgs,
self,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption mkMerge;
cfg = config.nixos.services.agenix;
in {
options = {
nixos.services.agenix = {
enable = mkEnableOption "Enables agenix system environment";
cnix.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Apply cnix agenix settings";
};
toothpc.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Apply toothpc agenix settings";
};
cnixpad.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Apply cnixpad agenix settings";
};
};
};
config = mkIf cfg.enable {
age = mkMerge [
(mkIf cfg.cnix.enable {
secrets = {
cnstssh.file = "${self}/secrets/cnstssh.age";
cnixssh.file = "${self}/secrets/cnixssh.age";
};
})
(mkIf cfg.toothpc.enable {
secrets = {
# Add toothpc specific secrets here
};
})
(mkIf cfg.cnixpad.enable {
secrets = {
# Add adampad specific secrets here
};
})
];
environment.systemPackages = [
inputs.agenix.packages.x86_64-linux.default
pkgs.age
];
};
}