feat(update script): add dracula updating

This commit is contained in:
matt1432 2023-12-13 19:10:25 -05:00
parent 9d7500c13a
commit 21ff731859
2 changed files with 27 additions and 18 deletions

View file

@ -9,8 +9,8 @@
src = prev.fetchFromGitHub {
owner = "dracula";
repo = "gtk";
rev = "84dd7a3021938ceec8a0ee292a8561f8a6d47ebe";
hash = "sha256-xHf+f0RGMtbprJX+3c0cmp5LKkf0V7BHKcoiAW60du8=";
rev = "0b64e1108f4a222d40b333435a41d9f1963a3326";
hash = "sha256-SQHfHNE6OURAPYX5+0WLkm2sivWIrP0mMgkU+GZCCho=";
};
installPhase = ''

View file

@ -8,29 +8,39 @@ parseNurl() {
sed -i "s,hash = .*,hash = $HASH;," "$2"
}
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"
}
# TODO
# https://github.com/dracula/xresources
#
# https://github.com/dracula/gtk
# https://github.com/dracula/plymouth
# https://github.com/matt1432/bat
#
# https://github.com/aynp/dracula-wallpapers/blob/main/Art/4k/Waves%201.png?raw=true
#
# https://github.com/dasJ/spotifywm
#
# https://github.com/tio/input-emulator
# https://gitlab.com/mishakmak/pam-fprint-grosshack
# https://gitlab.com/phoneybadger/pokemon-colorscripts
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"
}
updateFFZ() {
FILE="/home/matt/.nix/home/firefox/addons/default.nix"
URL="https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi"
HASH=$(nix store prefetch-file --refresh --json \
--hash-type sha256 $URL | jq -r .hash)
sed -i "s,sha256 = .*,sha256 = \"$HASH\";," "$FILE"
parseFetchurl "$URL" "$FILE"
}
updateFirefoxAddons() {
@ -61,22 +71,21 @@ updateGSR() {
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
HASH="$(nix store prefetch-file --refresh --json \
--hash-type sha256 $URL | jq -r .hash)"
FILE="/home/matt/.nix/devices/binto/modules/gpu-replay.nix"
sed -i "s,url = .*,url = \"$URL\";," "$FILE"
sed -i "s,hash = .*,hash = \"$HASH\";," "$FILE"
parseFetchurl "$URL" "$FILE"
)
}
doAll() {
updateFFZ
updateDracula
updateFirefoxAddons
updateGSR
}
[[ "$1" == "-a" || "$1" == "--all" ]] && doAll
[[ "$1" == "-d" || "$1" == "--dracula" ]] && updateDracula
[[ "$1" == "-f" || "$1" == "--firefox" ]] && updateFirefoxAddons
[[ "$1" == "-ffz" || "$1" == "--frankerfacez" ]] && updateFFZ
[[ "$1" == "-gsr" || "$1" == "--gpu-screen-recorder" ]] && updateGSR