machine-config/factorio/configuration.nix

62 lines
1.8 KiB
Nix
Raw Normal View History

2024-08-05 20:04:32 -05:00
{ config, lib, pkgs, ... }: {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"factorio-headless"
];
imports = [
./hardware-configuration.nix
];
networking.hostName = "factorio";
time.timeZone = "America/Chicago";
i18n.defaultLocale = "en_US.UTF-8";
environment.systemPackages = with pkgs; [ rsync ];
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEhPyyqS3BGYor3zLbjc8hZuhem3mS8TNmvWogXcnz/b chandler@chandlerswift.com'' ];
services.factorio = {
enable = true;
openFirewall = true;
nonBlockingSaving = true;
game-name = "Chandler's Factorio Server";
game-password = "nixosftw";
description = "Hi Jeff!";
mods =
let
inherit (pkgs) lib;
modDir = ./mods;
modList = lib.pipe modDir [
builtins.readDir
(lib.filterAttrs (k: v: v == "regular"))
(lib.mapAttrsToList (k: v: k))
(builtins.filter (lib.hasSuffix ".zip"))
];
modToDrv = modFileName:
pkgs.runCommand "copy-factorio-mods" {} ''
mkdir $out
cp ${modDir + "/${modFileName}"} $out/${modFileName}
''
// { deps = []; };
in
builtins.map modToDrv modList;
};
# networking.firewall.allowedTCPPorts = [
# 80 # Caddy
# 443 # Caddy
# ];
# networking.firewall.allowedUDPPorts = [ ... ];
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
system.stateVersion = "24.05";
}