diff --git a/hosts/freun-dev/services.nix b/hosts/freun-dev/services.nix index c748840..606cc5e 100644 --- a/hosts/freun-dev/services.nix +++ b/hosts/freun-dev/services.nix @@ -370,5 +370,10 @@ in ] ); }; + + weechat = { + enable = true; + subdomain = "irc"; + }; }; } diff --git a/modules/services/default.nix b/modules/services/default.nix index dc35b85..c99ab66 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -23,5 +23,6 @@ ./uptime-kuma.nix ./mosquitto.nix ./home-assistant.nix + ./weechat.nix ]; } diff --git a/modules/services/webserver.nix b/modules/services/webserver.nix index 767d45a..e2848d7 100644 --- a/modules/services/webserver.nix +++ b/modules/services/webserver.nix @@ -9,6 +9,10 @@ let type = lib.types.nullOr lib.types.int; default = null; }; + root = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + }; extraConfig = lib.mkOption { type = lib.types.str; default = ""; @@ -83,9 +87,13 @@ in ]; locations = lib.mapAttrs ( _: - { proxyPort, extraConfig }: + { + proxyPort, + extraConfig, + root, + }: lib.mergeAttrsList [ - { inherit extraConfig; } + { inherit extraConfig root; } ( if (lib.isInt proxyPort) then { diff --git a/modules/services/weechat.nix b/modules/services/weechat.nix new file mode 100644 index 0000000..6b43f68 --- /dev/null +++ b/modules/services/weechat.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.services.weechat; + fqdn = cfg.subdomain + "." + config.networking.domain; +in +{ + options.services.weechat = { + subdomain = lib.mkOption { + type = lib.types.str; + description = "The subdomain for the weechat service"; + }; + }; + + config = lib.mkIf cfg.enable { + services = { + weechat = { + # binary = lib.mkDefault "${pkgs.weechat}/bin/weechat-headless"; + }; + + webserver = { + enable = lib.mkDefault true; + vHosts.${fqdn}.locations."/".root = pkgs.glowing-bear; + }; + }; + }; +}