diff options
-rw-r--r-- | flake.lock | 19 | ||||
-rw-r--r-- | flake.nix | 24 |
2 files changed, 41 insertions, 2 deletions
@@ -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" } } }, @@ -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; }); |