forked from UniverseBow/wa2k.com-Website
add options.services.wa2k
This commit is contained in:
parent
4d8b686094
commit
6be517516c
1 changed files with 34 additions and 10 deletions
|
|
@ -4,21 +4,45 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib) mkEnableOption mkOption types;
|
||||||
|
|
||||||
cfg = config.services.wa2k;
|
cfg = config.services.wa2k;
|
||||||
in {
|
in {
|
||||||
imports = [./wa2k];
|
options.services.wa2k = {
|
||||||
|
enable = mkEnableOption "webserver for wa2k.com";
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = lib.optional cfg.openFirewall [cfg.port];
|
port = mkOption {
|
||||||
|
types = types.port;
|
||||||
|
default = 80;
|
||||||
|
example = 8080;
|
||||||
|
description = ''
|
||||||
|
The listening port on localhost to bind the wa2k.com server to.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
# REF: https://nixos.wiki/wiki/Static_Web_Server
|
openFirewall = mkOption {
|
||||||
services.static-web-server = {
|
types = types.bool;
|
||||||
enable = true;
|
default = false;
|
||||||
listen = "[::]:${cfg.port}";
|
example = true;
|
||||||
root = "${pkgs.wa2k-website}/www";
|
description = ''
|
||||||
|
Whether the wa2k listening port should be automatically opened in the system's firewall.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
configuration = {
|
config = lib.mkIf cfg.enable {
|
||||||
general = {
|
networking.firewall.allowedTCPPorts = lib.optional cfg.openFirewall [cfg.port];
|
||||||
directory-listing = false;
|
|
||||||
|
# REF: https://nixos.wiki/wiki/Static_Web_Server
|
||||||
|
services.static-web-server = {
|
||||||
|
enable = true;
|
||||||
|
listen = "[::]:${cfg.port}";
|
||||||
|
root = "${pkgs.wa2k-website}/www";
|
||||||
|
|
||||||
|
configuration = {
|
||||||
|
general = {
|
||||||
|
directory-listing = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue