organizing config and getting rid of withs as much as possible
This commit is contained in:
parent
42c647cb63
commit
c365ba3827
12 changed files with 142 additions and 57 deletions
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.wyrdgard;
|
||||
let
|
||||
cfg = config.wyrdgard.apps.factorio-server;
|
||||
inherit (config.wyrdgard.user) name;
|
||||
in
|
||||
{
|
||||
options.wyrdgard.apps.factorio-server = with types; {
|
||||
enable = mkEnableOption "Enable Factorio Headless Server";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ factorio-headless ];
|
||||
sops = {
|
||||
secrets = {
|
||||
factorio_token = {
|
||||
restartUnits = [ "factorio.service" ];
|
||||
};
|
||||
factorio_username = {
|
||||
restartUnits = [ "factorio.service" ];
|
||||
};
|
||||
factorio_game_password = {
|
||||
restartUnits = [ "factorio.service" ];
|
||||
};
|
||||
};
|
||||
templates."extraSettingsFile.json".content = ''
|
||||
{
|
||||
"name": "Alles Nix!",
|
||||
"description": "Trying to run a factorio-headless-server on my nix system",
|
||||
"tags": ["vanilla"],
|
||||
"max_players": 10,
|
||||
"game_password": "${config.sops.placeholder.factorio_game_password}",
|
||||
"allow_commands": "admins-only",
|
||||
"autosave_slots": 5,
|
||||
"ignore_player_limit_for_returning_players": true,
|
||||
"username" : "${config.sops.placeholder.factorio_username}",
|
||||
"admins": ["${config.sops.placeholder.factorio_username}"],
|
||||
"token": "${config.sops.placeholder.factorio_token}"
|
||||
}
|
||||
'';
|
||||
templates."extraSettingsFile.json".mode = "0444";
|
||||
};
|
||||
|
||||
services.factorio = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
public = true;
|
||||
lan = true;
|
||||
nonBlockingSaving = true;
|
||||
autosave-interval = 5;
|
||||
loadLatestSave = true;
|
||||
bind = "192.168.178.34";
|
||||
extraSettingsFile = config.sops.templates."extraSettingsFile.json".path;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue