2023-10-12 13:58:03 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
parseNurl() {
|
2023-12-03 21:35:30 -05:00
|
|
|
REV=$(nurl -j "$1" | jq '.["args"].["rev"]')
|
|
|
|
HASH=$(nurl -j "$1" | jq '.["args"].["hash"]')
|
2023-10-12 13:58:03 -04:00
|
|
|
|
2023-12-03 21:35:30 -05:00
|
|
|
sed -i "s,rev = .*,rev = $REV;," "$2"
|
|
|
|
sed -i "s,hash = .*,hash = $HASH;," "$2"
|
2023-10-12 13:58:03 -04:00
|
|
|
}
|
|
|
|
|
2023-12-13 19:10:25 -05:00
|
|
|
parseFetchurl() {
|
|
|
|
URL="$1"
|
|
|
|
FILE="$2"
|
|
|
|
HASH="$(nix store prefetch-file --refresh --json \
|
|
|
|
--hash-type sha256 "$URL" --name "escaped" | jq -r .hash)"
|
|
|
|
|
|
|
|
sed -i "s,url = .*,url = \"$URL\";," "$FILE"
|
|
|
|
sed -i "s,hash = .*,hash = \"$HASH\";," "$FILE"
|
2023-12-13 19:15:55 -05:00
|
|
|
|
|
|
|
# For Firefox addons
|
|
|
|
sed -i "s,sha256 = .*,sha256 = \"$HASH\";," "$FILE"
|
2023-12-13 19:10:25 -05:00
|
|
|
}
|
|
|
|
|
2023-10-12 13:58:03 -04:00
|
|
|
|
2023-12-13 19:23:34 -05:00
|
|
|
updateOverlays() {
|
|
|
|
FILE="/home/matt/.nix/common/overlays"
|
|
|
|
parseNurl "https://github.com/dasJ/spotifywm" "$FILE/spotifywm/spotifywm.nix"
|
|
|
|
}
|
2023-10-12 13:58:03 -04:00
|
|
|
|
2023-12-13 19:10:25 -05:00
|
|
|
updateDracula() {
|
|
|
|
FILE="/home/matt/.nix/common/overlays/dracula-theme"
|
|
|
|
parseNurl "https://github.com/matt1432/bat" "$FILE/bat.nix"
|
|
|
|
parseNurl "https://github.com/dracula/gtk" "$FILE/default.nix"
|
|
|
|
parseNurl "https://github.com/dracula/plymouth" "$FILE/plymouth.nix"
|
|
|
|
parseNurl "https://github.com/dracula/git" "$FILE/git.nix"
|
|
|
|
parseNurl "https://github.com/dracula/xresources" "$FILE/xresources.nix"
|
|
|
|
parseFetchurl "https://github.com/aynp/dracula-wallpapers/blob/main/Art/4k/Waves%201.png?raw=true" "$FILE/wallpaper.nix"
|
|
|
|
}
|
|
|
|
|
2023-12-13 19:23:34 -05:00
|
|
|
updateCustomPkgs() {
|
|
|
|
FILE="/home/matt/.nix/common/pkgs"
|
|
|
|
parseNurl "https://github.com/tio/input-emulator" "$FILE/input-emulator/default.nix"
|
|
|
|
parseNurl "https://gitlab.com/mishakmak/pam-fprint-grosshack" "$FILE/pam-fprint-grosshack/default.nix"
|
|
|
|
parseNurl "https://gitlab.com/phoneybadger/pokemon-colorscripts" "$FILE/pokemon-colorscripts/default.nix"
|
|
|
|
}
|
|
|
|
|
2023-12-13 16:53:40 -05:00
|
|
|
updateFFZ() {
|
|
|
|
FILE="/home/matt/.nix/home/firefox/addons/default.nix"
|
|
|
|
URL="https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi"
|
|
|
|
|
2023-12-13 19:10:25 -05:00
|
|
|
parseFetchurl "$URL" "$FILE"
|
2023-12-13 16:53:40 -05:00
|
|
|
}
|
|
|
|
|
2023-10-12 13:58:03 -04:00
|
|
|
updateFirefoxAddons() {
|
|
|
|
echo "Updating firefox addons using mozilla-addons-to-nix"
|
|
|
|
|
2023-12-03 21:35:30 -05:00
|
|
|
(cd /home/matt/.nix/home/firefox/addons || return;
|
2023-10-12 13:58:03 -04:00
|
|
|
|
2023-12-03 21:35:30 -05:00
|
|
|
file=generated-firefox-addons.nix
|
|
|
|
if [[ -f $file ]]; then
|
|
|
|
printf "\nOld versions: \n"
|
2023-10-12 13:58:03 -04:00
|
|
|
|
2023-12-03 21:35:30 -05:00
|
|
|
grep -A 1 --no-group-separator 'pname' "$file" |
|
|
|
|
awk '{ gsub(/"/, ""); gsub(/;/, ""); print $3 }' |
|
|
|
|
awk 'NR%2{printf $0" version ";next;}1' | paste -sd'\n' -
|
2023-10-12 13:58:03 -04:00
|
|
|
|
2023-12-03 21:35:30 -05:00
|
|
|
printf "\nNew versions: \n"
|
|
|
|
fi
|
2023-10-12 13:58:03 -04:00
|
|
|
|
2023-12-03 21:35:30 -05:00
|
|
|
mozilla-addons-to-nix addons.json generated-firefox-addons.nix)
|
2023-10-12 13:58:03 -04:00
|
|
|
}
|
|
|
|
|
2023-12-09 20:29:33 -05:00
|
|
|
updateGSR() {
|
|
|
|
(
|
|
|
|
cd /tmp || return
|
|
|
|
|
|
|
|
git clone https://repo.dec05eba.com/gpu-screen-recorder
|
|
|
|
cd gpu-screen-recorder || return
|
|
|
|
|
|
|
|
REV=$(printf "r%s.%s\n" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)")
|
|
|
|
URL=https://dec05eba.com/snapshot/gpu-screen-recorder.git."$REV".tar.gz
|
|
|
|
FILE="/home/matt/.nix/devices/binto/modules/gpu-replay.nix"
|
2023-12-13 19:10:25 -05:00
|
|
|
|
|
|
|
parseFetchurl "$URL" "$FILE"
|
2023-12-09 20:29:33 -05:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2023-12-13 19:23:34 -05:00
|
|
|
|
2023-10-12 13:58:03 -04:00
|
|
|
doAll() {
|
2023-12-13 16:53:40 -05:00
|
|
|
updateFFZ
|
2023-12-13 19:23:34 -05:00
|
|
|
updateCustomPkgs
|
|
|
|
updateOverlays
|
2023-12-13 19:10:25 -05:00
|
|
|
updateDracula
|
2023-10-12 13:58:03 -04:00
|
|
|
updateFirefoxAddons
|
2023-12-09 20:29:33 -05:00
|
|
|
updateGSR
|
2023-10-12 13:58:03 -04:00
|
|
|
}
|
|
|
|
|
2023-12-13 19:23:34 -05:00
|
|
|
|
2023-10-12 13:58:03 -04:00
|
|
|
[[ "$1" == "-a" || "$1" == "--all" ]] && doAll
|
2023-12-13 19:10:25 -05:00
|
|
|
[[ "$1" == "-d" || "$1" == "--dracula" ]] && updateDracula
|
2023-12-13 19:23:34 -05:00
|
|
|
[[ "$1" == "-c" || "$1" == "--custom" ]] && updateCustomPkgs
|
|
|
|
[[ "$1" == "-o" || "$1" == "--overlays" ]] && updateOverlays
|
2023-10-12 13:58:03 -04:00
|
|
|
[[ "$1" == "-f" || "$1" == "--firefox" ]] && updateFirefoxAddons
|
2023-12-13 16:53:40 -05:00
|
|
|
[[ "$1" == "-ffz" || "$1" == "--frankerfacez" ]] && updateFFZ
|
2023-12-09 20:29:33 -05:00
|
|
|
[[ "$1" == "-gsr" || "$1" == "--gpu-screen-recorder" ]] && updateGSR
|
2023-12-03 21:35:30 -05:00
|
|
|
|
|
|
|
alejandra /home/matt/.nix
|