diff options
-rw-r--r-- | hel.nix | 12 | ||||
-rw-r--r-- | hel/recv-media.nix | 22 |
2 files changed, 31 insertions, 3 deletions
@@ -107,8 +107,8 @@ | |||
107 | nodeName = "hel"; | 107 | nodeName = "hel"; |
108 | remoteNodes = ["isaac" "ymir"]; # legacy name for odin | 108 | remoteNodes = ["isaac" "ymir"]; # legacy name for odin |
109 | sshUser = { | 109 | sshUser = { |
110 | openssh.authorizedKeys.keys = [ ''no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/var/setuid-wrappers/uucico" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEgtDHA7oDIaRwggGGznNaKZF68rFTziqefSCn1t9ZKe uucp@odin'' | 110 | openssh.authorizedKeys.keys = [ ''no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/var/setuid-wrappers/uucico" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFH1QWdgoC03nzW5GBuCl2pqASHeIXIYtE9IInHdaKcO uucp@ymir'' |
111 | ''no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/var/setuid-wrappers/uucico" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFH1QWdgoC03nzW5GBuCl2pqASHeIXIYtE9IInHdaKcO uucp@ymir'' | 111 | ''no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/var/setuid-wrappers/uucico" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJhACtnt9+3j2ev4QVA2QBlPtblPnu7yol2njgfMlHtC uucp@odin'' |
112 | ]; | 112 | ]; |
113 | }; | 113 | }; |
114 | sshConfig = '' | 114 | sshConfig = '' |
@@ -119,8 +119,14 @@ | |||
119 | Hostname ymir.niflheim.yggdrasil | 119 | Hostname ymir.niflheim.yggdrasil |
120 | IdentityFile ~/.ssh/ymir | 120 | IdentityFile ~/.ssh/ymir |
121 | ''; | 121 | ''; |
122 | commandPath = []; | 122 | commandPath = [ "${pkgs.callPackage ./hel/recv-media.nix {}}/bin" ]; |
123 | defaultCommands = []; | 123 | defaultCommands = []; |
124 | protocols = { | ||
125 | isaac = "g"; | ||
126 | }; | ||
127 | commands = { | ||
128 | isaac = ["recv-media"]; | ||
129 | }; | ||
124 | }; | 130 | }; |
125 | }; | 131 | }; |
126 | 132 | ||
diff --git a/hel/recv-media.nix b/hel/recv-media.nix new file mode 100644 index 00000000..f85598f4 --- /dev/null +++ b/hel/recv-media.nix | |||
@@ -0,0 +1,22 @@ | |||
1 | { stdenv, coreutils, ffmpeg-full writeScriptBin }: | ||
2 | |||
3 | writeScriptBin "recv-media" '' | ||
4 | #!${stdenv.shell} | ||
5 | |||
6 | PATH=${ffmpeg-full}/bin:${coreutils}/bin | ||
7 | |||
8 | dir=/var/media | ||
9 | |||
10 | file="''${dir}/.$(basename "$1")" | ||
11 | file2="''${dir}/.copy.$(basename "$1")" | ||
12 | nFile="''${dir}/$(basename "$1")" | ||
13 | cat > "''${file}" | ||
14 | if ! ffmpeg -v warning -i "''${file}" -c copy "''${file2}" 2>&1 </dev/null; then | ||
15 | echo "Download of ''${file} failed" | ||
16 | rm -f "''${nFile}" "''${file}" "''${file2}" | ||
17 | exit 1 | ||
18 | else | ||
19 | rm -f "''${file}" | ||
20 | mv "''${file2}" "''${nFile}" | ||
21 | fi | ||
22 | ''; | ||