Files
uur/nix/package.nix
T
Xuc Pan 0d0820da7e 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.
2026-09-05 13:33:25 +08:00

81 lines
1.6 KiB
Nix

{
lib,
stdenv,
runtimeShell,
rustPlatform,
pkg-config,
makeWrapper,
bash,
pipewire,
pulseaudio,
curl,
glib,
wineWow64Packages,
ethtool,
networkmanager,
pkgsCross,
}:
let
windowsCC = pkgsCross.mingwW64.stdenv.cc;
windowsBinutils = pkgsCross.mingwW64.buildPackages.binutils;
targetPrefix = windowsCC.targetPrefix;
in
rustPlatform.buildRustPackage {
pname = "uur";
version = "0.1.0";
src = lib.cleanSource ../.;
cargoLock.lockFile = ../Cargo.lock;
nativeBuildInputs = [
pkg-config
makeWrapper
windowsCC
windowsBinutils
bash
];
buildInputs = [ pipewire ];
CC = "${stdenv.cc}/bin/cc";
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 \
UU_MINGW_DLLTOOL=${windowsBinutils}/bin/${targetPrefix}dlltool \
./hook/build.sh
./capture/build.sh
'';
installPhase = ''
runHook preInstall
UUR_BINARY=target/${stdenv.hostPlatform.rust.rustcTarget}/release/uur \
./packaging/stage.sh "$out" ""
wrapProgram "$out/bin/uur" \
--prefix PATH : ${lib.makeBinPath [
curl
bash
glib
pulseaudio
wineWow64Packages.stable
ethtool
networkmanager
]}
runHook postInstall
'';
meta = {
description = "Native Linux companion for NetEase UU Remote";
homepage = "https://github.com/panxuc/uur";
license = lib.licenses.mit;
mainProgram = "uur";
platforms = [ "x86_64-linux" ];
};
}