diff --git a/nixos-modules/valheim.nix b/nixos-modules/valheim.nix index 29bec87..7e07419 100644 --- a/nixos-modules/valheim.nix +++ b/nixos-modules/valheim.nix @@ -61,6 +61,43 @@ in { description = lib.mdDoc "Whether to open ports in the firewall."; }; + public = lib.mkOption { + type = lib.types.bool; + default = true; + description = lib.mdDoc '' + Toggles visibility on the Steam server & community lists. + + When not set, defaults to true (visible). + Set to false to make the server private. + ''; + }; + + logFile = lib.mkOption { + type = with lib.types; nullOr str; + default = null; + example = "/var/lib/valheim/log/valheim-server.log"; + description = lib.mdDoc '' + The path where the server log file will be saved. + + When set, this will redirect all logs from stdout to the specified path. + This means that the logs will not be captured by systemd's journal. + Leave this option unset to keep console logging enabled. + + Make sure the valheim user has write access to the specified directory, otherwise + the valheim service fail to start and exit. + ''; + }; + + preset = lib.mkOption { + type = with lib.types; nullOr str; + default = null; + example = "hardcore"; + description = lib.mdDoc '' + The preset world modifier, valid options are + "easy", "hard", "hardcore", "casual", "hammer" and "immersive". + ''; + }; + password = lib.mkOption { type = lib.types.str; default = ""; @@ -277,8 +314,11 @@ in { ++ [ "-port \"${builtins.toString cfg.port}\"" "-password \"${cfg.password}\"" + "-public ${if cfg.public then "1" else "0"}" ] - ++ (lib.lists.optional cfg.crossplay "-crossplay")); + ++ (lib.lists.optional cfg.crossplay "-crossplay") + ++ (lib.lists.optional (cfg.logFile != null) "-logFile \"${cfg.logFile}\"") + ++ (lib.lists.optional (cfg.preset != null) "-preset \"${cfg.preset}\"")); }; }; };