Nix flake show fails when the flake provides packages for other platforms

I love flakes, they solve 90% of the UX issues I had with nix.
One feature I like is the nix flake show to list packages.

That being said, there is this issue for instance in ihaskell, that is if the flake provides packages for different platforms, I am not able to list the packages for my current platform, e.g. Ihaskell supports darwin but my machine is a linux so I end up with:

nix flake show --allow-import-from-derivation --system x86-64_linux
Failed to find a machine for remote build!
derivation: ja8ijc7m4618k989asnmls1yf0yr5qlv-cabal2nix-ihaskell.drv
required (system, features): (x86_64-darwin, )
1 available machines:
(systems, maxjobs, supportedFeatures, mandatoryFeatures)
(x86_64-linux, 2, big-parallel, kvm, )
error: a 'x86_64-darwin' with features {} is required to build '/nix/store/ja8ijc7m4618k989asnmls1yf0yr5qlv-cabal2nix-ihaskell.drv', but I am a 'x86-64_linux' with features {benchmark, big-parallel, kvm, nixos-test}
(use '--show-trace' to show detailed location information)

Is there a way to bypass that ? I feel like it should be possible to show at least the supported set of packages.

It’s a bug, and actually caused by IFD: nix flake check breaks on IFD in multi-platform flake · Issue #4265 · NixOS/nix · GitHub

nix flake show works perfectly fine if you have packages for multiple systems, but you cannot use IFD in your flakes at the moment.

Arguably you shouldn’t use IFD anyway, I think flakes need some way to allow auxilliary commands to do repository setup that hook into nix flake update so we can avoid needing IFD in the first place.

1 Like

thanks for the link. I will follow this closely. It would be best without IFD but it’s not always easy to bypass.

1 Like