Add lego-auto module.
This commit is contained in:
parent
d1d313bc66
commit
f3e6224abe
2 changed files with 63 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./backrest
|
||||
./lego-auto
|
||||
./unifi
|
||||
];
|
||||
}
|
||||
|
|
62
nixos/modules/nixos/containers/lego-auto/default.nix
Normal file
62
nixos/modules/nixos/containers/lego-auto/default.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{ lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
app = "lego-auto";
|
||||
image = "ghcr.io/bjw-s/lego-auto:v0.3.0";
|
||||
user = "999"; #string
|
||||
group = "102"; #string
|
||||
port = 9898; #int
|
||||
cfg = config.mySystem.services.${app};
|
||||
appFolder = "/eru/containers/volumes/${app}";
|
||||
in
|
||||
{
|
||||
options.mySystem.services.${app} = {
|
||||
enable = mkEnableOption "${app}";
|
||||
dnsimpleTokenPath = mkOption {
|
||||
type = types.path;
|
||||
example = "/config/dnsimple-token";
|
||||
description = "Path to the DNSimple token file";
|
||||
};
|
||||
provider = mkOption {
|
||||
type = types.string;
|
||||
example = "dnsimple";
|
||||
description = "DNS provider";
|
||||
};
|
||||
domains = mkOption {
|
||||
type = types.string;
|
||||
example = "gandalf.jahanson.tech";
|
||||
description = "Domains to manage";
|
||||
};
|
||||
email = mkOption {
|
||||
type = types.string;
|
||||
example = "joe@veri.dev";
|
||||
description = "Email address for Let's Encrypt";
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: Add refresh cert path (ex. copy cert to unifi)
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers.${app} = {
|
||||
image = "${image}";
|
||||
user = "${user}:${group}";
|
||||
autoStart = true;
|
||||
extraOptions = [
|
||||
"--dns=1.1.1.1"
|
||||
];
|
||||
environment = {
|
||||
TZ = "America/Chicago";
|
||||
LA_DATADIR = "/certs";
|
||||
LA_CACHEDIR = "/certs/.cache";
|
||||
LA_EMAIL = "cfg.email";
|
||||
LA_DOMAINS = cfg.domains;
|
||||
LA_PROVIDER = cfg.provider;
|
||||
} // lib.optionalAttrs (cfg.provider == "dnsimple") {
|
||||
DNSIMPLE_OAUTH_TOKEN_FILE = "/config/dnsimple-token";
|
||||
};
|
||||
|
||||
volumes = [
|
||||
"${appFolder}/cert:/cert"
|
||||
] // optionals (cfg.provider == "dnsimple") [ "${cfg.dnsimpleTokenPath}:/config/dnsimple-token" ];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue