Flake: HM module

This commit is contained in:
bluepython508
2024-09-20 15:08:27 +01:00
parent 6aaf8ff8e5
commit 25260a5eb8
10 changed files with 139 additions and 38 deletions

View File

@@ -21,6 +21,7 @@
};
script = pkgs.writeShellScriptBin pname ''
set -eu
${pkgs.coreutils}/bin/mkdir -p $FRAJTANO_DIR
file="$FRAJTANO_DIR/cookie"
(umask 077; [ -f "$file" ] || ${pkgs.coreutils}/bin/head -c 128 /dev/urandom | ${pkgs.coreutils}/bin/base64 -w0 > "$file")
export RELEASE_COOKIE=$(${pkgs.coreutils}/bin/cat "$file")
@@ -28,10 +29,13 @@
exec ${lib.getExe pkg} "$@"
}
case $1 in
case "''${1:-}" in
assimilate)
run rpc ":ok = \"$(echo -n "$2" | ${pkgs.coreutils}/bin/base64)\" |> Base.decode64!() |> Frajtano.Agent.add_peer()"
;;
socket)
echo $FRAJTANO_DIR/agent.sock
;;
*)
run "$@"
;;