system/hosts/tatos/services/wireguard/update_ru_routes.nix

29 lines
599 B
Nix
Raw Permalink Normal View History

2023-07-28 17:08:13 +03:00
{ writeShellScriptBin
2023-08-01 10:26:56 +03:00
, substituteAll
2023-07-28 17:08:13 +03:00
, symlinkJoin
, makeWrapper
, bind
, iptables
, ipcalc
, jq
, gawk
, curl
}:
let
2023-08-01 10:26:56 +03:00
update_ru_routes_unwrapped = writeShellScriptBin "update_ru_routes"
(builtins.readFile (substituteAll {
src = ./update_ru_routes.sh;
subnetsUserList = "${./subnets_user_list.secret.txt}";
}));
2023-07-28 17:08:13 +03:00
in
symlinkJoin {
name = "update_ru_routes";
paths = [ update_ru_routes_unwrapped ] ++ [ bind.dnsutils iptables jq gawk curl ipcalc ];
buildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/update_ru_routes --prefix PATH : $out/bin
'';
}