Personal Nix setup

Extract password to secret file

Changed files
+22 -4
machines
modules
games
palworld
-1
machines/ramune/configuration.nix
···
ip = "51.38.68.193";
settings = {
ServerName = "London Boroughs";
-
ServerPassword = "onlyflans";
AllowConnectPlatform = "Xbox";
PalEggDefaultHatchingTime = 1;
};
+15 -3
modules/games/palworld/default.nix
···
};
config = mkIf isEnabled {
+
age.secrets."palworld-passwd.raw" = {
+
file = ./encrypt/palworld-passwd.age;
+
group = "${baseCfg.group}";
+
owner = "${baseCfg.user}";
+
mode = "770";
+
};
+
modules.router.nftables.capturePorts = [ cfg.port ];
networking.firewall.allowedUDPPorts = [ cfg.port ];
···
};
files = let
-
settings = baseSettings // cfg.settings;
+
settings = baseSettings // cfg.settings // {
+
ServerPassword = "@SERVER_PASSWORD@";
+
};
in {
"Pal/Binaries/Linux/steamclient.so" = "${pkgs.steamworks-sdk-redist}/lib/steamclient.so";
"Pal/Saved/Config/LinuxServer/PalWorldSettings.ini" = generateSettings "PalWorldSettings.ini" settings;
-
"Pal/Saved/Config/LinuxServer/Engine.ini" = builtins.readFile ./Engine.ini;
+
"Pal/Saved/Config/LinuxServer/Engine.ini" = ./Engine.ini;
};
script = let
···
path = with pkgs; [ xdg-user-dirs util-linux ];
inherit script;
-
preStart = ''
+
preStart = let
+
passwordFile = config.age.secrets."palworld-passwd.raw".path;
+
in ''
+
export SERVER_PASSWORD=$(cat "${passwordFile}")
${scripts.mkDirs name dirs}
${scripts.mkFiles name files}
'';
+5
modules/games/palworld/encrypt/palworld-passwd.age
···
+
age-encryption.org/v1
+
-> ssh-ed25519 QwbpPw QN+UCu72rNSGKgnZpCiAgMQGx7NgnCAvRH+7PHb01F0
+
VxjDtBg5oFfHLcvDEzJ+gU/MVaqJKhHPVkBxlA+TMkU
+
--- JQbohsuqLyCVe+muSKagiWVdfrk8XO2tIjGq/U4GtoM
+
����ϹX���E���߁�a������uɛ���������
+2
secrets.nix
···
"./modules/automation/certs/mqtt.key.age".publicKeys = keys;
"./modules/automation/certs/mqtt.crt.age".publicKeys = keys;
+
+
"./modules/games/palworld/encrypt/palworld-passwd.age".publicKeys = keys;
}