From ddef9e5cc8d0b5c51cbec4c246d8573871f27381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Sat, 23 Nov 2024 14:36:32 +0100 Subject: [PATCH] fix throw condition --- default.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 617c6b10..56534748 100644 --- a/default.nix +++ b/default.nix @@ -5,10 +5,14 @@ let crossPkgs = if isNull target then pkgs else import { crossSystem.config = target; }; crossSystems = import ./cross-systems.nix; + inherit (crossPkgs) lib; inherit (crossPkgs.stdenv) buildPlatform hostPlatform; - crossSystem = crossSystems.${buildPlatform.system}.${hostPlatform.config} - or throw ("Platform not supported: " + hostPlatform.config); + crossSystem = + if lib.attrsets.hasAttrByPath [ buildPlatform.system hostPlatform.config ] crossSystems then + crossSystems.${buildPlatform.system}.${hostPlatform.config} + else + throw "Platform not supported: " + hostPlatform.config; runner = crossSystem.runner or (_: "./himalaya") pkgs; @@ -27,8 +31,7 @@ let }; himalaya = import ./package.nix { - inherit rustPlatform; - lib = crossPkgs.lib; + inherit lib rustPlatform; fetchFromGitHub = crossPkgs.fetchFromGitHub; pkg-config = crossPkgs.pkg-config; darwin = crossPkgs.darwin;