Closed jmatsushita closed 2 years ago
I suppose this is related to https://github.com/numtide/flake-utils/issues/50#issuecomment-981126190
Given that outputs are:
outputs = { self, nixpkgs, flake-utils, haskell-flake-utils, ... }@inputs:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-darwin" ] (system:
inputs.haskell-flake-utils.lib.simpleCabalProject2flake {
inherit self nixpkgs system;
name = "rhine";
packageNames = ["rhine-gloss" "rhine-terminal" "rhine-examples"];
}
);
overlays
also gets an overlays.${system}
attribute. I suppose a way to address this would be to build in the eachSystem
call inside simpleCabalProject2flake
by passing it a systems
array (like in simpleFlake
) and use this pattern:
(flake-utils.lib.eachSystem systems (system: {
# ... other stuff
}
)) // {
overlay = final: prev: {
foo = packages.foo;
};
};
I'll give it a shot in a PR.
Exactly.
And actually this was initial design with eachSystem
call inside simpleCabalProject2flake
.
One problem with that is some of the parameters of simpleCabalProject2flake
need to know system
. And there was a design choice of how to pass it.
Well. For now #4 solves an issue.
As to passing system
variant with passing it in an optional set seems like good enough.
We can not use pattern
haskell-flake-utils.lib.simpleCabalProject2flake systems (system: {
inherit self nixpkgs;
name = ...
config = ...
haskellFlakes = ...
preOverlays = ...
preOverlay = ...
...
});
since at least several of this parameters should not know about system
and should not depend on it.
In the same time user might need tools from pkgs.lib
while constructing parameters to simpleCabalProject2flake
.
And this pkgs
is
pkgs = import nixpkgs { inherit system }
so maybe something like this will be better:
haskell-flake-utils.lib.simpleCabalProject2flake {
inherit self nixpkgs;
name = ...;
systems = [...];
}
(system: {
config = ...;
haskellFlakes = ...;
preOverlays = ...;
preOverlay = ...;
hpPreOverrides = ...;
hpOverrides = ...;
cabal2nixArgs = ...;
shell = ...;
shellExtBuildInputs = ...;
shellWithHoogle = ...;
compiler = ...;
localOverlays = ...;
});
or even
haskell-flake-utils.lib.simpleCabalProject2flake {
inherit self nixpkgs;
name = ...;
systems = [...];
}
(pkgs: {
...
});
Yes! I think:
haskell-flake-utils.lib.simpleCabalProject2flake {
inherit self nixpkgs;
name = ...;
systems = [...];
}
(pkgs: {
...
});
Is the approach I prefer! I think in practice pkgs
is what we need for instance with shellExtBuildInputs
.
Tried this option. And now it's clear to me that current version is better.
All parameters that might need pkgs as input already have it:
preOverlays
, preOverlay
, cabal2nixArgs
, packageCabal2nixArgs
, shellExtBuildInputs
.
Maybe this should be better illustrated with examples in README. (done)
Ah yes, great it makes sense now with the examples!
When running
nix flake check
in asimpleCabalProject2flake
project, I get: