-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
haskell: move generateOptparseApplicativeCompletions into pkg sets for cross support #190536
haskell: move generateOptparseApplicativeCompletions into pkg sets for cross support #190536
Conversation
addOptparseApplicativeCompletionScripts = exeName: pkg: | ||
builtins.trace "addOptparseApplicativeCompletionScripts is deprecated in favor of generateOptparseApplicativeCompletion. Please change ${pkg.name} to use the latter or its plural form." | ||
(generateOptparseApplicativeCompletion exeName pkg); | ||
lib.warn "addOptparseApplicativeCompletionScripts is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" | ||
(__generateOptparseApplicativeCompletion exeName pkg); |
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.
I don't feel strongly about this, but maybe we could just remove this function? It has been here and been deprecated for quite a long time, right?
I can't ever recall seeing this in the wild.
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.
Deleting it form haskell.lib.compose
should be fine in any case, we can still keep it in haskell.lib
for backwards compatibility.
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 looks really good to me, thanks for putting it together!
3aa3e54
to
31e1c09
Compare
*/ | ||
generateOptparseApplicativeCompletions = commands: pkg: | ||
pkgs.lib.foldr generateOptparseApplicativeCompletion pkg commands; | ||
lib.warn "haskellLib.generateOptparseApplicativeCompletions is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" |
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.
lib.warn "haskellLib.generateOptparseApplicativeCompletions is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" | |
lib.warnIf (lib.isInOldestRelease 2211) "haskellLib.generateOptparseApplicativeCompletions is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" |
We should give third-party projects a bit of time before warning, so that they aren't asked to apply the change before all supported Nixpkgs releases support the new method.
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.
Side note: The naming of this function is so confusing, it took me like 5 minutes to figure out what it means.
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.
Not sure which one you mean, but I wrote both and I agree. I'm open to suggestions.
Deprecate haskell.lib{,.compose}.generateOptparseApplicativeCompletion* in favor of the newly added haskell.packages.*.generateOptparseApplicativeCompletions (plural!) which takes into account whether we are cross-compiling or not. If we are, generating completions is disabled, since we can't execute software built for a different platform. The move is necessary, so we can receive the /same/ stdenv as the package we are overriding in order to accurately check whether we can execute produced binaries. Resolves NixOS#174040. Resolves NixOS#49648.
This function was deprecated when it was first added to haskell.lib.compose, so we can probably safely drop it.
5a8fa99
to
68df602
Compare
Deprecate haskell.lib{,.compose}.generateOptparseApplicativeCompletion* in favor of the newly added
haskell.packages.*.generateOptparseApplicativeCompletions (plural!) which takes into account whether we are cross-compiling or not. If we are, generating completions is disabled, since we can't execute software built for a different platform.
The move is necessary, so we can receive the /same/ stdenv as the package we are overriding in order to accurately check whether we can execute produced binaries.
Resolves #174040.
Resolves #49748.
Description of changes
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/
)nixos/doc/manual/md-to-db.sh
to update generated release notes