feat(nix): add web-servers module and enable SSL certificates
This commit is contained in:
parent
c85db031dc
commit
9657329282
2 changed files with 46 additions and 0 deletions
|
@ -38,6 +38,9 @@
|
||||||
"slayment.com"
|
"slayment.com"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
web-servers = {
|
||||||
|
enableSSL = true;
|
||||||
|
};
|
||||||
databases = {
|
databases = {
|
||||||
mongodb.enable = true;
|
mongodb.enable = true;
|
||||||
mysql.enable = true;
|
mysql.enable = true;
|
||||||
|
|
43
nix/modules/server/web-servers.nix
Normal file
43
nix/modules/server/web-servers.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
inherit (builtins) listToAttrs map;
|
||||||
|
inherit (config.flake.lib.options) mkStrOption mkPathOption;
|
||||||
|
inherit (config.flake.lib.services) mkRootDomain;
|
||||||
|
inherit (config.flake.paths) secrets;
|
||||||
|
inherit (config.flake.admin) email;
|
||||||
|
inherit (lib.types) listOf submodule attrs;
|
||||||
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
|
inherit (lib.modules) mkMerge mkIf;
|
||||||
|
inherit (lib.lists) singleton;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.modules.nixos.default =
|
||||||
|
{ config, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.server.web-servers;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.server.web-servers = {
|
||||||
|
enableSSL = mkEnableOption "";
|
||||||
|
};
|
||||||
|
config = mkMerge [
|
||||||
|
(mkIf cfg.enableSSL {
|
||||||
|
sops.secrets."keys/cloudflare".sopsFile = secrets + "/keys.yaml";
|
||||||
|
security.acme = {
|
||||||
|
acceptTerms = true;
|
||||||
|
defaults = {
|
||||||
|
inherit email;
|
||||||
|
dnsProvider = "cloudflare";
|
||||||
|
credentialFiles."CLOUDFLARE_DNS_API_TOKEN_FILE" = config.sops.secrets."keys/cloudflare".path;
|
||||||
|
};
|
||||||
|
certs = {
|
||||||
|
"rrv.sh".extraDomainNames = singleton "*.rrv.sh";
|
||||||
|
"bwfiq.com".extraDomainNames = singleton "*.bwfiq.com";
|
||||||
|
"slayment.com".extraDomainNames = singleton "*.slayment.com";
|
||||||
|
"aenyrathia.wiki".extraDomainNames = singleton "*.aenyrathia.wiki";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue