nixos-config/machines/factorio/factorio.nix

42 lines
857 B
Nix
Raw Normal View History

2024-11-14 13:13:24 +01:00
{ 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;
};
};
}