-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-package projects #7
Comments
What about packages that use different GHC versions? Do we allow it in a mono-repo? |
Not sure, but generally you'd avoid this situation. If you do need this, I'd say you're not really in a monorepo situation anyway.
This happens with GHCJS SPAs that have regular-GHC backends. I think this is a valid reason for having a unique package set per "project", so project =~ package set =~ ghc version. |
(What is IIUC then - we have "projects", and each project defines its own package sets and GHC version. For https://github.com/hercules-ci/hercules-ci-agent - that means there is just one project, which has a package set containing those sub-directories (cabal projects), all using a single GHC version. For trivial-structured projects (like the ones I maintain), there would be one project which has one package exactly. For complex projects, you could have a backend project using say GHC-9.2 (and multiple packages inside it) and a frontend project using say GHCJS-8.10. |
The vaguely equals operator ;) "maps 1:1" I guess.
Exactly! |
Okay, that all sounds good to me. The trivial-structured case won't change much, so 👍🏿 |
In #23, we switched from |
|
This task would be a pretty sizable benefit for something for one of my projects, so I'm looking to take it on. I'll update this thread with a PR for review by Srid+contributors when the time comes. |
Here's a small demo: https://github.com/srid/haskell-multi-nix/blob/master/flake.nix
|
Here's a concrete spec of what this could look like. Consider the three different use cases and what the proposed Nix looks like: 1. Single package projectThis would be more or less similar to the current API, except for the extra {
haskellProjects.default = {
# overrides = self: super: {}
hlsCheck.enable = true;
packages.haskell-template = {
root = ./.;
};
};
} 2. Multi-package single projectBased on https://github.com/srid/haskell-multi-nix/ {
haskellProjects.default = {
haskellPackages = pkgs.haskell.packages.ghc924;
overrides = self: super: {};
hlsCheck.enable = false;
hlintCheck.enable = true;
buildTools = {};
packages = {
# foo library
foo = {
root = ./foo;
modifier = drv: pkgs.haskell.lib.dontCheck drv;
};
# bar executable (depends on foo)
bar = {
root = ./bar;
flakeAttribute = "bar"; # packages.bar; apps.bar (default: "default-bar")
};
};
};
packages.default = self'.packages.foo;
apps.default = self.packages.bar;
} 3. Multi-package multi-projectTypical of GHCJS/reflex/obelisk projects, which have three packages - frontend, backend & common - with 'common' shared between ghc and ghcjs. https://github.com/obsidiansystems/obelisk/tree/master/skeleton The Ema project is another example, which has both GHC 9.0 and 9.2 outputs: https://github.com/EmaApps/ema/blob/master/flake.nix {
haskellProjects = {
backend = {
packages = {
backend.root = ./backend;
common.root = ./common;
};
};
frontend = {
haskellPackages = inputs.reflex-platform.ghcjs8107;
packages = {
frontend.root = ./backend;
common.root = ./common;
};
};
};
devShells.default = self'.devShells.backend-backend;
} |
@srid What types should each of |
You don't need to specify that in Nix. All the |
haskellProjects.default = {}; |
How should this flake be changed to support projects with multiple Haskel packages, like https://github.com/hercules-ci/hercules-ci-agent ?
The text was updated successfully, but these errors were encountered: