Skip to content

Conversation

@Thesola10
Copy link
Member

@Thesola10 Thesola10 commented Oct 17, 2024

This PR is meant for testing and adapting NixOS/nixpkgs#346043 to Nixie's static-bins package, in an effort to leverage as much code from upstream as possible and make updates easier.

Since 3f8326b, this PR also overhauls the static Nix build system to directly use NixOS/nix rather than Nixpkgs, with possible patches per-platform.

@Thesola10 Thesola10 changed the title Integrating NixOS/nixpkgs#346043 for static binaries Adapting new macOS cross-compilation Oct 17, 2024
@Thesola10
Copy link
Member Author

Once this change hits master on Nixpkgs, and tests confirm the resulting executables are quasi-static, this will be the new build system for Nixie, allowing for much easier and more frequent updates with macOS.

@Thesola10 Thesola10 mentioned this pull request Oct 17, 2024
7 tasks
@Thesola10 Thesola10 added type: enhancement New feature or request platform: x86_64-darwin Specific to Darwin on x86_64 labels Oct 17, 2024
@Thesola10

This comment was marked as outdated.

This allows us to leverage a static binary build that actually works,
including on Darwin, and comes with the added benefit of a much
simplified Nix version model -- whatever's written on top of the
flake.nix, that's the version you'll be shipping.

Only time will tell if this approach is more robust, and ideally the
patch set will be cleaned up and upstreamed.
@Thesola10
Copy link
Member Author

New approach based on upstream Nix build system yields very promising results:

$ llvm-otool -L result/bin/nix
result/bin/nix:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1348.28.0)
	/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 888.30.2)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57740.31.2)

however the libfetchers component appears to be broken, preventing anything flake-related from working:

error: input 'flake://nixpkgs' is unsupported

Getting close!

@Thesola10 Thesola10 marked this pull request as ready for review February 13, 2025 22:07
@Thesola10 Thesola10 changed the title Adapting new macOS cross-compilation macOS nix-static builder overhaul Feb 13, 2025
@Thesola10 Thesola10 added the platform: aarch64-darwin Specific to Darwin on AArch64 label Feb 15, 2025
@Thesola10 Thesola10 merged commit 5595f1a into master Feb 16, 2025
1 check passed
@Thesola10 Thesola10 deleted the macos-staging branch February 16, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: aarch64-darwin Specific to Darwin on AArch64 platform: x86_64-darwin Specific to Darwin on x86_64 type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants