about summary refs log tree commit diff
path: root/pkgs/os-specific/darwin
diff options
context:
space:
mode:
authorRune K. Svendsen <runesvend@gmail.com>2024-03-31 17:17:25 +0200
committerRune K. Svendsen <runesvend@gmail.com>2024-04-01 10:27:35 +0200
commit4f911a72471aaeabad41f5c1f3d30ac4f43672af (patch)
tree66e9d7ebe717fc2d3bc6b7dba74858b7e0686e74 /pkgs/os-specific/darwin
parente5bc6d679f7a9c327ae156771887694762cf3a0e (diff)
`Libsystem`: fix broken `postFetch` step in `darling.src`
Fixes #297765

The `postFetch` step was broken in several ways:
1. It attempts to unpack the archive, but this has already been done before reaching this step.
2. It unpacks the file `$downloadedFile`, but this file no longer exists because it's been moved to `$renamed`.

Additionally, since (1) neither directory `src/opendirectory` nor `src/OpenDirectory` are used for anything, and (2) it's not clear whether Nix produces different hashes depending on file system case sensitivity, the chosen solution is to just remove both these two directories for now. If later a file from either directory is needed, an investigation needs to be done on how Nix hashes archives with clashing names on case insensitive file systems.
Diffstat (limited to 'pkgs/os-specific/darwin')
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix23
1 files changed, 6 insertions, 17 deletions
diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
index c9cc99a6550e7..cea921488c0fb 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
@@ -10,24 +10,13 @@
 let
   darling.src = fetchzip {
     url = "https://github.com/darlinghq/darling/archive/d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b.tar.gz";
-    sha256 = "11b51fw47nl505h63bgx5kqiyhf3glhp1q6jkpb6nqfislnzzkrf";
+    hash = "sha256-/YynrKJdi26Xj4lvp5wsN+TAhZjonOrNNHuk4L5tC7s=";
     postFetch = ''
-      # The archive contains both `src/opendirectory` and `src/OpenDirectory`,
-      # pre-create the directory to choose the canonical case on
-      # case-insensitive filesystems.
-      mkdir -p $out/src/OpenDirectory
-
-      cd $out
-      tar -xzf $downloadedFile --strip-components=1
-      rm -r $out/src/libm
-
-      # If `src/opendirectory` and `src/OpenDirectory` refer to different
-      # things, then combine them into `src/OpenDirectory` to match the result
-      # on case-insensitive filesystems.
-      if [ "$(stat -c %i src/opendirectory)" != "$(stat -c %i src/OpenDirectory)" ]; then
-        mv src/opendirectory/* src/OpenDirectory/
-        rmdir src/opendirectory
-      fi
+      # The archive contains both `src/opendirectory` and `src/OpenDirectory`.
+      # Since neither directory is used for anything, we just remove them to avoid
+      #  the potential issue where file systems with different case sensitivity produce
+      #  different hashes.
+      rm -rf $out/src/{OpenDirectory,opendirectory}
     '';
   };