lib.customisation: add uncurried form of makeScopeWithSplicing#245957
Conversation
12 tasks
Artturin
reviewed
Jul 28, 2023
Artturin
reviewed
Jul 28, 2023
added 2 commits
August 14, 2023 02:50
Deeply-curried functions are pretty error-prone in untyped languages like Nix. This is a particularly bad case because `top-level/splice.nix` *also* declares a makeScopeWithSplicing, but it takes *two fewer arguments*. Let's add a version that uses attrset-passing form, to provide some minimal level of sanity-checking. This also provides defaults for keep and extra (these are often unneeded by the user).
lopsided98
reviewed
Aug 21, 2023
| makeScopeWithSplicing = | ||
| splicePackages: newScope: otherSplices: keep: extra: f: | ||
| makeScopeWithSplicing' { | ||
| inherit splicePackages newScope otherSplices keep extra f; |
Contributor
There was a problem hiding this comment.
This calls makeScopeWithSplicing' incorrectly:
error: function 'makeScopeWithSplicing'' called with unexpected argument 'f'
at /nix/store/n9fsxf3g69lp3rhkbb6biqpc18lp2gr8-source/lib/customisation.nix:291:5:
290| makeScopeWithSplicing' =
291| { splicePackages
| ^
292| , newScope
| inherit splicePackages newScope otherSplices keep extra f; | ||
| }; | ||
|
|
||
| /* Like the above, but aims to support cross compilation. It's still ugly, but |
Contributor
There was a problem hiding this comment.
Also, this comment is a bit confusing now; it should probably explicitly say "Like makeScope...".
github-actions bot
pushed a commit
to arcnmx/nixpkgs-lib
that referenced
this pull request
Aug 22, 2023
github-actions bot
pushed a commit
to arcnmx/nixpkgs-lib
that referenced
this pull request
Aug 29, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Deeply-curried functions are pretty error-prone in untyped languages like Nix. This is a particularly bad case because
top-level/splice.nixalso declares a makeScopeWithSplicing, but it takes two fewer arguments.Let's add a version that uses attrset-passing form, to provide some minimal level of sanity-checking.
This also provides defaults for keep and extra (these are often unneeded by the user).
Reimplements #245824.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)