move windows hack to default.nix

This commit is contained in:
Clément DOUIN
2024-11-25 11:17:31 +01:00
parent 18cc8a8769
commit bbb09ec03b
2 changed files with 19 additions and 19 deletions
+19 -2
View File
@@ -48,15 +48,32 @@ let
libiconv = pkgs.pkgsStatic.libiconv;
buildNoDefaultFeatures = !defaultFeatures;
buildFeatures = lib.strings.splitString "," features;
binutils = pkgs.buildPackages.binutils;
};
# HACK: work around https://github.com/NixOS/nixpkgs/issues/177129
# Though this is an issue between Clang and GCC,
# so it may not get fixed anytime soon...
empty-libgcc_eh = pkgs.buildPackages.stdenv.mkDerivation {
pname = "empty-libgcc_eh";
version = "0";
dontUnpack = true;
installPhase = ''
mkdir -p "$out"/lib
ls "${pkgs.buildPackags.binutils}"/bin/ -al
"${pkgs.buildPackags.binutils}/bin/ar" r "$out"/lib/libgcc_eh.a
'';
};
in
himalaya.overrideAttrs (drv: {
version = "1.0.0";
postInstall = lib.optionalString hostPlatform.isWindows ''
propagatedBuildInputs = drv.propagatedBuildInputs
++ lib.optional hostPlatform.isWindows empty-libgcc_eh;
postInstall = (builtins.trace drv drv).postInstall ++ lib.optionalString hostPlatform.isWindows ''
export WINEPREFIX="$(${lib.getExe' pkgs.buildPackages.mktemp "mktemp"} -d)"
'' + ''
mkdir -p $out/bin/share/{applications,completions,man,services}
-17
View File
@@ -13,24 +13,8 @@
, gpgme
, buildNoDefaultFeatures ? false
, buildFeatures ? [ ]
, binutils
}:
let
# HACK: work around https://github.com/NixOS/nixpkgs/issues/177129
# Though this is an issue between Clang and GCC,
# so it may not get fixed anytime soon...
empty-libgcc_eh = stdenv.mkDerivation {
pname = "empty-libgcc_eh";
version = "0";
dontUnpack = true;
installPhase = ''
mkdir -p "$out"/lib
"${lib.getExe' binutils "ar"}" r "$out"/lib/libgcc_eh.a
'';
};
in
rustPlatform.buildRustPackage rec {
inherit buildNoDefaultFeatures buildFeatures;
@@ -55,7 +39,6 @@ rustPlatform.buildRustPackage rec {
++ lib.optional (installManPages || installShellCompletions) installShellFiles;
buildInputs = [ ]
++ lib.optional hostPlatform.isWindows empty-libgcc_eh
++ lib.optional hostPlatform.isDarwin libiconv
++ lib.optionals hostPlatform.isDarwin (with darwin.apple_sdk_11_0.frameworks; [ Security ])
++ lib.optional (builtins.elem "notmuch" buildFeatures) notmuch