Skip to content
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

Add haskellFlakeProjectModules option #79

Merged
merged 7 commits into from
Feb 11, 2023
Merged

Conversation

srid
Copy link
Owner

@srid srid commented Feb 10, 2023

Implements #12 (comment)

@srid
Copy link
Owner Author

srid commented Feb 10, 2023

This works in srid/haskell-template#85

image

test/flake.nix Outdated
@@ -23,26 +23,23 @@
inputs.check-flake.flakeModule
];
perSystem = { self', pkgs, ... }: {
haskellFlakeProjectModules.default = {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roberth I must say I'm not happy with this flake-parts module now providing two (not one) top-level options -- haskellProjects and, now, haskellFlakeProjectModules.

A single top-level would make sense. Like:

{ 
  haskellFlake = {
    projectModules = { .. };
    projects.default = { .. };
  };
}

It also makes the option name obvious enough to indicate that it comes from inputs.haskell-flake rather than any other inputs (the same cannot be strictly said for haskellProjects naming). A similar naming is adopted by other modules like https://github.com/Platonic-Systems/mission-control

wdyt?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH, the current way of naming it outputs.haskellFlakeProjectModules.${system}.default appears to follow the unspoken convention of using flat attributes à la nixosModules, darwinModules, etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need options in two separate locations anyway. See previous comment https://github.com/srid/haskell-flake/pull/79/files#r1103655549

flat attributes à la nixosModules,

Flat attributes is probably the way to go. I've made an exception for flakeModule, which I'm not eager to remove until the imports UX is improved. Not sure exactly what can be achieved in that area yet. My previous attempt found too much resistance, so I'll have to find something creative... Anyway, until then, I'd say flat is good.

@srid srid marked this pull request as ready for review February 10, 2023 20:38
@srid srid requested a review from roberth February 10, 2023 21:36
test/flake.nix Outdated
@@ -23,26 +23,23 @@
inputs.check-flake.flakeModule
];
perSystem = { self', pkgs, ... }: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think using the local pkgs is the right thing to do. It should come from the environment where it's imported, so all we can really need to do is flake.haskellFlakeProjectModules.foo = { pkgs, ... }: { overrides = f pkgs; };.

If a flake does need to reference packages it defines, it can do so with getSystem and the like.

@srid srid merged commit 5d1f6d9 into master Feb 11, 2023
@srid srid deleted the project-modules-output branch February 11, 2023 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants