From d3b2f98b54bee038ce048d22a1bc41e9e9a4def6 Mon Sep 17 00:00:00 2001 From: PhysShell <45852143+PhysShell@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:54:59 +0500 Subject: [PATCH 1/6] update 5.2.4 -> 5.3.2 --- default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 9932203..3d1284d 100644 --- a/default.nix +++ b/default.nix @@ -13,13 +13,13 @@ }: stdenv.mkDerivation rec { pname = "dzgui"; - version = "5.2.4"; + version = "5.3.2"; src = fetchFromGitHub { owner = "aclist"; repo = "dztui"; rev = "release/${version}"; - sha256 = "sha256-fBsowbZPH5KgVvvrnxzdA2oEeEd802jt27yySrLgNqM="; + sha256 = "sha256-bTn5O/NhrP0zwmOlvSLofYzB6PifXYT1KCF2MErRFZo="; }; postPatch = '' From 36b7c8eb1dd66fadaa0b3f4b4b5a0a5e3f0fbe7d Mon Sep 17 00:00:00 2001 From: lelgenio Date: Fri, 5 Jul 2024 14:10:39 -0300 Subject: [PATCH 2/6] track releases using commit hash, add update script --- default.nix | 82 ++------------------------ flake.nix | 2 +- package/default.nix | 80 +++++++++++++++++++++++++ dzgui.desktop => package/dzgui.desktop | 0 package/update.sh | 16 +++++ 5 files changed, 101 insertions(+), 79 deletions(-) create mode 100644 package/default.nix rename dzgui.desktop => package/dzgui.desktop (100%) create mode 100755 package/update.sh diff --git a/default.nix b/default.nix index 3d1284d..a7d9fa3 100644 --- a/default.nix +++ b/default.nix @@ -1,80 +1,6 @@ -{ lib -, stdenv -, fetchFromGitHub -, makeWrapper -, curl -, jq -, python3 -, wmctrl -, xdotool -, gnome -, gobject-introspection -, wrapGAppsHook +{ + pkgs ? import { }, }: -stdenv.mkDerivation rec { - pname = "dzgui"; - version = "5.3.2"; - - src = fetchFromGitHub { - owner = "aclist"; - repo = "dztui"; - rev = "release/${version}"; - sha256 = "sha256-bTn5O/NhrP0zwmOlvSLofYzB6PifXYT1KCF2MErRFZo="; - }; - - postPatch = '' - sed -i 's@/usr/bin/zenity@zenity@g' dzgui.sh - sed -i '/ check_map_count/d' dzgui.sh - sed -i '/ check_version/d' dzgui.sh - sed -i '/ write_desktop_file >/d' dzgui.sh - ''; - - nativeBuildInputs = [ - makeWrapper - gobject-introspection - wrapGAppsHook - ]; - - runtimeDeps = [ - curl - jq - (python3.withPackages (p: with p; [ - pygobject3 - ])) - - wmctrl - xdotool - gnome.zenity - - ## Here we don't declare steam as a dependency because - ## we could either use the native or flatpack version - ## and also so this does not become a non-free package - # steam - ]; - - installPhase = '' - install -DT dzgui.sh $out/bin/dzgui - - install -DT ${./dzgui.desktop} $out/share/applications/dzgui.desktop - install -DT images/dzgui $out/share/icons/hicolor/256x256/apps/dzgui.png - ''; - - preFixup = '' - gappsWrapperArgs+=( - --prefix PATH ':' ${lib.makeBinPath runtimeDeps} - ) - ''; - - meta = with lib; { - homepage = "https://github.com/pronovic/banner"; - description = "DayZ TUI/GUI server browser"; - license = licenses.gpl3; - - longDescription = '' - DZGUI allows you to connect to both official and modded/community DayZ - servers on Linux and provides a graphical interface for doing so. - ''; - - platforms = platforms.all; - }; +{ + dzgui = pkgs.callPackage ./package { }; } diff --git a/flake.nix b/flake.nix index 4c315d0..22359e7 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ overlays = { default = (final: _: { - dzgui = (final.callPackage ./. { }); + dzgui = (final.callPackage ./package { }); }); }; diff --git a/package/default.nix b/package/default.nix new file mode 100644 index 0000000..8d38801 --- /dev/null +++ b/package/default.nix @@ -0,0 +1,80 @@ +{ lib +, stdenv +, fetchFromGitHub +, makeWrapper +, curl +, jq +, python3 +, wmctrl +, xdotool +, gnome +, gobject-introspection +, wrapGAppsHook +}: +stdenv.mkDerivation rec { + pname = "dzgui"; + version = "5.3.1"; + + src = fetchFromGitHub { + owner = "aclist"; + repo = "dztui"; + rev = "8e6cf7e7925c6e6bc390a10d286ba1e7b2562d08"; + sha256 = "sha256-+FlAYTDpjDDmCAFxgmgHVnXGcIw63e5ia38zKbYI2ZI="; + }; + + postPatch = '' + sed -i 's@/usr/bin/zenity@zenity@g' dzgui.sh + sed -i '/ check_map_count/d' dzgui.sh + sed -i '/ check_version/d' dzgui.sh + sed -i '/ write_desktop_file >/d' dzgui.sh + ''; + + nativeBuildInputs = [ + makeWrapper + gobject-introspection + wrapGAppsHook + ]; + + runtimeDeps = [ + curl + jq + (python3.withPackages (p: with p; [ + pygobject3 + ])) + + wmctrl + xdotool + gnome.zenity + + ## Here we don't declare steam as a dependency because + ## we could either use the native or flatpack version + ## and also so this does not become a non-free package + # steam + ]; + + installPhase = '' + install -DT dzgui.sh $out/bin/dzgui + + install -DT ${./dzgui.desktop} $out/share/applications/dzgui.desktop + install -DT images/dzgui $out/share/icons/hicolor/256x256/apps/dzgui.png + ''; + + preFixup = '' + gappsWrapperArgs+=( + --prefix PATH ':' ${lib.makeBinPath runtimeDeps} + ) + ''; + + meta = with lib; { + homepage = "https://github.com/pronovic/banner"; + description = "DayZ TUI/GUI server browser"; + license = licenses.gpl3; + + longDescription = '' + DZGUI allows you to connect to both official and modded/community DayZ + servers on Linux and provides a graphical interface for doing so. + ''; + + platforms = platforms.all; + }; +} diff --git a/dzgui.desktop b/package/dzgui.desktop similarity index 100% rename from dzgui.desktop rename to package/dzgui.desktop diff --git a/package/update.sh b/package/update.sh new file mode 100755 index 0000000..880a8f4 --- /dev/null +++ b/package/update.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq ripgrep common-updater-scripts + +set -xe + +latest_commit="$( + curl -L -s ${GITHUB_TOKEN:+-u ":${GITHUB_TOKEN}"} https://api.github.com/repos/aclist/dztui/branches/master \ + | jq -r .commit.sha +)" + +version="$( + curl https://raw.githubusercontent.com/aclist/dztui/$latest_commit/dzgui.sh \ + | rg '^version=(.*)$' --replace '$1' +)" + +update-source-version dzgui "$version" --rev=$latest_commit From b041afa37403be08e6b6ab31d072ab19d373e34d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Fri, 5 Jul 2024 14:19:30 -0300 Subject: [PATCH 3/6] Create build Action --- .github/workflows/build.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..54a0d7c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,18 @@ +name: build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - run: nix build -L From ea1dbe1c7a136f0cffea7f90cae20b75e77b0503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Fri, 5 Jul 2024 14:44:12 -0300 Subject: [PATCH 4/6] Create update Action --- .github/workflows/update.yml | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/update.yml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..6e51e1d --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,44 @@ +name: Update + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: 'outdated' + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Install jq + run: nix profile install nixpkgs#jq + - name: Get current version + id: current-version + run: nix-instantiate --eval --json -A dzgui.version | jq -r '"version=\"\(.)\""' >> $GITHUB_OUTPUT + - name: Run update script + run: ./package/update.sh + - name: Get new version + id: new-version + run: nix-instantiate --eval --json -A dzgui.version | jq -r '"version=\"\(.)\""' >> $GITHUB_OUTPUT + - name: Check for changes + id: git-check + run: | + git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT + - name: Build new package + run: nix build -L + - name: Create Pull Request + if: ${{ steps.current-version.outputs.version != steps.new-version.outputs.version }} + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.BOT_TOKEN }} + base: outdated + add-paths: ./package/ + commit-message: update ${{ steps.current-version.outputs.version }} -> ${{ steps.new-version.outputs.version }} + title: '[Automated] Update dzgui ${{ steps.new-version.outputs.version }}' + body: 'Automated changes by GitHub Actions' + branch: automated-update + delete-branch: true From 592193244bcf9fb787d719505ca637b93db4f177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Fri, 5 Jul 2024 15:02:21 -0300 Subject: [PATCH 5/6] Update update.yml --- .github/workflows/update.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 6e51e1d..eb61990 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -34,7 +34,6 @@ jobs: if: ${{ steps.current-version.outputs.version != steps.new-version.outputs.version }} uses: peter-evans/create-pull-request@v5 with: - token: ${{ secrets.BOT_TOKEN }} base: outdated add-paths: ./package/ commit-message: update ${{ steps.current-version.outputs.version }} -> ${{ steps.new-version.outputs.version }} From eca167dfeb156f1d03eb44f63f92ece0b29872ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Fri, 5 Jul 2024 15:18:13 -0300 Subject: [PATCH 6/6] Update update.yml --- .github/workflows/update.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index eb61990..efdfb09 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -1,4 +1,4 @@ -name: Update +name: update on: schedule: @@ -10,8 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: 'outdated' - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - name: Install jq @@ -34,7 +32,7 @@ jobs: if: ${{ steps.current-version.outputs.version != steps.new-version.outputs.version }} uses: peter-evans/create-pull-request@v5 with: - base: outdated + base: main add-paths: ./package/ commit-message: update ${{ steps.current-version.outputs.version }} -> ${{ steps.new-version.outputs.version }} title: '[Automated] Update dzgui ${{ steps.new-version.outputs.version }}'