From 77dc1fefc5b2c309614a80e1e155a00bcb6bfaed Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Tue, 22 Apr 2025 06:35:32 +0100 Subject: [PATCH] darwin.moltenvk: fix the eval on `linux` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without the change the eval fails as: $ nix eval --impure --expr 'with import ./. { system = "x86_64-linux"; }; darwin.moltenvk.NIX_CFLAGS_COMPILE' error: … in the condition of the assert statement at pkgs/stdenv/generic/make-derivation.nix:716:11: 715| n: v: 716| assert assertMsg (isString v || isBool v || isInt v || isDerivation v) | ^ 717| "The `env` attribute set can only contain derivation, string, boolean or integer attributes. The `${n}` attribute is of type ${builtins.typeOf v}."; … in the left operand of the OR (||) operator at lib/asserts.nix:39:31: 38| # TODO(Profpatsch): add tests that check stderr 39| assertMsg = pred: msg: pred || builtins.throw msg; | ^ 40| (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: expected a set but found null: null --- pkgs/by-name/mo/moltenvk/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/mo/moltenvk/package.nix b/pkgs/by-name/mo/moltenvk/package.nix index 6651f2298a2d..4fd4aa6e6b3b 100644 --- a/pkgs/by-name/mo/moltenvk/package.nix +++ b/pkgs/by-name/mo/moltenvk/package.nix @@ -101,8 +101,8 @@ stdenv.mkDerivation (finalAttrs: { ''; env.NIX_CFLAGS_COMPILE = toString ( - [ - "-isystem ${lib.getInclude stdenv.cc.libcxx}/include/c++/v1" + lib.optional (stdenv.cc.libcxx != null) "-isystem ${lib.getInclude stdenv.cc.libcxx}/include/c++/v1" + ++ [ "-I${lib.getDev spirv-cross}/include/spirv_cross" "-I${lib.getDev spirv-headers}/include/spirv/unified1"