-
Notifications
You must be signed in to change notification settings - Fork 3
Description
When Import from derivation is involved, evaluating the respective derivation will fail because inspect iterates on all the systems in flake output.
The error message when it fails usually looks like:
error: a 'aarch64-linux' with features {} is required to build '/nix/store/h8xyc392l1fxwjpwcz0vv34wa9zanqfk-cabal2nix-bar.drv', but I am a 'aarch64-darwin' with features {apple-virt, benchmark, big-parallel, nixos-test}For a moment I thought builtins.tryEval will help, but then I realised this is not an error thrown by the nix expression language.
I did create a workaround, which involves specifying systems as a flake input (see: https://github.com/juspay/inspect/blob/279cfa5c434e5bbebb4c07fa6af2deeb84e03bb0/flake.nix#L3-L4) and using inventoryForSystems.
This poses another problem, we can’t see outputs like nixosConfigurations on systems not in forSystems list of its schema. I did workaround this by supporting a new evalOnSystems attribute to skip the systems filtering on specific outputs (see: https://github.com/juspay/inspect/blob/279cfa5c434e5bbebb4c07fa6af2deeb84e03bb0/flake.nix#L111).
My workarounds don’t look super nice and it makes me wonder if there is a better way to do this...