about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2024-09-06T21·34+0200
committerclbot <clbot@tvl.fyi>2024-09-06T21·43+0000
commitf51d27acb278cc3dd66a2b991884fdaa8fcbaceb (patch)
tree1fd50e4671c1916ad235ccd26d5a7683b3b922e1
parent31f55d7ce7f086d4a966e21b05750ef98d1254bb (diff)
refactor(sterni/backup-minecraft-fabric): use systemd-creds r/8658
The bundled tool is sort of convenient, I first tried it when debugging
an issue (that doesn't affect this module) and it seems a bit nicer.

Change-Id: Ief948f8e46e51f05b04fe7628ab9298284f780e9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12444
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
-rw-r--r--users/sterni/modules/backup-minecraft-fabric.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/users/sterni/modules/backup-minecraft-fabric.nix b/users/sterni/modules/backup-minecraft-fabric.nix
index a80a7f51a9ef..5dad2b8825c2 100644
--- a/users/sterni/modules/backup-minecraft-fabric.nix
+++ b/users/sterni/modules/backup-minecraft-fabric.nix
@@ -10,7 +10,8 @@ let
   inherit (depot.nix) getBins;
 
   bins = getBins pkgs.borgbackup [ "borg" ]
-    // getBins pkgs.mcrcon [ "mcrcon" ];
+    // getBins pkgs.mcrcon [ "mcrcon" ]
+    // getBins pkgs.systemd [ "systemd-creds" ];
 
   unvaried = ls: builtins.all (l: l == builtins.head ls) ls;
 
@@ -29,7 +30,7 @@ let
       export MCRCON_HOST="localhost"
       export MCRCON_PORT="${toString instanceCfg.serverProperties."rcon.port"}"
       # Unfortunately, mcrcon can't read the password from a file
-      export MCRCON_PASS="$(cat "''${CREDENTIALS_DIRECTORY}/${instanceName}-rcon-password")"
+      export MCRCON_PASS="$(${bins.systemd-creds} cat "${instanceName}-rcon-password")"
 
       ${bins.mcrcon} save-all
       unset MCRCON_PASS