diff --git a/default.nix b/default.nix index 128413aa..f7b7a973 100644 --- a/default.nix +++ b/default.nix @@ -9,7 +9,7 @@ let pkgs = import (fetchTarball "https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz") { crossSystem = { - inherit isStatic; + isStatic = true; config = target; }; }; @@ -47,6 +47,7 @@ let pkg-config = pkgs.pkg-config; buildNoDefaultFeatures = !defaultFeatures; buildFeatures = lib.strings.splitString "," features; + binutils = pkgs.binutils; }; in diff --git a/package.nix b/package.nix index 52f16866..10661d08 100644 --- a/package.nix +++ b/package.nix @@ -12,8 +12,24 @@ , 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; @@ -42,7 +58,8 @@ rustPlatform.buildRustPackage rec { ++ lib.optional (installManPages || installShellCompletions) installShellFiles; buildInputs = [ ] - ++ lib.optionals hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ Security ]) + ++ lib.optionals hostPlatform.isWindows empty-libgcc_eh + ++ lib.optionals hostPlatform.isDarwin (with darwin.apple_sdk_11_0.frameworks; [ Security ]) ++ lib.optional (builtins.elem "notmuch" buildFeatures) notmuch ++ lib.optional (builtins.elem "pgp-gpg" buildFeatures) gpgme;