From 71d776260328359da86f01afb38bb3c15124a613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Bori?= Date: Thu, 7 Nov 2024 11:05:10 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20(config):=20Added=20the=20possibili?= =?UTF-8?q?ty=20to=20use=20a=20whole=20custom=20server=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/nixos/nix-teeworlds/default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/nixos/nix-teeworlds/default.nix b/modules/nixos/nix-teeworlds/default.nix index 005f571..75faaf3 100644 --- a/modules/nixos/nix-teeworlds/default.nix +++ b/modules/nixos/nix-teeworlds/default.nix @@ -245,6 +245,16 @@ let ''; }; + quickConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Custom configuration to use instead of the basics one. + ''; + }; + + useQuickConfig = mkEnableOption "Enable quick configuration."; + register = mkOption { type = types.bool; default = false; @@ -534,6 +544,9 @@ in ${lib.optionalString (server.extraConfig != null) server.extraConfig} ''; + + serverConfig' = + if (server.useQuickConfig && server.quickConfig != "") then server.quickConfig else serverConfig; in { description = "Teeworlds server ${name} managed by nix-teeworlds."; @@ -551,7 +564,7 @@ in name = "nix-teeworlds-${name}-start-pre"; text = '' ln -sf ${server.dataDir} data - ln -sf ${serverConfig} autoexec.cfg + ln -sf ${serverConfig'} autoexec.cfg ''; } );