nix

configuration files that power my machines
Log | Files | Refs | README | LICENSE

gamja.nix (853B)


      1 {
      2   config,
      3   lib,
      4   pkgs,
      5   haravara,
      6   ...
      7 }: let
      8   cfg = config.services.haravara.gamja;
      9 in {
     10   options.services.haravara.gamja = {
     11     enable = lib.mkEnableOption "Gamja IRC web client (served via Caddy)";
     12     domain = lib.mkOption {
     13       type = lib.types.str;
     14     };
     15     serverUrl = lib.mkOption {
     16       type = lib.types.nullOr lib.types.str;
     17       default = null;
     18       description = "WebSocket URL of the soju bouncer (e.g. wss://bouncer.example.org)";
     19     };
     20     authLabel = haravara.authLabelOption;
     21   };
     22 
     23   config = lib.mkIf cfg.enable {
     24     services.caddy.virtualHosts."${cfg.domain}".extraConfig = ''
     25       ${haravara.mkAuthImport cfg.authLabel}
     26       root * ${
     27         if cfg.serverUrl != null
     28         then pkgs.gamja.override {gamjaConfig = {server.url = cfg.serverUrl;};}
     29         else pkgs.gamja
     30       }
     31       file_server
     32     '';
     33   };
     34 }