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,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
|
||||
cfg = config.services.wa2k;
|
||||
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
|
||||
services.static-web-server = {
|
||||
enable = true;
|
||||
listen = "[::]:${cfg.port}";
|
||||
root = "${pkgs.wa2k-website}/www";
|
||||
openFirewall = mkOption {
|
||||
types = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether the wa2k listening port should be automatically opened in the system's firewall.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
configuration = {
|
||||
general = {
|
||||
directory-listing = false;
|
||||
config = lib.mkIf cfg.enable {
|
||||
networking.firewall.allowedTCPPorts = lib.optional cfg.openFirewall [cfg.port];
|
||||
|
||||
# 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