Minor module refactors

This commit is contained in:
SebastianStork 2025-04-06 20:25:14 +02:00
parent 89144e5b7a
commit 1a8333829e
4 changed files with 28 additions and 26 deletions

View file

@ -5,24 +5,15 @@
lib,
...
}:
let
cfg = config.myConfig.sops;
in
{
imports = [ inputs.sops-nix.nixosModules.sops ];
options.myConfig.sops = {
enable = lib.mkEnableOption "";
defaultSopsFile = lib.mkOption {
type = lib.types.path;
default = "${self}/hosts/${config.networking.hostName}/secrets.yaml";
};
};
options.myConfig.sops.enable = lib.mkEnableOption "";
config = lib.mkIf cfg.enable {
config = lib.mkIf config.myConfig.sops.enable {
sops = {
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
inherit (cfg) defaultSopsFile;
defaultSopsFile = "${self}/hosts/${config.networking.hostName}/secrets.yaml";
};
};
}