From 0d0820da7e4f723592b550b3b33511e50d1f4af3 Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Sat, 5 Sep 2026 13:33:25 +0800 Subject: [PATCH] fix(ci): support older MinGW and Nix builds Declare the Windows API level required by the terminal proxy so Ubuntu 22.04 MinGW exposes CancelSynchronousIo. Patch script shebangs inside the Nix sandbox, install the target-triple Rust binary through the shared staging script, and keep Nix CI resource usage bounded. --- .github/workflows/ci.yml | 3 ++- hook/terminal-proxy.c | 1 + nix/package.nix | 7 ++++++- packaging/stage.sh | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e13ad1b..3b053aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,4 +80,5 @@ jobs: - name: Evaluate and build the flake run: | nix flake check --no-build - nix build .#uur + CARGO_BUILD_JOBS=1 NIX_BUILD_CORES=1 \ + nix build .#uur --max-jobs 1 --cores 1 diff --git a/hook/terminal-proxy.c b/hook/terminal-proxy.c index 5b65496..4b7fdf2 100644 --- a/hook/terminal-proxy.c +++ b/hook/terminal-proxy.c @@ -1,4 +1,5 @@ #define WIN32_LEAN_AND_MEAN +#define _WIN32_WINNT 0x0600 #include #include diff --git a/nix/package.nix b/nix/package.nix index d59cfb1..6a404e2 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -41,6 +41,10 @@ rustPlatform.buildRustPackage { UUR_BUILD_SHELL = runtimeShell; doCheck = false; + postPatch = '' + patchShebangs hook/build.sh capture/build.sh packaging/stage.sh + ''; + postBuild = '' UU_MINGW_CC=${windowsCC}/bin/${targetPrefix}cc \ UU_MINGW_STRIP=${windowsBinutils}/bin/${targetPrefix}strip \ @@ -51,7 +55,8 @@ rustPlatform.buildRustPackage { installPhase = '' runHook preInstall - ./packaging/stage.sh "$out" "" + UUR_BINARY=target/${stdenv.hostPlatform.rust.rustcTarget}/release/uur \ + ./packaging/stage.sh "$out" "" wrapProgram "$out/bin/uur" \ --prefix PATH : ${lib.makeBinPath [ curl diff --git a/packaging/stage.sh b/packaging/stage.sh index 4f14ae1..e8f4189 100755 --- a/packaging/stage.sh +++ b/packaging/stage.sh @@ -4,8 +4,9 @@ set -euo pipefail project_root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd -P) destination=${1:?usage: packaging/stage.sh DESTDIR [PREFIX]} prefix=${2-/usr} +uur_binary=${UUR_BINARY:-$project_root/target/release/uur} -install -Dm0755 "$project_root/target/release/uur" \ +install -Dm0755 "$uur_binary" \ "$destination$prefix/bin/uur" install -Dm0755 "$project_root/capture/uur-pw-capture" \ "$destination$prefix/lib/uur/uur-pw-capture"