diff --git a/default.nix b/default.nix index 3f1dbf3..4042c33 100644 --- a/default.nix +++ b/default.nix @@ -26,10 +26,10 @@ stdenv.mkDerivation rec { # steam ]; - patches = [ - ./patches/dont-hardcode-zenity.patch - ./patches/dont-write-desktop-entry-during-runtime.patch - ./patches/dont-check-map-count.patch + patches = lib.pipe ./patches [ + builtins.readDir + lib.attrNames + (map (name: ./patches/${name})) ]; installPhase = '' diff --git a/flake.lock b/flake.lock index c008074..44423a4 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "dzgui": { "flake": false, "locked": { - "lastModified": 1688648849, - "narHash": "sha256-JEuR01KagfEVfg0BD8a/UwhNas91IbvWucXMbVy2VzA=", + "lastModified": 1690331564, + "narHash": "sha256-fh4KkC36dfhLCurbpdcWIitEu1tFUwrNRciApTTf5OU=", "owner": "aclist", "repo": "dztui", - "rev": "a95230be23dd9fa4738e70ea4df3016c4b073e85", + "rev": "08669fa435dd0114f127e642d16e61c43b435da2", "type": "github" }, "original": { @@ -18,16 +18,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1690031011, - "narHash": "sha256-kzK0P4Smt7CL53YCdZCBbt9uBFFhE0iNvCki20etAf4=", + "lastModified": 1691592289, + "narHash": "sha256-Lqpw7lrXlLkYra33tp57ms8tZ0StWhbcl80vk4D90F8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "12303c652b881435065a98729eb7278313041e49", + "rev": "9034b46dc4c7596a87ab837bb8a07ef2d887e8c7", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-unstable", + "ref": "release-23.05", "type": "indirect" } }, diff --git a/flake.nix b/flake.nix index fddec2a..473dabc 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "DayZ TUI/GUI server browser"; inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; + nixpkgs.url = "nixpkgs/release-23.05"; dzgui = { url = "github:aclist/dztui"; flake = false; diff --git a/patches/dont-hardcode-zenity.patch b/patches/0001-don-t-hardcode-zenity.patch similarity index 50% rename from patches/dont-hardcode-zenity.patch rename to patches/0001-don-t-hardcode-zenity.patch index 191d10f..8a9e767 100644 --- a/patches/dont-hardcode-zenity.patch +++ b/patches/0001-don-t-hardcode-zenity.patch @@ -1,13 +1,25 @@ +From cf6849bbc18d3be5322a2c5db8399f99f6dfb450 Mon Sep 17 00:00:00 2001 +From: lelgenio +Date: Wed, 17 May 2023 22:47:53 -0300 +Subject: [PATCH 1/3] don't hardcode zenity + +--- + dzgui.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + diff --git a/dzgui.sh b/dzgui.sh -index 6f98976..8293d45 100755 +index a638903..ede9b1e 100755 --- a/dzgui.sh +++ b/dzgui.sh -@@ -37,7 +37,7 @@ notify_url="$stable_url/helpers/d.html" +@@ -39,7 +39,7 @@ notify_url="$stable_url/helpers/d.html" notify_img_url="$stable_url/helpers/d.webp" forum_url="https://github.com/aclist/dztui/discussions" version_file="$config_path/versions" -steamsafe_zenity="/usr/bin/zenity" +steamsafe_zenity="zenity" - + #TODO: prevent connecting to offline servers #TODO: abstract zenity title params and dimensions +-- +2.40.1 + diff --git a/patches/0002-don-t-check-map-count.patch b/patches/0002-don-t-check-map-count.patch new file mode 100644 index 0000000..34bf7cd --- /dev/null +++ b/patches/0002-don-t-check-map-count.patch @@ -0,0 +1,25 @@ +From 036c8e3891adc5fa848f4a8ae2ef5d3ebf450a30 Mon Sep 17 00:00:00 2001 +From: lelgenio +Date: Wed, 17 May 2023 22:36:46 -0300 +Subject: [PATCH 2/3] don't check map count + +--- + dzgui.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dzgui.sh b/dzgui.sh +index ede9b1e..a3105ba 100755 +--- a/dzgui.sh ++++ b/dzgui.sh +@@ -1891,7 +1891,7 @@ initial_setup(){ + watcher_deps + check_architecture + check_version +- check_map_count ++ # check_map_count + fetch_helpers + config + steam_deps +-- +2.40.1 + diff --git a/patches/0003-don-t-check-version.patch b/patches/0003-don-t-check-version.patch new file mode 100644 index 0000000..8500feb --- /dev/null +++ b/patches/0003-don-t-check-version.patch @@ -0,0 +1,133 @@ +From bb2598d7f9f07489a3ddf67943389ea44bef36e0 Mon Sep 17 00:00:00 2001 +From: lelgenio +Date: Wed, 9 Aug 2023 23:06:14 -0300 +Subject: [PATCH 3/3] don't check version + +--- + dzgui.sh | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +diff --git a/dzgui.sh b/dzgui.sh +index a3105ba..96419f3 100755 +--- a/dzgui.sh ++++ b/dzgui.sh +@@ -373,7 +373,7 @@ config(){ + fi + + } +-steam_deck_mods(){ ++steam_deck_mods(){ + until [[ -z $diff ]]; do + next=$(echo -e "$diff" | head -n1) + $steamsafe_zenity --question --ok-label="Open" --cancel-label="Cancel" --title="DZGUI" --text="Missing mods. Click [Open] to open mod $next in Steam Workshop and subscribe to it by clicking the green Subscribe button. After the mod is downloaded, return to this menu to continue validation." --width=500 2>/dev/null +@@ -402,7 +402,7 @@ foreground(){ + if [[ $(command -v wmctrl) ]]; then + wmctrl -a "DZG Watcher" + else +- ++ + local window_id=$(xdotool search --name "DZG Watcher") + xdotool windowactivate $window_id + fi +@@ -414,7 +414,7 @@ manual_mod_install(){ + else + local ex="/tmp/dzc.tmp" + [[ -f $ex ]] && rm $ex +- watcher(){ ++ watcher(){ + readarray -t stage_mods <<< "$diff" + for((i=0;i<${#stage_mods[@]};i++)); do + [[ -f $ex ]] && return 1 +@@ -763,7 +763,7 @@ test_bm_api(){ + -d "filter[game]=$game" | grep -E "^HTTP") + [[ $code =~ 401 ]] && echo 1 + [[ $code =~ 200 ]] && echo 0 +- ++ + } + add_steam_api(){ + [[ $(test_steam_api) -eq 1 ]] && return 1 +@@ -1265,7 +1265,7 @@ exclude_empty(){ + filter_maps(){ + echo "# Filtering maps" + [[ $ret -eq 98 ]] && return +- local maps=$(echo "$response" | jq -r '.[].map//empty|ascii_downcase' | sort -u) ++ local maps=$(echo "$response" | jq -r '.[].map//empty|ascii_downcase' | sort -u) + local map_ct=$(echo "$maps" | wc -l) + local map_sel=$(echo "$maps" | $steamsafe_zenity --list --column="Check" --width=1200 --height=800 2>/dev/null --title="DZGUI" --text="Found $map_ct map types") + echo "[DZGUI] Selected '$map_sel'" +@@ -1300,7 +1300,7 @@ local_latlon(){ + else + local local_ip=$(dig +short myip.opendns.com @resolver1.opendns.com) + fi +- local url="http://ip-api.com/json/$local_ip" ++ local url="http://ip-api.com/json/$local_ip" + local res=$(curl -Ls "$url" | jq -r '"\(.lat),\(.lon)"') + local_lat=$(echo "$res" | awk -F, '{print $1}') + local_lon=$(echo "$res" | awk -F, '{print $2}') +@@ -1357,7 +1357,7 @@ check_geo_file(){ + echo "100" + } + run > >($steamsafe_zenity --pulsate --progress --auto-close --width=500 2>/dev/null) +- fi ++ fi + } + choose_filters(){ + if [[ $is_steam_deck -eq 0 ]]; then +@@ -1367,7 +1367,7 @@ choose_filters(){ + if [[ $sels =~ Keyword ]]; then + search=$($steamsafe_zenity --entry --text="Search (case insensitive)" --width=500 --title="DZGUI" 2>/dev/null | awk '{print tolower($0)}') + [[ -z $search ]] && { ret=97; return; } +- fi ++ fi + [[ -z $sels ]] && return + filters=$(echo "$sels" | sed 's/|/, /g;s/ (untick to select from map list)//') + } +@@ -1406,7 +1406,7 @@ write_fifo(){ + for((i=0;i<${#qport[@]};i++)); do + printf "%s\n%s\n%s\n%03d\n%03d\n%s\n%s:%s\n%s\n" "${map[$i]}" "${name[$i]}" "${gametime[$i]}" \ + "${players[$i]}" "${max[$i]}" "$(get_dist ${addr[$i]})" "${addr[$i]}" "${gameport[$i]}" "${qport[$i]}" >> $fifo +- done ++ done + } + munge_servers(){ + if [[ ! "$sels" =~ "All maps" ]]; then +@@ -1439,7 +1439,7 @@ munge_servers(){ + if [[ $is_steam_deck -eq 0 ]]; then + sd_res="--width=1920 --height=1080" + fi +- ++ + write_fifo & + pid=$! + local sel=$($steamsafe_zenity --text="$(pagination)" --title="DZGUI" --list --column=Map --column=Name --column=Gametime --column=Players --column=Max --column=Distance --column=IP --column=Qport $sd_res --print-column=7,8 --separator=%% 2>/dev/null < <(while true; do cat $fifo; done)) +@@ -1582,7 +1582,7 @@ check_ping(){ + ms=$(ping -c 1 -W 1 "$ping_ip" | awk -Ftime= '/time=/ {print $2}') + if [[ -z $ms ]]; then + echo "Timeout" +- else ++ else + echo "$ms" + fi + } +@@ -1794,7 +1794,7 @@ check_map_count(){ + local pass + logger INFO "Prompting user for sudo escalation" + pass=$($steamsafe_zenity --password) +- local rc ++ local rc + logger INFO "Return code is $rc" + [[ $rc -eq 1 ]] && exit 1 + local ct=$(sudo -S <<< "$pass" sh -c "sysctl -q vm.max_map_count | awk -F'= ' '{print \$2}'") +@@ -1890,7 +1890,7 @@ initial_setup(){ + run_depcheck + watcher_deps + check_architecture +- check_version ++ # check_version + # check_map_count + fetch_helpers + config +-- +2.40.1 + diff --git a/patches/dont-check-map-count.patch b/patches/dont-check-map-count.patch deleted file mode 100644 index 1924dfe..0000000 --- a/patches/dont-check-map-count.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/dzgui.sh b/dzgui.sh -index cbd49c2..d61b716 100755 ---- a/dzgui.sh -+++ b/dzgui.sh -@@ -1850,7 +1850,7 @@ initial_setup(){ - watcher_deps - check_architecture - check_version -- check_map_count -+ # check_map_count - fetch_helpers - config - steam_deps diff --git a/patches/dont-write-desktop-entry-during-runtime.patch b/patches/dont-write-desktop-entry-during-runtime.patch deleted file mode 100644 index 6314d4c..0000000 --- a/patches/dont-write-desktop-entry-during-runtime.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/dzgui.sh b/dzgui.sh -index d61b716..6f98976 100755 ---- a/dzgui.sh -+++ b/dzgui.sh -@@ -214,6 +214,7 @@ Categories=Game - END - } - freedesktop_dirs(){ -+ return - mkdir -p "$sd_install_path" - mkdir -p "$freedesktop_path" - #TODO: update url