-
Notifications
You must be signed in to change notification settings - Fork 45
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
Per system option with a different name? #205
Comments
What behavior do you intend for I have an idea of what a project could be, so excuse me if I'm going off in a wildly different direction with the following... So I do know of a pattern, such as in haskell-flake where you can have multiple Alternatively, maybe haskellProjects.default.basePackages = pkgs.haskell.packages.ghc948; users could write projects.default = {
imports = [ inputs.haskell-flake.flakeProjectModule ]; # typically just one import. different projects for each language?
basePackages = pkgs.haskell.packages.ghc948;
}; Meanwhile haskell-flake or any other reusable project / perSystem-level module could write carelessly to options such as The latter syntax is a bit more verbose, but might become very familiar if a module-based solution to the portable service layer takes off. What's nice though is that it makes a bit more intuitive that all projects eventually share a namespace, of flake output prefixes. Nonetheless, the prior syntax could be preserved as an alias for doing the latter. What's not immediately obvious to me is how project should refer to one another, as what I've described so far basically jails those modules. Maybe it should just be up to the "user" to link up any projects if needed.
Projects could also be nested. Their behavior is like a function that siphons stuff from one perSystem-like context to another perSystem-like context - no reason why that wouldn't compose, or even compose automatically without implementing anything extra. Interesting. |
@roberth thanks for the thoughtful response!
Haskell-flake looks similar to what I've implemented thus far! The difference is that, as you picked up on and discussed above, the project concept is generic, and submodules define toolchain-specific options and functionality. I've written a few of these modules - e.g. for python+poetry, rust, and golang. Currently they are somewhat rudimentary and opinionated :) Each project produces a single "top-level" package named
If I'm understanding you correctly, this sounds similar to what my project-level
Your subsequent example looks good to me :)
Now that is very interesting, kind of an expansion upon sub-packages. If projects define shells, do nested projects result in namespaced devShells? |
Yes, I think all output-inspired options should translate to actual flake outputs, whether that's |
Implemented a proof of concept of the approach I was aiming for, where you can do something like: fp.lib.mkFlake {inherit inputs;} {
projects.sample = {pkgs, ...}: {
go.enable = true;
shell.packages = [pkgs.delve];
};
} So |
Is there a way to achieve this with the existing flake parts infrastructure? If I have a
|
Building on flake-parts, I'd like to create some base modules that allow developers to define "projects", like so:
Projects will translate to a set of packages on the flake, along with a devshell, based on the language choice.
Customization will be possible, e.g.:
So far, using flake-parts, the best I can come up with is:
This works OK, but I'm hoping to remove the need for
perSystem
here, as projects are inherentlyperSystem
. I'm guessing I might be able to usemkPerSystem
option in some way, but thus far haven't been able to figure out how. Suggestions would be appreciated!The text was updated successfully, but these errors were encountered: