make all age use conditional

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-10-27 23:03:40 -05:00
parent b2f0476412
commit 3cb6fba59e
8 changed files with 73 additions and 9 deletions

View file

@ -1,5 +1,6 @@
{
config,
lib,
...
}:
let
@ -9,6 +10,13 @@ let
hostDataDir = "/var/lib/${name}";
v_port = 8222;
hasSecret =
secret:
let
secrets = config.age.secrets or { };
in
secrets ? ${secret} && secrets.${secret} != null;
in
{
users = {
@ -26,7 +34,7 @@ in
chmod -R 750 ${hostDataDir}
'';
containers.${name} = {
containers.${name} = lib.mkIf (hasSecret "vaultwarden_env") {
ephemeral = true;
autoStart = true;
privateNetwork = false;
@ -72,7 +80,7 @@ in
};
};
services.nginx.virtualHosts."vault.joshuabell.xyz" = {
services.nginx.virtualHosts."vault.joshuabell.xyz" = lib.mkIf (hasSecret "vaultwarden_env") {
enableACME = true;
forceSSL = true;
locations = {