Open spikespaz opened 11 months ago
Unfortunately not really fixable nicely here, this is a Nix bug: https://github.com/NixOS/nix/issues/4265
We could commit the cabal2nix output..
Yeah that would work, it's just not nice, since it requires manual updates (or setting up automated ones). I don't think that's worth it for a bug that should really be fixed in Nix.
For the sake of having this formatter be adopted by anyone, I wouldn't be waiting for Nix to solve this particular issue for us. It's been an issue for quite some time now, and I can't say "run nix flake show
to see what this provides" and instead I have to say "use this complicated Nix eval piped to sed".
Also prevents nix flake check
do that you have to come up with something other than checking the status code in an integration script.
I would also like to see IFD not being fully required as it prevents usage in hydra.
Fair enough, let's reconsider!
Note that this package is already in nixpkgs without IFD via hackage
This is actually blocking my ability to use nix fmt
as well - specifying the nixfmt
package here: https://github.com/remi-gelinas/rosetta/blob/trunk/flake.nix#L45
Results in nix fmt
failing. Targeting the aarch64-darwin
package on an M1 machine, it still attempts to evaluate the formatters for other systems, and encounters IFD as aarch64-darwin
can't build the cabal2nix
package for x86_64-linux
.
Not sure if this specifically is a Nix issue or a nixfmt issue, or one that I can work around, but it's really blocking my attempt to adopt nixfmt :/
@remi-gelinas Hmm I just tried it on an aarch64-darwin machine, but couldn't reproduce the problem. I also don't see why it would need to build anything for x86_64-linux
. Can you share exactly how you're getting the problem along with the error message?
I just did an isolated reproduction attempt with a barebones flake like so:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?rev=c4ce542c774aa505fd80d86d9d5de51349328e43";
nixfmt.url = "github:NixOS/nixfmt?rev=3bcb63c13e7aaf0b8e14081cf0c14c44f62e840a";
};
outputs = {nixpkgs, nixfmt, ...}: let
supportedSystems = [
"aarch64-darwin"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in {
formatter = forAllSystems (system: nixfmt.packages.${system}.nixfmt);
};
}
and it works correctly, totally as expected. I am assuming the problem lies somewhere in my usage of flake-parts
to generate the flake options then. Seems to not be an actual issue! That being said, I do still have to explicitly allow IFD for flake operations to work as expected, so this issue is still a problem
The formatter is specified like this:
When you run
nix flake show
: