-
Notifications
You must be signed in to change notification settings - Fork 54
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
systemFlake: make one unified outputsBuilder #58
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,12 +19,21 @@ | |
extraArgs = sharedExtraArgs; | ||
} | ||
|
||
, packagesBuilder ? null | ||
, defaultPackageBuilder ? null | ||
, appsBuilder ? null | ||
, defaultAppBuilder ? null | ||
, devShellBuilder ? null | ||
, checksBuilder ? null | ||
, outputsBuilder ? channels: { | ||
packages = packagesBuilder channels; | ||
defaultPackage = defaultPackageBuilder channels; | ||
apps = appsBuilder channels; | ||
defaultApp = defaultAppBuilder channels; | ||
devShell = devShellBuilder channels; | ||
checks = checksBuilder channels; | ||
} | ||
Comment on lines
+22
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As you can imagine, this would have a couple consequences.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can use something like this instead?
|
||
|
||
, packagesBuilder ? _: { } | ||
, defaultPackageBuilder ? _: { } | ||
, appsBuilder ? _: { } | ||
, defaultAppBuilder ? _: { } | ||
, devShellBuilder ? _: { } | ||
, checksBuilder ? _: { } | ||
, ... | ||
}@args: | ||
|
||
|
@@ -189,21 +198,11 @@ mergeAny otherArguments ( | |
|
||
pkgs = mapAttrs importChannel channels; | ||
|
||
mkOutput = output: builder: | ||
mergeAny | ||
# prevent override of nested outputs in otherArguments | ||
(optionalAttrs (otherArguments ? ${output}.${system}) | ||
{ ${output} = otherArguments.${output}.${system}; }) | ||
(optionalAttrs (args ? ${builder}) | ||
{ ${output} = args.${builder} pkgs; }); | ||
outputs = mapAttrs | ||
(outputName: output: otherArguments.${outputName}.${system} or { } // output) | ||
(outputsBuilder pkgs); | ||
Comment on lines
+201
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tried filtering for empty attrsets or There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can be a little more restrictive and require users to set What do you think? The implication would be that "defaults" specifically depend on "non-defaults", which semantically kind of makes sense anyhow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is generally a good practice. I have no idea how to implement a restriction for that. If we try and check if something is referring to |
||
in | ||
{ inherit pkgs; } | ||
// mkOutput "packages" "packagesBuilder" | ||
// mkOutput "defaultPackage" "defaultPackageBuilder" | ||
// mkOutput "apps" "appsBuilder" | ||
// mkOutput "defaultApp" "defaultAppBuilder" | ||
// mkOutput "devShell" "devShellBuilder" | ||
// mkOutput "checks" "checksBuilder" | ||
{ inherit pkgs; } // outputs | ||
) | ||
# produces attrset in the shape of | ||
# { nixosConfigurations = {}; darwinConfigurations = {}; ... } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming: I really like
outputsBuilder
. I don't think we should useexports
. Any better ideas?