LadybirdBrowser / ladybird

Truly independent web browser
https://ladybird.org
BSD 2-Clause "Simplified" License
10.86k stars 429 forks source link

Toolchain: Nix derivation doesn't work on Darwin #323

Open ADKaster opened 6 days ago

ADKaster commented 6 days ago

Running nix develop on aarch64-apple-darwin produces some errors related to unsupported packages.

Error message: ``` $ nix develop error: … while calling the 'derivationStrict' builtin at :9:12: 8| 9| strict = derivationStrict drvAttrs; | ^ 10| … while evaluating derivation 'nix-shell' whose name attribute is located at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/pkgs/stdenv/generic/make-derivation.nix:348:7 … while evaluating attribute 'nativeBuildInputs' of derivation 'nix-shell' at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/pkgs/stdenv/generic/make-derivation.nix:392:7: 391| depsBuildBuild = elemAt (elemAt dependencies 0) 0; 392| nativeBuildInputs = elemAt (elemAt dependencies 0) 1; | ^ 393| depsBuildTarget = elemAt (elemAt dependencies 0) 2; (stack trace truncated; use '--show-trace' to show the full trace) error: Package ‘libdrm-2.4.117’ in /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/pkgs/development/libraries/libdrm/default.nix:46 is not available on the requested hostPlatform: hostPlatform.config = "aarch64-apple-darwin" package.meta.platforms = [ "i686-cygwin" "x86_64-cygwin" "i686-freebsd13" "x86_64-freebsd13" "x86_64-solaris" "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-linux" "loongarch64-linux" "m68k-linux" "microblaze-linux" "microblazeel-linux" "mips-linux" "mips64-linux" "mips64el-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "s390-linux" "s390x-linux" "x86_64-linux" "aarch64-netbsd" "armv6l-netbsd" "armv7a-netbsd" "armv7l-netbsd" "i686-netbsd" "m68k-netbsd" "mipsel-netbsd" "powerpc-netbsd" "riscv32-netbsd" "riscv64-netbsd" "x86_64-netbsd" "i686-openbsd" "x86_64-openbsd" "x86_64-redox" ] package.meta.badPlatforms = [ ] , refusing to evaluate. a) To temporarily allow packages that are unsupported for this system, you can use an environment variable for a single invocation of the nix tools. $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake, then pass `--impure` in order to allow use of environment variables. b) For `nixos-rebuild` you can set { nixpkgs.config.allowUnsupportedSystem = true; } in configuration.nix to override this. c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add { allowUnsupportedSystem = true; } to ~/.config/nixpkgs/config.nix. ```
ADKaster commented 6 days ago

This patch helps but still isn't enough to get a working build

diff --git a/Ladybird/default.nix b/Ladybird/default.nix
index 8ed5734f57..0b6aa4e1ff 100644
--- a/Ladybird/default.nix
+++ b/Ladybird/default.nix
@@ -8,6 +8,7 @@ mkShell.override { stdenv = gcc13Stdenv; } {
     ninja
     pkg-config
     python3
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     qt6.qtbase
     qt6.qtbase.dev
     qt6.qtmultimedia
@@ -16,7 +17,7 @@ mkShell.override { stdenv = gcc13Stdenv; } {
     qt6.qtwayland.dev
   ];

-  shellHook = ''
+  shellHook = lib.optionalString (!stdenv.isDarwin) ''
     # NOTE: This is required to make it find the wayland platform plugin installed
     #       above, but should probably be fixed upstream.
     export QT_PLUGIN_PATH="$QT_PLUGIN_PATH:${qt6.qtwayland}/lib/qt-6/plugins"