summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2022-11-06 20:28:27 +0100
committerJörg Thalheim <joerg@thalheim.io>2022-11-06 20:28:27 +0100
commitb526538610bd4336efa80535063ac80a2e301179 (patch)
tree448487c99cdb723cd1138d7b5cf434c88848dce6
parentb0599fe776e063156f5d18f5b9b2c7a23f7c62ae (diff)
downloadpatchelf-b526538610bd4336efa80535063ac80a2e301179.tar.gz
build patchelf on window
-rw-r--r--flake.lock19
-rw-r--r--flake.nix24
2 files changed, 41 insertions, 2 deletions
diff --git a/flake.lock b/flake.lock
index 5b90b31..3c708e8 100644
--- a/flake.lock
+++ b/flake.lock
@@ -15,9 +15,26 @@
"type": "indirect"
}
},
+ "nixpkgs-mingw": {
+ "locked": {
+ "lastModified": 1667761825,
+ "narHash": "sha256-QpgLyjLoXJzAdLJCNpjYQy7A+varW5gwvEToqggf5D8=",
+ "owner": "Mic92",
+ "repo": "nixpkgs",
+ "rev": "cbcbadafec4f01ea21e905aad14a493cef5fad81",
+ "type": "github"
+ },
+ "original": {
+ "owner": "Mic92",
+ "ref": "mingw",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
"root": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "nixpkgs": "nixpkgs",
+ "nixpkgs-mingw": "nixpkgs-mingw"
}
}
},
diff --git a/flake.nix b/flake.nix
index b398468..37806ee 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,8 +2,9 @@
description = "A tool for modifying ELF executables and libraries";
inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable";
+ inputs.nixpkgs-mingw.url = "github:Mic92/nixpkgs/mingw";
- outputs = { self, nixpkgs }:
+ outputs = { self, nixpkgs, nixpkgs-mingw }:
let
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
@@ -16,6 +17,20 @@
inherit version;
src = self;
};
+
+ # https://github.com/NixOS/nixpkgs/pull/199883
+ pkgsCrossForMingw = system: (import nixpkgs-mingw {
+ inherit system;
+ overlays = [
+ (final: prev: {
+ threadsCross = {
+ model = "win32";
+ package = null;
+ };
+ })
+ ];
+ }).pkgsCross;
+
in
{
@@ -95,6 +110,13 @@
packages = forAllSystems (system: {
patchelf = patchelfFor nixpkgs.legacyPackages.${system};
default = self.packages.${system}.patchelf;
+
+ patchelf-win32 = (patchelfFor (pkgsCrossForMingw system).mingw32).overrideAttrs (old: {
+ NIX_CFLAGS_COMPILE = "-static";
+ });
+ patchelf-win64 = (patchelfFor (pkgsCrossForMingw system).mingwW64).overrideAttrs (old: {
+ NIX_CFLAGS_COMPILE = "-static";
+ });
} // nixpkgs.lib.optionalAttrs (system != "i686-linux") {
patchelf-musl = patchelfFor nixpkgs.legacyPackages.${system}.pkgsMusl;
});