factorio: let us change mod settings
This commit is contained in:
parent
a1115f5ea5
commit
c6e6d44fe5
3 changed files with 14 additions and 4 deletions
|
@ -39,7 +39,7 @@ let
|
|||
} // cfg.extraSettings;
|
||||
serverSettingsFile = pkgs.writeText "server-settings.json" (builtins.toJSON (filterAttrsRecursive (n: v: v != null) serverSettings));
|
||||
serverAdminsFile = pkgs.writeText "server-adminlist.json" (builtins.toJSON cfg.admins);
|
||||
modDir = pkgs.factorio-utils.mkModDirDrv cfg.mods;
|
||||
modDir = pkgs.factorio-utils.mkModDirDrv cfg.mods cfg.mods-dat;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
@ -136,6 +136,13 @@ in
|
|||
derivations via nixos-channel. Until then, this is for experts only.
|
||||
'';
|
||||
};
|
||||
mods-dat = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = lib.mdDoc ''
|
||||
Mods settings can be changed by specifying a dat file.
|
||||
'';
|
||||
};
|
||||
game-name = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "Factorio Game";
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
, libSM, libICE, libXext, factorio-utils
|
||||
, releaseType
|
||||
, mods ? []
|
||||
, mods-dat ? null
|
||||
, versionsJson ? ./versions.json
|
||||
, username ? "", token ? "" # get/reset token at https://factorio.com/profile
|
||||
, experimental ? false # true means to always use the latest branch
|
||||
|
@ -130,7 +131,7 @@ let
|
|||
fi
|
||||
'';
|
||||
|
||||
modDir = factorio-utils.mkModDirDrv mods;
|
||||
modDir = factorio-utils.mkModDirDrv mods mods-dat;
|
||||
|
||||
base = with actual; {
|
||||
pname = "factorio-${releaseType}";
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{ lib, stdenv }:
|
||||
with lib;
|
||||
{
|
||||
mkModDirDrv = mods: # a list of mod derivations
|
||||
mkModDirDrv = mods: modsDatFile: # a list of mod derivations
|
||||
let
|
||||
recursiveDeps = modDrv: [modDrv] ++ map recursiveDeps modDrv.deps;
|
||||
modDrvs = unique (flatten (map recursiveDeps mods));
|
||||
|
@ -18,7 +18,9 @@ with lib;
|
|||
# NB: there will only ever be a single zip file in each mod derivation's output dir
|
||||
ln -s $modDrv/*.zip $out
|
||||
done
|
||||
'';
|
||||
'' + (if modsDatFile != null then ''
|
||||
cp ${modsDatFile} $out/mod-settings.dat
|
||||
'' else "");
|
||||
};
|
||||
|
||||
modDrv = { allRecommendedMods, allOptionalMods }:
|
||||
|
|
Loading…
Reference in a new issue