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