nixos/factorio: add stateDir and requireUserVerification option

This commit is contained in:
The-M1k3y 2017-11-23 13:50:19 +01:00
parent 3db0f9d1e3
commit 7dcd299e9a

View File

@ -6,7 +6,7 @@ let
cfg = config.services.factorio; cfg = config.services.factorio;
factorio = pkgs.factorio-headless; factorio = pkgs.factorio-headless;
name = "Factorio"; name = "Factorio";
stateDir = "/var/lib/factorio"; stateDir = cfg.stateDir;
mkSavePath = name: "${stateDir}/saves/${name}.zip"; mkSavePath = name: "${stateDir}/saves/${name}.zip";
configFile = pkgs.writeText "factorio.conf" '' configFile = pkgs.writeText "factorio.conf" ''
use-system-read-write-data-directories=true use-system-read-write-data-directories=true
@ -25,7 +25,7 @@ let
password = cfg.password; password = cfg.password;
token = cfg.token; token = cfg.token;
game_password = cfg.game-password; game_password = cfg.game-password;
require_user_verification = true; require_user_verification = cfg.requireUserVerification;
max_upload_in_kilobytes_per_second = 0; max_upload_in_kilobytes_per_second = 0;
minimum_latency_in_ticks = 0; minimum_latency_in_ticks = 0;
ignore_player_limit_for_returning_players = false; ignore_player_limit_for_returning_players = false;
@ -80,6 +80,15 @@ in
customizations. customizations.
''; '';
}; };
stateDir = mkOption {
type = types.path;
default = "/var/lib/factorio";
description = ''
The server's data directory.
The configuration and map will be stored here.
'';
};
mods = mkOption { mods = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = []; default = [];
@ -148,6 +157,13 @@ in
Game password. Game password.
''; '';
}; };
requireUserVerification = mkOption {
type = types.bool;
default = true;
description = ''
When set to true, the server will only allow clients that have a valid factorio.com account.
'';
};
autosave-interval = mkOption { autosave-interval = mkOption {
type = types.nullOr types.int; type = types.nullOr types.int;
default = null; default = null;