mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-20 06:56:17 -05:00
fix(nix): align prebuilt runtime dependencies (#651)
Use raw release-asset hashes, keep the Nixpkgs lock current, and validate the prebuilt package across supported Nixpkgs branches and architectures. [skip ci]
This commit is contained in:
1 parent
f9f9dd8abe
commit
87f91e3c13
6 files changed
+74
-31
No files matched your search
@@ -24,6 +24,11 @@ jobs:
|
|||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
|
|
||||||
|
- name: Update Nixpkgs lock
|
||||||
|
run: |
|
||||||
|
nix flake update nixpkgs \
|
||||||
|
--extra-experimental-features "nix-command flakes"
|
||||||
|
|
||||||
- name: Update flake hashes
|
- name: Update flake hashes
|
||||||
env:
|
env:
|
||||||
RELEASE_VERSION: ${{ inputs.version }}
|
RELEASE_VERSION: ${{ inputs.version }}
|
||||||
@@ -39,7 +44,9 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: updated-flake
|
name: updated-flake
|
||||||
path: flake.nix
|
path: |
|
||||||
|
flake.nix
|
||||||
|
flake.lock
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
validate-nix-prebuilt:
|
validate-nix-prebuilt:
|
||||||
@@ -49,21 +56,25 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- runner: ubuntu-latest
|
||||||
|
nixpkgs: locked
|
||||||
- runner: ubuntu-latest
|
- runner: ubuntu-latest
|
||||||
nixpkgs: nixos-25.11
|
nixpkgs: nixos-25.11
|
||||||
- runner: ubuntu-latest
|
- runner: ubuntu-latest
|
||||||
nixpkgs: nixos-26.05
|
nixpkgs: nixos-26.05
|
||||||
|
- runner: ubuntu-latest
|
||||||
|
nixpkgs: nixpkgs-unstable
|
||||||
- runner: ubuntu-24.04-arm
|
- runner: ubuntu-24.04-arm
|
||||||
nixpkgs: nixos-25.11
|
nixpkgs: nixos-25.11
|
||||||
- runner: ubuntu-24.04-arm
|
- runner: ubuntu-24.04-arm
|
||||||
nixpkgs: nixos-26.05
|
nixpkgs: nixos-26.05
|
||||||
|
- runner: ubuntu-24.04-arm
|
||||||
|
nixpkgs: nixpkgs-unstable
|
||||||
name: validate-nix-prebuilt (${{ matrix.nixpkgs }}, ${{ matrix.runner }})
|
name: validate-nix-prebuilt (${{ matrix.nixpkgs }}, ${{ matrix.runner }})
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout GlobalProtect-openconnect
|
- name: Checkout GlobalProtect-openconnect
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Download updated flake
|
- name: Download updated flake
|
||||||
uses: actions/download-artifact@v8
|
uses: actions/download-artifact@v8
|
||||||
@@ -75,11 +86,19 @@ jobs:
|
|||||||
uses: cachix/install-nix-action@v31
|
uses: cachix/install-nix-action@v31
|
||||||
|
|
||||||
- name: Build prebuilt Nix package
|
- name: Build prebuilt Nix package
|
||||||
|
env:
|
||||||
|
NIXPKGS: ${{ matrix.nixpkgs }}
|
||||||
run: |
|
run: |
|
||||||
nix build .#prebuilt \
|
if [[ "$NIXPKGS" == "locked" ]]; then
|
||||||
--override-input nixpkgs "github:NixOS/nixpkgs/${{ matrix.nixpkgs }}" \
|
nix build .#prebuilt \
|
||||||
--extra-experimental-features "nix-command flakes" \
|
--extra-experimental-features "nix-command flakes" \
|
||||||
--print-build-logs
|
--print-build-logs
|
||||||
|
else
|
||||||
|
nix build .#prebuilt \
|
||||||
|
--override-input nixpkgs "github:NixOS/nixpkgs/$NIXPKGS" \
|
||||||
|
--extra-experimental-features "nix-command flakes" \
|
||||||
|
--print-build-logs
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Inspect prebuilt Nix package
|
- name: Inspect prebuilt Nix package
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -246,7 +246,10 @@ Add the flake input and package to your `flake.nix`:
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
# ... other inputs
|
# ... other inputs
|
||||||
globalprotect-openconnect.url = "github:yuezk/GlobalProtect-openconnect";
|
globalprotect-openconnect = {
|
||||||
|
url = "github:yuezk/GlobalProtect-openconnect";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, globalprotect-openconnect, ... }:
|
outputs = { self, nixpkgs, globalprotect-openconnect, ... }:
|
||||||
|
|||||||
Generated
+3
-3
@@ -63,11 +63,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1766410818,
|
"lastModified": 1787964612,
|
||||||
"narHash": "sha256-ruVneSx6wFy5PMw1ow3BE+znl653TJ6+eeNUj4B/9y8=",
|
"narHash": "sha256-0N9nghg3nwzX6b6qc77EzjR9cu/Z+UR66FlfsCqiURs=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "3a7affa77a5a539afa1c7859e2c31abdb1aeadf3",
|
"rev": "e8be7818e19ada32105a8af937a6a473b38167ca",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -41,33 +41,55 @@
|
|||||||
rustc = toolchain;
|
rustc = toolchain;
|
||||||
};
|
};
|
||||||
|
|
||||||
src = pkgs.fetchzip {
|
unpackReleaseAsset =
|
||||||
|
{ name, archive }:
|
||||||
|
pkgs.runCommand name { nativeBuildInputs = [ pkgs.libarchive ]; } ''
|
||||||
|
mkdir -p "$out"
|
||||||
|
bsdtar --extract --file ${archive} --directory "$out" --strip-components 1
|
||||||
|
'';
|
||||||
|
|
||||||
|
sourceArchive = pkgs.fetchurl {
|
||||||
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect-${version}.tar.gz";
|
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect-${version}.tar.gz";
|
||||||
hash = "sha256-T4jze6/25YTsfuQdcuDfz3kX/ooDB1T0hnWsEBu4xMQ=";
|
hash = "sha256-VFWbF2BfJ9CtXkjQjkgmBGCZnYgB5ZLctqcqUKuhswg=";
|
||||||
|
};
|
||||||
|
|
||||||
|
src = unpackReleaseAsset {
|
||||||
|
name = "globalprotect-openconnect-${version}-source";
|
||||||
|
archive = sourceArchive;
|
||||||
};
|
};
|
||||||
|
|
||||||
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
|
cpu = pkgs.stdenv.hostPlatform.parsed.cpu.name;
|
||||||
|
|
||||||
gpguiHashes = {
|
gpguiHashes = {
|
||||||
x86_64 = "sha256-wPLsH/b/ZSo2pA/kU1HUGiQ98k8xSihyxGyf5o6tvyU=";
|
x86_64 = "sha256-uVn3hJkKrjKz3mzRamxFu+0rE7OjLtMlT16d14XPcq4=";
|
||||||
aarch64 = "sha256-WFyPhGD9fLAVYGeMSrMcZhSdfM99uVmWPrH68O+4BfE=";
|
aarch64 = "sha256-g4HKQwFAM4YCP+Afew1AhzC1wPrCS8ICw3GeA7KIeFU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
gpgui = pkgs.fetchzip {
|
gpguiArchive = pkgs.fetchurl {
|
||||||
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/gpgui_${cpu}.bin.tar.xz";
|
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/gpgui_${cpu}.bin.tar.xz";
|
||||||
hash = gpguiHashes.${cpu};
|
hash = gpguiHashes.${cpu};
|
||||||
};
|
};
|
||||||
|
|
||||||
binaryHashes = {
|
gpgui = unpackReleaseAsset {
|
||||||
x86_64 = "sha256-spaKxruu15ro5lir14nAfy8MPXNQhaoCXcG4PDZ9lfM=";
|
name = "gpgui-${version}-${cpu}";
|
||||||
aarch64 = "sha256-iu/zE4B4gjk1I5PQY0m/59ZoJ/k5focT0CxYYlJi7+A=";
|
archive = gpguiArchive;
|
||||||
};
|
};
|
||||||
|
|
||||||
binaryPackage = pkgs.fetchzip {
|
binaryHashes = {
|
||||||
|
x86_64 = "sha256-jgHZC00q+2GnO18/aPGONDCz2CeiF/e1DucefSacv2w=";
|
||||||
|
aarch64 = "sha256-FDCZN0bmKWKjPiF9wkRaqMUu0PfSVHDUveJVFts25qg=";
|
||||||
|
};
|
||||||
|
|
||||||
|
binaryArchive = pkgs.fetchurl {
|
||||||
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect_${version}_${cpu}.bin.tar.xz";
|
url = "https://github.com/yuezk/GlobalProtect-openconnect/releases/download/${releaseTag}/globalprotect-openconnect_${version}_${cpu}.bin.tar.xz";
|
||||||
hash = binaryHashes.${cpu};
|
hash = binaryHashes.${cpu};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
binaryPackage = unpackReleaseAsset {
|
||||||
|
name = "globalprotect-openconnect-${version}-${cpu}-binary";
|
||||||
|
archive = binaryArchive;
|
||||||
|
};
|
||||||
|
|
||||||
linuxRuntimeDependencies = with pkgs; [
|
linuxRuntimeDependencies = with pkgs; [
|
||||||
glib-networking
|
glib-networking
|
||||||
libayatana-appindicator
|
libayatana-appindicator
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ set -euo pipefail
|
|||||||
release_version="${1:-}"
|
release_version="${1:-}"
|
||||||
release_tag="${2:-}"
|
release_tag="${2:-}"
|
||||||
|
|
||||||
if git diff --quiet -- flake.nix; then
|
if git diff --quiet -- flake.nix flake.lock; then
|
||||||
echo "flake.nix hashes are already up to date"
|
echo "flake hashes and lock are already up to date"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -21,12 +21,12 @@ fi
|
|||||||
|
|
||||||
branch_suffix="v${version}"
|
branch_suffix="v${version}"
|
||||||
title="chore: update flake hashes for v${version}"
|
title="chore: update flake hashes for v${version}"
|
||||||
body="Updates the Nix flake fetchzip hashes for v${version} release assets."
|
body="Updates the Nix flake fetchurl hashes for v${version} release assets and refreshes the Nixpkgs lock."
|
||||||
|
|
||||||
if [[ "$release_tag" != "v$version" ]]; then
|
if [[ "$release_tag" != "v$version" ]]; then
|
||||||
branch_suffix="${branch_suffix}-${release_tag}"
|
branch_suffix="${branch_suffix}-${release_tag}"
|
||||||
title="chore: update flake hashes for v${version} from ${release_tag}"
|
title="chore: update flake hashes for v${version} from ${release_tag}"
|
||||||
body="Updates the Nix flake fetchzip hashes for v${version} using ${release_tag} release assets."
|
body="Updates the Nix flake fetchurl hashes for v${version} using ${release_tag} release assets and refreshes the Nixpkgs lock."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
@@ -37,7 +37,7 @@ if [[ "$release_tag" == "snapshot" ]]; then
|
|||||||
source_branch_slug="$(printf '%s' "$source_branch" | sed -E 's#[/[:space:]]+#-#g; s#[^A-Za-z0-9._-]##g; s#^-+##; s#-+$##')"
|
source_branch_slug="$(printf '%s' "$source_branch" | sed -E 's#[/[:space:]]+#-#g; s#[^A-Za-z0-9._-]##g; s#^-+##; s#-+$##')"
|
||||||
branch="chore/flake-${source_branch_slug}"
|
branch="chore/flake-${source_branch_slug}"
|
||||||
git switch -C "$branch"
|
git switch -C "$branch"
|
||||||
git add flake.nix
|
git add flake.nix flake.lock
|
||||||
git commit -m "$title"
|
git commit -m "$title"
|
||||||
git push --force origin "$branch"
|
git push --force origin "$branch"
|
||||||
echo "Updated snapshot flake hashes on branch $branch from $source_branch; skipping PR creation"
|
echo "Updated snapshot flake hashes on branch $branch from $source_branch; skipping PR creation"
|
||||||
@@ -47,12 +47,12 @@ fi
|
|||||||
branch="chore/update-flake-hashes-${branch_suffix}"
|
branch="chore/update-flake-hashes-${branch_suffix}"
|
||||||
|
|
||||||
git switch -C "$branch"
|
git switch -C "$branch"
|
||||||
git add flake.nix
|
git add flake.nix flake.lock
|
||||||
git commit -m "$title"
|
git commit -m "$title"
|
||||||
git push --force origin "$branch"
|
git push --force origin "$branch"
|
||||||
|
|
||||||
if gh pr view "$branch" --json number > /tmp/flake-pr.json 2> /dev/null; then
|
pr_number="$(gh pr list --head "$branch" --state open --json number --jq '.[0].number')"
|
||||||
pr_number="$(jq -r '.number' /tmp/flake-pr.json)"
|
if [[ -n "$pr_number" ]]; then
|
||||||
gh pr edit "$pr_number" --title "$title" --body "$body"
|
gh pr edit "$pr_number" --title "$title" --body "$body"
|
||||||
else
|
else
|
||||||
gh pr create --title "$title" --body "$body" --base main --head "$branch"
|
gh pr create --title "$title" --body "$body" --base main --head "$branch"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ FLAKE_FILE="$PROJECT_DIR/flake.nix"
|
|||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 [version] [release-tag]"
|
echo "Usage: $0 [version] [release-tag]"
|
||||||
echo
|
echo
|
||||||
echo "Updates flake.nix fetchzip hashes from the published GitHub release assets."
|
echo "Updates flake.nix fetchurl hashes from the published GitHub release assets."
|
||||||
echo "When version is omitted, the workspace package version from Cargo.toml is used."
|
echo "When version is omitted, the workspace package version from Cargo.toml is used."
|
||||||
echo "When release-tag is omitted, v<version> is used. Use snapshot to test snapshot assets."
|
echo "When release-tag is omitted, v<version> is used. Use snapshot to test snapshot assets."
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v nix > /dev/null; then
|
if ! command -v nix > /dev/null; then
|
||||||
echo "nix is required to calculate unpacked fetchzip hashes" >&2
|
echo "nix is required to calculate release asset hashes" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -61,7 +61,6 @@ prefetch_hash() {
|
|||||||
store prefetch-file \
|
store prefetch-file \
|
||||||
--hash-type sha256 \
|
--hash-type sha256 \
|
||||||
--json \
|
--json \
|
||||||
--unpack \
|
|
||||||
"$url" \
|
"$url" \
|
||||||
| jq -r '.hash'; then
|
| jq -r '.hash'; then
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in new issue
Block a user