Created
November 17, 2020 11:02
-
-
Save brainrake/e4377866028682050682d2d88c7c13a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs ? import <nixpkgs> {}, ... }: | |
let | |
openwrt-archer-c7-v5-factory = pkgs.fetchurl { | |
url = "http://downloads.openwrt.org/releases/19.07.2/targets/ath79/generic/openwrt-19.07.2-ath79-generic-tplink_archer-c7-v5-squashfs-factory.bin"; | |
sha256 = ""; | |
}; | |
openwrt-archer-c7-v5-sysupgrade = pkgs.fetchurl { | |
url = "http://downloads.openwrt.org/releases/19.07.2/targets/ath79/generic/openwrt-19.07.2-ath79-generic-tplink_archer-c7-v5-squashfs-factory.bin"; | |
sha256 = ""; | |
}; | |
target = "[email protected]"; | |
deploy = pkgs.writeShellScriptBin "deploy" '' | |
set -e | |
TARGET=${target} | |
tar --owner=0 --group=0 -czvf etc.tgz etc | |
scp etc.tgz $TARGET: | |
ssh $TARGET 'sysupgrade --restore-backup etc.tgz && service network reload' | |
''; | |
flash = pkgs.writeShellScriptBin "flash" '' | |
set -e | |
ssh [email protected] 'opam update && opam install luci-app-wireguard' | |
''; | |
backup = pkgs.writeShellScriptBin "backup" '' | |
TARGET=${target} | |
ssh $TARGET 'sysupgrade -k --create-backup -' > etc.tgz | |
tar -xzvf etc.tgz | |
# rsync | |
''; | |
update = pkgs.writeShellScriptBin "update" '' | |
echo TODO | |
# niv update | |
''; | |
in | |
pkgs.mkShell rec { | |
name = "i-wart-deploy"; | |
buildInputs = [ deploy backup update ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment