!lheuhImcToQZYTQTuI:nixos.org

Nix on macOS

1174 Members
“There are still many issues with the Darwin platform but most of it is quite usable.” — http://yves.gnu-darwin.org192 Servers

Load older messages


SenderMessageTime
13 Jan 2026
@reckenrode:matrix.orgRandy EckenrodeI’d really like to get it using only LLVM bintools, but that requires some work on the wrapper.01:27:51
@emilazy:matrix.orgemily

ok, yeah, this is why the current lib patch is nonsense:

shion:/v/f/1/j/T/tmp.xaiYxboQnX
❭ l result-lib/lib/swift/
total 8
dr-xr-xr-x   5 root  nixbld   160B  1 Jan  1970 _InternalSwiftScan/
dr-xr-xr-x   5 root  nixbld   160B  1 Jan  1970 _InternalSwiftStaticMirror/
dr-xr-xr-x   5 root  nixbld   160B  1 Jan  1970 apinotes/
dr-xr-xr-x   5 root  nixbld   160B  1 Jan  1970 clang/
dr-xr-xr-x   6 root  nixbld   192B  1 Jan  1970 FrameworkABIBaseline/
dr-xr-xr-x   3 root  nixbld    96B  1 Jan  1970 host/
dr-xr-xr-x  40 root  nixbld   1.3K  1 Jan  1970 macosx/
dr-xr-xr-x  12 root  nixbld   384B  1 Jan  1970 migrator/
-r--r--r--   1 root  nixbld   186B  1 Jan  1970 module.modulemap
dr-xr-xr-x  27 root  nixbld   864B  1 Jan  1970 shims/
dr-xr-xr-x   5 root  nixbld   160B  1 Jan  1970 swiftToCxx/
01:28:02
@emilazy:matrix.orgemilythere's even header files in there01:28:13
@emilazy:matrix.orgemilybut ofc if you made the output less dumb in the rework that's another matter :)01:28:23
@reckenrode:matrix.orgRandy EckenrodeThe reason why LLD currently “works” is it relies on Clang to pass the correct flags. It’s not even wrapped.01:28:29
@reckenrode:matrix.orgRandy Eckenrode
$ nix build -f . swiftPackages.stdlib^\*
$ ls result/**
result/lib/lib_InternalSwiftStaticMirror.dylib*
result/lib/libswift_Builtin_float.dylib*
result/lib/libswift_Concurrency.dylib*
result/lib/libswift_Differentiation.dylib*
result/lib/libswift_RegexParser.dylib*
result/lib/libswift_StringProcessing.dylib*
result/lib/libswift_Volatile.dylib*
result/lib/libswiftCompatibilitySpan.dylib@
result/lib/libswiftCore.dylib*
result/lib/libswiftDistributed.dylib*
result/lib/libswiftObservation.dylib*
result/lib/libswiftRegexBuilder.dylib*
result/lib/libswiftRemoteMirror.dylib*
result/lib/libswiftRuntime.dylib*
result/lib/libswiftSwiftOnoneSupport.dylib*
result/lib/libswiftSynchronization.dylib*
result/lib/swift-6.2/macosx/libswiftCompatibilitySpan.dylib*

result/lib:
lib_InternalSwiftStaticMirror.dylib*  libswiftDistributed.dylib*
libswift_Builtin_float.dylib*         libswiftObservation.dylib*
libswift_Concurrency.dylib*           libswiftRegexBuilder.dylib*
libswift_Differentiation.dylib*       libswiftRemoteMirror.dylib*
libswift_RegexParser.dylib*           libswiftRuntime.dylib*
libswift_StringProcessing.dylib*      libswiftSwiftOnoneSupport.dylib*
libswift_Volatile.dylib*              libswiftSynchronization.dylib*
libswiftCompatibilitySpan.dylib@      swift-6.2/
libswiftCore.dylib*

result/lib/swift-6.2:
macosx/

result/lib/swift-6.2/macosx:
libswiftCompatibilitySpan.dylib*
01:29:17
@emilazy:matrix.orgemily an output with the runtime libraries required for Swift binaries (on Linux only, I guess?) would make sense, but the current lib ain't it 01:29:20
@emilazy:matrix.orgemily do those .dylibs even get used on macOS, where the Swift runtime is part of the OS dyld cache? 01:29:44
@reckenrode:matrix.orgRandy EckenrodeAll the Swift modules, embedded stuff, headers, and shims are in the dev output.01:29:57
@emilazy:matrix.orgemily shouldn't it be the out output, as it's consumed by the compiler rather than things taking the compiler as a build input 🤔 01:30:26
@reckenrode:matrix.orgRandy EckenrodeThey do some funky stuff to forward to the system. I don’t think we can avoid having them. We need the Span compatibility dylib for back deployment to 14.x and 15.x.01:30:33
@reckenrode:matrix.orgRandy Eckenrode The stdlib is a separate derivation. It has out and dev outputs. 01:31:03
@emilazy:matrix.orgemilyah01:31:11
@reckenrode:matrix.orgRandy EckenrodeThe embedded stuff is kind of weird. It lets you build “bare metal” Darwin applications.01:31:58
@reckenrode:matrix.orgRandy EckenrodeWhatever the hell that means.01:32:03
@emilazy:matrix.orgemilythey're rewriting XNU in Swift!01:33:13
@reckenrode:matrix.orgRandy EckenrodeThen they couldn’t borrow code from FreeBSD as easily!01:39:25
@reckenrode:matrix.orgRandy EckenrodeI wouldn’t mind if they rewrote the core UNIX utils in Swift, but then they definitely wouldn’t be able to pick up code changes from FreeBSD. It’s a shame because they’re horrifying at times.02:04:25
@samasaur:matrix.orgsamasauri wish i had to build fewer perls06:14:17
@samasaur:matrix.orgsamasaurthey don't even take that long but it offends me at a deeper level06:14:28
@samasaur:matrix.orgsamasauranyway this worked great!06:16:56
@samasaur:matrix.orgsamasaurand i feel like i have a better handle on how the stdenv is constructed06:17:40
@samasaur:matrix.orgsamasaur dropping kyua, atf, sqlite doesn't impact the output of nix-store -qR <stdenv.drv> | sed 's|/nix/store/[a-z0-9]*-||' | sort at all 06:24:56
@samasaur:matrix.orgsamasaur and if I go through the list of stage1Packages in the darwin stdenv it seems like most of them aren't in that list??? 06:25:19
@samasaur:matrix.orgsamasaurack wait i may have screwed that up06:28:28
@samasaur:matrix.orgsamasaur okay yes it does change that list. i was running nix-store -qR on the built stdenv and not the drv. I don't really understand why that differs but that's OK 06:30:17
@samasaur:matrix.orgsamasauroh wait duh that's buildtime vs runtime deps isn't it06:32:04
@samasaur:matrix.orgsamasaur

okay so applying this diff

diff --git a/pkgs/by-name/at/atf/package.nix b/pkgs/by-name/at/atf/package.nix
index 326419c5f7..a285cd207f 100644
--- a/pkgs/by-name/at/atf/package.nix
+++ b/pkgs/by-name/at/atf/package.nix
@@ -1,19 +1,13 @@
 {
   lib,
   stdenv,
-  darwin,
   fetchFromGitHub,
-  fetchpatch,
   autoreconfHook,
   kyua,
   gitUpdater,
 }:
 
-let
-  # atf is a dependency of libiconv. Avoid an infinite recursion with `pkgsStatic` by using a bootstrap stdenv.
-  stdenv' = if stdenv.hostPlatform.isDarwin then darwin.bootstrapStdenv else stdenv;
-in
-stdenv'.mkDerivation (finalAttrs: {
+stdenv.mkDerivation (finalAttrs: {
   pname = "atf";
   version = "0.23";
 
@@ -31,12 +25,12 @@
         --replace-fail 'atf_test_program{name="srcdir_test"}' ""
     ''
     # These tests fail on Darwin.
-    + lib.optionalString (finalAttrs.doInstallCheck && stdenv'.hostPlatform.isDarwin) ''
+    + lib.optionalString (finalAttrs.doInstallCheck && stdenv.hostPlatform.isDarwin) ''
       substituteInPlace atf-c/detail/process_test.c \
         --replace-fail 'ATF_TP_ADD_TC(tp, status_coredump);' ""
     ''
     # This test fails on Linux.
-    + lib.optionalString (finalAttrs.doInstallCheck && stdenv'.hostPlatform.isLinux) ''
+    + lib.optionalString (finalAttrs.doInstallCheck && stdenv.hostPlatform.isLinux) ''
       substituteInPlace atf-c/detail/fs_test.c \
         --replace-fail 'ATF_TP_ADD_TC(tp, eaccess);' ""
     '';
diff --git a/pkgs/os-specific/darwin/apple-source-releases/libiconv/package.nix b/pkgs/os-specific/darwin/apple-source-releases/libiconv/package.nix
index be9b1e32d6..169d9f8b24 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/libiconv/package.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/libiconv/package.nix
@@ -5,6 +5,8 @@
   mkAppleDerivation,
   pkg-config,
   stdenv,
+  runTests ? false,
+  libiconv,
 }:
 
 let
@@ -72,7 +74,7 @@
   nativeInstallCheckInputs = [ pkg-config ];
   installCheckInputs = [ atf ];
 
-  doInstallCheck = stdenv.buildPlatform.canExecute hostPlatform;
+  doInstallCheck = runTests;
 
   # Can’t use `mesonCheckPhase` because it runs the wrong hooks for `installCheckPhase`.
   installCheckPhase = ''
@@ -81,6 +83,8 @@
     runHook postInstallCheck
   '';
 
+  passthru.tests = libiconv.override { runTests = true; };
+
   meta = {
     description = "Iconv(3) implementation";
     license = [
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index a63e0c9b07..62f8e5774f 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -236,7 +236,6 @@
   # Any libraries in the list must only be used as dependencies of packages in this list.
   stage1Packages = prevStage: {
     inherit (prevStage)
-      atf
       autoconf
       automake
       bison
@@ -251,7 +250,6 @@
       gettext
       groff
       jq
-      kyua
       libedit
       libtool
       m4
@@ -266,7 +264,6 @@
       python3Minimal
       scons
       serf
-      sqlite
       subversion
       texinfo
       unzip
@@ -650,6 +647,7 @@
           self = self.python3-bootstrap;
           pythonAttr = "python3-bootstrap";
           enableLTO = false;
+          withSqlite = false;
         };
 
         scons = super.scons.override { python3Packages = self.python3.pkgs; };

I get the following diff in the output of nix-store -qR:

69d68
< 5.2.darwin.patch
95,96d93
< atf-0.23.drv
< atf-0.23.drv
234d230
< CVE-2022-28805.patch
337,339d332
< kyua-0.13-unstable-2024-01-22.drv
< kyua-0.13-unstable-2024-01-22.drv
< kyua-check-hook.sh
400,404d392
< lua-5.2.4.drv
< lua-5.2.4.tar.gz.drv
< lua-setup-hook
< lutok-0.4.drv
< lutok-0.4.drv
634,639d621
< source.drv
< source.drv
< source.drv
< sqlite-3.51.1.drv
< sqlite-autoconf-3510100.tar.gz.drv
< sqlite-doc-3510100.zip.drv
685,686d666
< utils.sh
< utils.sh.drv

and nix-build -A darwin.libiconv.passthru.tests does still build and run the tests

06:49:47
@samasaur:matrix.orgsamasaur oh dear though I didn't check anything under pkgsStatic 06:51:53
@samasaur:matrix.orgsamasaur I'm also noticing that none of the following in stage1Packages are actually in the nix-store -qR output: brotli, cyrus_sasl, groff, libedit, openssh, patchutils, python3Minimal, scons, serf, subversion. admittedly scons is manually overridden to use the bootstrap python but it doesn't appear to actually be used anywhere 07:00:40

Show newer messages


Back to Room ListRoom Version: 6