-
-
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
neovim: add a checkPhase in the wrapper #352727
base: master
Are you sure you want to change the base?
Conversation
39e2a8e
to
3a9dd69
Compare
# build should fail when this gets uncommented | ||
# luaRcContent = "toto"; |
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.
Is this supposed to stay ? I see how it can be an example.
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 was not sure how to test for a build failure. So I added this to be able to check. Happy to remove it or you have another suggestion
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 was not sure how to test for a build failure.
You can use pkgs.testers.testBuildFailure
to make a test that passes when the derivation you pass to it fails.
We use this in nixvim: https://github.com/nix-community/nixvim/blob/main/tests/failing-tests.nix
@@ -147,7 +148,7 @@ let | |||
|
|||
pname = "neovim"; | |||
version = lib.getVersion neovim-unwrapped; | |||
in { | |||
in builtins.removeAttrs attrs ["extraPython3Packages" "extraLuaPackages" ] // { |
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.
Is that related to enabling the check phase ?
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.
instead of adding inherit doCheck
I thought I could remove all the inherit withPython, etc
by directly reusing the removeAttrs. Except I haven't removed the other withXX
so it's a bit redundant :/ Had to remove everything that is a function from attrs since nix cant serialize it
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.
Ok I see... Feels a bit hacky no ?
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.
that's how most builders work so I am not sure. It's a style tradeoff. Anyhow I've reverted it since it seems confusing and might have some unforeseen consequences
|
@MattSturgeon thanks for the pkgs.testers.testBuildFailure tip.
@Artturin seems like you touched expect-failure.sh last. Is it because of
which fails with
Should I wrap the call in
as presented in the doc ? |
No problem 😁
🤔 Is it a build failure or an eval error you're testing for?
That's what we do in nixvim; pass the failing derivation into another test that can assert it failed in the expected way. |
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.
If nixpkgs-review passes, LGTM. Nice and simple feature
Though maybe document it somewhere?
$out/bin/nvim -i NONE -e +quitall! | ||
runHook postCheck | ||
''; |
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.
''; | |
''; |
add a checkPhase (if doCheck == true, disabled by default) that tries to start neovim and fails in case of errors. It allows to catch small misconfiugurations before switching to a new config.
b9b4b2a
to
564a284
Compare
it would be better but this should work as is, without needing to check for the failure.
Issue is this appears only in the unstable wrapper. Neovim being popular we've tried to maintain compatibility with the old wrapper to not break configs. I think the new wrapper is better enough than the old one so we can switch. It is something to approach carefully though so let it be for 25.04. I would like to use this PR feature to update the neovim tests so I am going to merge even if it means disabling the doCheck test. I've opened #355953 for a fix to enable the test. |
add a checkPhase (if doCheck == true, disabled by default) that tries to start neovim and fails in case of errors. It allows to catch small misconfiugurations before switching to a new config.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.