From f0e1bf3ded2aa3d65771910782e44f839e6f7f2b Mon Sep 17 00:00:00 2001 From: TheSola10 Date: Thu, 17 Oct 2024 10:47:32 +0200 Subject: [PATCH] Integrating NixOS/nixpkgs#346043 for static binaries --- flake.lock | 7 ++++--- flake.nix | 2 +- static-bins/default.nix | 12 +----------- static-bins/nixpkgs-darwin-static.nix | 26 -------------------------- 4 files changed, 6 insertions(+), 41 deletions(-) delete mode 100644 static-bins/nixpkgs-darwin-static.nix diff --git a/flake.lock b/flake.lock index 0d773c5..e641d06 100644 --- a/flake.lock +++ b/flake.lock @@ -128,15 +128,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1697484591, - "narHash": "sha256-ahV2m9CeTLkTOo0hZNf3miMKTOOHtWKIBnjxNeFdx5A=", + "lastModified": 1729145113, + "narHash": "sha256-sZwyoSd5nv6LQZzcin077GG4qK72WkOk2QKFNL1tE4E=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f3fce3e60ab93bcf1fd27fd0526e6e2577c3afc9", + "rev": "a6f239cb3324831c2e1b22bea13551a2bdf150f4", "type": "github" }, "original": { "owner": "nixos", + "ref": "staging", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index f87858b..078384e 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { description = "Put Nix in everything!"; - inputs.nixpkgs.url = github:nixos/nixpkgs; + inputs.nixpkgs.url = github:nixos/nixpkgs/staging; inputs.nix.url = github:nixos/nix/2.17.1; inputs.fakedir = { url = github:nixie-dev/fakedir; diff --git a/static-bins/default.nix b/static-bins/default.nix index 39c47f7..89e0d9b 100644 --- a/static-bins/default.nix +++ b/static-bins/default.nix @@ -25,17 +25,7 @@ let ]; systemsPkgs = map (s: - import nixpkgs ({ localSystem = s; } - // (if s == "x86_64-darwin" - then - { overlays = - [ (import ./nixpkgs-darwin-static.nix) ]; - crossSystem = { - isStatic = true; - system = s; - }; - } - else {})) + import nixpkgs ({ localSystem = s; }) ) builtSystems; nixPackage = r: if builtins.hasAttr "${r.system}" nixStatics diff --git a/static-bins/nixpkgs-darwin-static.nix b/static-bins/nixpkgs-darwin-static.nix deleted file mode 100644 index f7738d5..0000000 --- a/static-bins/nixpkgs-darwin-static.nix +++ /dev/null @@ -1,26 +0,0 @@ -self: super: -{ libcCross = super.buildPackages.darwin.Libsystem; - - darwin = super.darwin // { - apple_sdk = super.buildPackages.darwin.apple_sdk; - }; - - #targetPackages = super.targetPackages // { - # libcCross = self.libcCross; - # darwin = self.darwin; - #}; - - runtimeShellPackage = super.pkgsBuildBuild.bash; - - # Setting this prevents static libc++ from being used - targetPackages = self; - - nixStatic = self.nix.overrideAttrs (o: rec { - nix_LDFLAGS = "-nodefaultlibs -nostdlib ${super.pkgsBuildBuild.libcxx}/lib/libc++.a ${super.pkgsBuildBuild.libcxx}/lib/libc++experimental.a ${super.pkgsBuildBuild.libcxxabi}/lib/libc++abi.a -lSystem"; - postConfigure = '' - sed -e 's,-Ur,-r,' mk/libraries.mk -i - sed -e 's,nix_LDFLAGS =,nix_LDFLAGS = ${nix_LDFLAGS},' src/nix/local.mk -i - ''; - }); - -}