Configuration for my NixOS based systems and Home Manager
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add script to update plex

+38
+1
default-home.nix
··· 56 56 bubblewrap 57 57 unstable.delta 58 58 unstable.difftastic 59 + unstable.jq 59 60 60 61 # Dev tools 61 62 gcc
+37
scripts/update-plex.rcsh
··· 1 + #!/usr/bin/env rc 2 + 3 + flag e + 4 + 5 + flake=`{realpath `{dirname $0}^/../flake.nix} 6 + 7 + echo Fetching latest Plex version... 8 + version=`{curl -fsSL https://plex.tv/api/downloads/5.json | jq -r '.computer.Linux.version'} 9 + 10 + if (~ $version () null) { 11 + echo Failed to determine latest Plex version >[1=2] 12 + exit 1 13 + } 14 + 15 + url=https://downloads.plex.tv/plex-media-server-new/$version/debian/plexmediaserver_$version^_amd64.deb 16 + echo Latest version: $version 17 + echo URL: $url 18 + 19 + echo Prefetching hash... 20 + sha256=`{nix-prefetch-url --type sha256 $url} 21 + hash=`{nix hash to-sri --type sha256 $sha256 | sed 's/^sha256-//'} 22 + echo Hash: $hash 23 + 24 + current_version=`{grep -oP '(?<=version = ")[^"]+(?=";)' $flake | head -n1} 25 + current_hash=`{grep -oP '(?<=sha256 = ")[^"]+(?=";)' $flake | head -n1} 26 + 27 + if (~ $current_version $version) { 28 + echo Already on $version -- nothing to do. 29 + exit 0 30 + } 31 + 32 + sed -i \ 33 + -e 's|version = "'$current_version'";|version = "'$version'";|' \ 34 + -e 's|sha256 = "'$current_hash'";|sha256 = "'$hash'";|' \ 35 + $flake 36 + 37 + echo Updated flake.nix: $current_version '->' $version