push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,172 @@
{
autoPatchelfHook,
bash,
bbe,
coreutils,
cups,
dbus,
fetchurl,
fuse,
gawk,
glib,
lib,
makeWrapper,
netcat,
p7zip,
perl,
stdenv,
timetrap,
undmg,
util-linux,
wayland,
xorg,
}:
let
libPath = lib.concatStringsSep ":" [
"${glib.out}/lib"
"${xorg.libXrandr}/lib"
"${wayland.out}/lib"
];
scriptPath = lib.concatStringsSep ":" [
"${bash}/bin"
"${coreutils}/bin"
"${cups}/sbin"
"${gawk}/bin"
"${netcat}/bin"
"${timetrap}/bin"
"${util-linux}/bin"
];
in
stdenv.mkDerivation (finalAttrs: {
pname = "prl-tools";
version = "26.1.1-57288";
# We download the full distribution to extract prl-tools-lin.iso from
# => ${dmg}/Parallels\ Desktop.app/Contents/Resources/Tools/prl-tools-lin.iso
src = fetchurl {
url = "https://download.parallels.com/desktop/v${lib.versions.major finalAttrs.version}/${finalAttrs.version}/ParallelsDesktop-${finalAttrs.version}.dmg";
hash = "sha256-11IyKI2oOffzSPTB65XksZI3PD9W2+0SPZIfpb0RLuU=";
};
hardeningDisable = [
"pic"
"format"
];
nativeBuildInputs = [
autoPatchelfHook
bbe
makeWrapper
p7zip
perl
undmg
];
buildInputs = [
fuse
glib
xorg.libX11
xorg.libXcomposite
xorg.libXext
xorg.libXrandr
xorg.libXi
xorg.libXinerama
];
runtimeDependencies = [
dbus
glib
xorg.libXrandr
];
unpackPhase = ''
runHook preUnpack
undmg $src
export sourceRoot=prl-tools-build
7z x "Parallels Desktop.app/Contents/Resources/Tools/prl-tools-lin${lib.optionalString stdenv.hostPlatform.isAarch64 "-arm"}.iso" -o$sourceRoot
runHook postUnpack
'';
dontBuild = true;
installPhase = ''
runHook preInstall
( # tools
cd tools/tools${
if stdenv.hostPlatform.isAarch64 then
"-arm64"
else if stdenv.hostPlatform.isx86_64 then
"64"
else
"32"
}
mkdir -p $out/lib
# prltoolsd contains hardcoded /bin/bash path
# we're lucky because it uses only -c command
# => replace to /bin/sh
bbe -e "s:/bin/bash:/bin/sh\x00\x00:" -o bin/prltoolsd.tmp bin/prltoolsd
rm -f bin/prltoolsd
mv bin/prltoolsd.tmp bin/prltoolsd
# replace hardcoded /usr/bin/prl_fsd
substituteInPlace ../mount.fuse.prl_fsd \
--replace-fail "/usr/bin/prl_fsd" "$out/bin/prl_fsd"
# install binaries
for i in bin/* sbin/prl_nettool sbin/prl_snapshot; do
# also patch binaries to replace /usr/bin/XXX to XXX
# here a two possible cases:
# 1. it is uses as null terminated string and should be truncated by null;
# 2. it is uses inside shell script and should be truncated by space.
for p in bin/* sbin/prl_nettool sbin/prl_snapshot sbin/prlfsmountd; do
p=$(basename $p)
bbe -e "s:/usr/bin/$p\x00:./$p\x00\x00\x00\x00\x00\x00\x00\x00:" -o $i.tmp $i
bbe -e "s:/usr/sbin/$p\x00:./$p\x00\x00\x00\x00\x00\x00\x00\x00 :" -o $i $i.tmp
bbe -e "s:/usr/bin/$p:$p :" -o $i.tmp $i
bbe -e "s:/usr/sbin/$p:$p :" -o $i $i.tmp
done
install -Dm755 $i $out/$i
done
install -Dm755 ../../tools/mount.fuse.prl_fsd $out/sbin/mount.fuse.prl_fsd
install -Dm755 ../../tools/prlfsmountd.sh $out/sbin/prlfsmountd
install -Dm755 ../../tools/prlbinfmtconfig.sh $out/sbin/prlbinfmtconfig
for f in $out/bin/* $out/sbin/*; do
wrapProgram $f \
--prefix LD_LIBRARY_PATH ':' "${libPath}" \
--prefix PATH ':' "${scriptPath}"
done
for i in lib/libPrl*.0.0; do
cp $i $out/lib
ln -s $out/$i $out/''${i%.0.0}
done
substituteInPlace ../99prltoolsd-hibernate \
--replace-fail "/bin/bash" "${bash}/bin/bash"
mkdir -p $out/etc/pm/sleep.d
install -Dm644 ../99prltoolsd-hibernate $out/etc/pm/sleep.d
)
runHook postInstall
'';
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Parallels Tools for Linux guests";
homepage = "https://parallels.com";
license = licenses.unfree;
maintainers = with maintainers; [
wegank
codgician
];
platforms = platforms.linux;
};
})

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq libxml2
set -eu -o pipefail
nixpkgs="$(git rev-parse --show-toplevel)"
path="$nixpkgs/pkgs/by-name/pr/prl-tools/default.nix"
# Currently this script only supports Parallels 26
# Please change the knowledge base url after each major release
kb_url="https://kb.parallels.com/en/131014"
content="$(curl -s "$kb_url")"
# Extract all version/build pairs and select the latest (by semver, then build)
# Prefer the article content; fallback to whole body text
article_text="$(echo "$content" | xmllint --recover --html --xpath 'string(//div[@id="article-content"])' - 2>/dev/null || true)"
if [[ -z "${article_text:-}" ]]; then
article_text="$(echo "$content" | xmllint --recover --html --xpath 'string(//body)' - 2>/dev/null || echo "$content")"
fi
# Find all "X.Y.Z (BUILD)" occurrences like "20.4.1 (55996)"
mapfile -t candidates < <(echo "$article_text" \
| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+[[:space:]]*\(([0-9]+)\)' \
| sed -E 's/([0-9]+\.[0-9]+\.[0-9]+)[[:space:]]*\(([0-9]+)\)/\1 \2/' \
| sort -u)
if [[ ${#candidates[@]} -eq 0 ]]; then
echo "Failed to extract any version from $kb_url" >&2
exit 1
fi
# Sort by version then build and pick the highest
latest_pair="$(printf '%s\n' "${candidates[@]}" | sort -V -k1,1 -k2,2n | tail -n1)"
latest_ver="$(awk '{print $1}' <<< "$latest_pair")"
latest_build="$(awk '{print $2}' <<< "$latest_pair")"
version="${latest_ver}-${latest_build}"
echo "Found latest version: $version"
# Extract and compare current version
old_version="$(grep -o 'version = ".*"' "$path" | awk -F'"' '{print $2}')"
if [[ "$old_version" > "$version" || "$old_version" == "$version" ]]; then
echo "Current version $old_version is up-to-date"
exit 0
fi
# Update version and hash
major_version="$(echo "$version" | cut -d. -f1)"
dmg_url="https://download.parallels.com/desktop/v${major_version}/${version}/ParallelsDesktop-${version}.dmg"
sha256="$(nix store prefetch-file "$dmg_url" --json | jq -r '.hash')"
sed -i -e "s,version = \"$old_version\",version = \"$version\"," \
-e "s,hash = \"sha256-.*\",hash = \"$sha256\"," "$path"
echo "Updated linuxPackages_latest.prl-tools $old_version -> $version"