Skip to content

Commit 3f90e49

Browse files
authored
Merge pull request #445 from NixOS/win32
switch back to upstream nixpkgs for windows build
2 parents adf5c05 + 0826d9d commit 3f90e49

File tree

3 files changed

+26
-41
lines changed

3 files changed

+26
-41
lines changed

flake.lock

Lines changed: 4 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
description = "A tool for modifying ELF executables and libraries";
33

44
inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable";
5-
inputs.nixpkgs-mingw.url = "github:Mic92/nixpkgs/mingw";
65

7-
outputs = { self, nixpkgs, nixpkgs-mingw }:
6+
outputs = { self, nixpkgs }:
87

98
let
109
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
@@ -13,24 +12,14 @@
1312
version = nixpkgs.lib.removeSuffix "\n" (builtins.readFile ./version);
1413
pkgs = nixpkgs.legacyPackages.x86_64-linux;
1514

16-
patchelfFor = pkgs: pkgs.callPackage ./patchelf.nix {
15+
16+
patchelfFor = pkgs: let
17+
# this is only
18+
in pkgs.callPackage ./patchelf.nix {
1719
inherit version;
1820
src = self;
1921
};
2022

21-
# https://github.com/NixOS/nixpkgs/pull/199883
22-
pkgsCrossForMingw = system: (import nixpkgs-mingw {
23-
inherit system;
24-
overlays = [
25-
(final: prev: {
26-
threadsCross = {
27-
model = "win32";
28-
package = null;
29-
};
30-
})
31-
];
32-
}).pkgsCross;
33-
3423
in
3524

3625
{
@@ -121,10 +110,10 @@
121110
patchelf-musl-cross = patchelfFor pkgs.pkgsCross.musl64;
122111
patchelf-netbsd-cross = patchelfFor pkgs.pkgsCross.x86_64-netbsd;
123112

124-
patchelf-win32 = (patchelfFor (pkgsCrossForMingw system).mingw32).overrideAttrs (old: {
113+
patchelf-win32 = (patchelfFor pkgs.pkgsCross.mingw32).overrideAttrs (old: {
125114
NIX_CFLAGS_COMPILE = "-static";
126115
});
127-
patchelf-win64 = (patchelfFor (pkgsCrossForMingw system).mingwW64).overrideAttrs (old: {
116+
patchelf-win64 = (patchelfFor pkgs.pkgsCross.mingwW64).overrideAttrs (old: {
128117
NIX_CFLAGS_COMPILE = "-static";
129118
});
130119
} // nixpkgs.lib.optionalAttrs (system != "i686-linux") {

patchelf.nix

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
{ stdenv, autoreconfHook, version, src }:
1+
{ stdenv, buildPackages, autoreconfHook, version, src, overrideCC }:
2+
let
3+
# on windows we use win32 threads to get a fully static binary
4+
gcc = buildPackages.wrapCC (buildPackages.gcc-unwrapped.override ({
5+
threadsCross = {
6+
model = "win32";
7+
package = null;
8+
};
9+
}));
210

3-
stdenv.mkDerivation {
11+
stdenv' = if (stdenv.cc.isGNU && stdenv.targetPlatform.isWindows) then
12+
overrideCC stdenv gcc
13+
else
14+
stdenv;
15+
in
16+
stdenv'.mkDerivation {
417
pname = "patchelf";
518
inherit version src;
619
nativeBuildInputs = [ autoreconfHook ];

0 commit comments

Comments
 (0)