Skip to content

Commit

Permalink
Simplified and fixed x86_64-darwin Nix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Thesola10 committed Sep 16, 2023
1 parent 3060933 commit b8aaf07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ jobs:
run: |
sudo apt-get -q -y update
sudo apt-get -q -y install qemu-user-static
echo "extra-platforms = aarch64" | sudo tee -a /etc/nix/nix.conf
- name: Build and pin final output
run: |
nix build .#static-bins
nix --extra-platforms aarch64-linux build .#static-bins
cachix push nix-wrap $(nix eval --raw .#static-bins)
cachix pin nix-wrap binaries $(nix eval --raw .#static-bins) --keep-forever
11 changes: 5 additions & 6 deletions static-bins/nixpkgs-darwin-static.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
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;
Expand All @@ -11,17 +15,12 @@ self: super:
# Setting this prevents static libc++ from being used
targetPackages = self;

# Workaround for nixos/nixpkgs#127345
boost = super.boost.overrideAttrs(o: {
buildPhase = builtins.replaceStrings ["binary-format=macho"] ["binary-format=mach-o"] o.buildPhase;
installPhase = builtins.replaceStrings ["binary-format=macho"] ["binary-format=mach-o"] o.installPhase;
});

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
'';
});

}

0 comments on commit b8aaf07

Please sign in to comment.