-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
lib.customisation: add uncurried form of makeScopeWithSplicing #245957
Conversation
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).
makeScopeWithSplicing = | ||
splicePackages: newScope: otherSplices: keep: extra: f: | ||
makeScopeWithSplicing' { | ||
inherit splicePackages newScope otherSplices keep extra f; |
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.
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
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.
makeScopeWithSplicing' { | ||
inherit splicePackages newScope otherSplices keep extra f; | ||
}; | ||
|
||
/* Like the above, but aims to support cross compilation. It's still ugly, but |
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.
Also, this comment is a bit confusing now; it should probably explicitly say "Like makeScope...".
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.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).
Reimplements #245824.
Things done
sandbox = true
set 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/
)