42 lines
857 B
Nix
42 lines
857 B
Nix
|
{ pkgs, lib, ... }:
|
||
|
let
|
||
|
modDir = ./mods;
|
||
|
modList = lib.pipe modDir [
|
||
|
builtins.readDir
|
||
|
(lib.filterAttrs (_: v: v == "regular"))
|
||
|
(lib.mapAttrsToList (k: _: k))
|
||
|
(builtins.filter (lib.hasSuffix ".zip"))
|
||
|
];
|
||
|
|
||
|
validPath =
|
||
|
modFileName:
|
||
|
builtins.path {
|
||
|
path = "${modDir}/${modFileName}";
|
||
|
name = lib.strings.sanitizeDerivationName modFileName;
|
||
|
};
|
||
|
|
||
|
modToDrv =
|
||
|
modFileName:
|
||
|
pkgs.runCommand "copy-factorio-mods" { } ''
|
||
|
mkdir $out
|
||
|
ln -s '${validPath modFileName}' $out/'${modFileName}'
|
||
|
''
|
||
|
// {
|
||
|
deps = [ ];
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
services = {
|
||
|
factorio = {
|
||
|
enable = true;
|
||
|
game-name = "stats-export-test";
|
||
|
saveName = "stats-export-test";
|
||
|
mods = builtins.map modToDrv modList;
|
||
|
lan = true;
|
||
|
admins = [ "eboskma" ];
|
||
|
nonBlockingSaving = true;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
}
|