mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-09 06:23:36 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
88 lines
2.3 KiB
Nix
88 lines
2.3 KiB
Nix
{
|
|
autoPatchelfHook,
|
|
dotnetCorePackages,
|
|
fontconfig,
|
|
lib,
|
|
libICE,
|
|
libSM,
|
|
libX11,
|
|
stdenv,
|
|
writeText,
|
|
}:
|
|
{
|
|
# e.g.
|
|
# "Package.Id" =
|
|
# package:
|
|
# package.overrideAttrs (old: {
|
|
# buildInputs = old.buildInputs or [ ] ++ [ hello ];
|
|
# });
|
|
|
|
"Avalonia" =
|
|
package:
|
|
package.overrideAttrs (
|
|
old:
|
|
let
|
|
# These versions have a runtime error when built with `dotnet publish --no-build`
|
|
# When attempting to draw a window, Avalonia will throw "No precompiled XAML found"
|
|
#
|
|
# Introduced in https://github.com/AvaloniaUI/Avalonia/pull/13840
|
|
# Fixed by https://github.com/AvaloniaUI/Avalonia/pull/16835
|
|
affectedVersions = [
|
|
"11.1.0-beta1"
|
|
"11.1.0-beta2"
|
|
"11.1.0-rc1"
|
|
"11.1.0-rc2"
|
|
"11.1.0"
|
|
"11.1.1"
|
|
"11.1.2-rc1"
|
|
"11.1.2"
|
|
"11.1.3"
|
|
"11.2.0-beta1"
|
|
];
|
|
in
|
|
lib.optionalAttrs (builtins.elem old.version affectedVersions) {
|
|
postPatch = ''
|
|
substituteInPlace {build,buildTransitive}/AvaloniaBuildTasks.targets \
|
|
--replace-fail 'BeforeTargets="CopyFilesToOutputDirectory;BuiltProjectOutputGroup"' \
|
|
'BeforeTargets="CopyFilesToOutputDirectory;BuiltProjectOutputGroup;ComputeResolvedFilesToPublishList"'
|
|
'';
|
|
}
|
|
);
|
|
|
|
"Avalonia.X11" =
|
|
package:
|
|
package.overrideAttrs (
|
|
old:
|
|
lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) {
|
|
setupHook = writeText "setupHook.sh" ''
|
|
prependToVar dotnetRuntimeDeps \
|
|
"${lib.getLib libICE}" \
|
|
"${lib.getLib libSM}" \
|
|
"${lib.getLib libX11}"
|
|
'';
|
|
}
|
|
);
|
|
|
|
"SkiaSharp.NativeAssets.Linux" =
|
|
package:
|
|
package.overrideAttrs (
|
|
old:
|
|
lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
|
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ autoPatchelfHook ];
|
|
|
|
buildInputs = old.buildInputs or [ ] ++ [ fontconfig ];
|
|
|
|
preInstall =
|
|
old.preInstall or ""
|
|
+ ''
|
|
cd runtimes
|
|
for platform in *; do
|
|
[[ $platform == "${dotnetCorePackages.systemToDotnetRid stdenv.hostPlatform.system}" ]] ||
|
|
rm -r "$platform"
|
|
done
|
|
cd - >/dev/null
|
|
'';
|
|
}
|
|
);
|
|
}
|