-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
rust-analyzer: 2020-08-24 -> 2020-09-14 and some clean-up #97444
Conversation
This update touches node packages, since I literally know nothing about node, I'll leave up the reviewing to someone else. |
9b755ba
to
96f7c95
Compare
@@ -17,26 +18,21 @@ rustPlatform.buildRustPackage { | |||
|
|||
buildAndTestSubdir = "crates/rust-analyzer"; | |||
|
|||
cargoBuildFlags = lib.optional useJemalloc "--features=jemalloc"; | |||
cargoBuildFlags = lib.optional useMimalloc "--features=mimalloc"; |
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.
Note: Upstream PR in rust-lang/rust-analyzer#5354
|
||
nativeBuildInputs = lib.optionals doCheck [ rustPlatform.rustcSrc ]; | ||
nativeBuildInputs = lib.optional useMimalloc cmake; |
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.
Note: Needed for mimalloc_rust
to build its bundled version of the mimalloc library. https://github.com/purpleprotocol/mimalloc_rust#requirements
# Version specific args | ||
, rev, version, sha256, cargoSha256 }: | ||
{ rev, version, sha256, cargoSha256, ... }@args: |
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 it necessary to split the arguments? Looking at the output of rg -B3 '@args'
, it doesn't look like a common pattern in nixpkgs.
patches = [ | ||
# FIXME: Temporary fix for our rust 1.45.0 since rust-analyzer requires 1.46.0 | ||
./no-loop-in-const-fn.patch | ||
./no-option-zip.patch | ||
]; |
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 think this would better belong in generic.nix
, along with other build instructions.
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.
🤔 But it's temporary.
Well, I'm not quite sure what should be put in generic file. You mean all about "how to build", yeah?
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'd expect most patches are supposed to be temporary workarounds, so it wouldn't be a problem as long as there's a comment explaining why they're necessary. If you want to make absolutely sure that you remove the patch when it's no longer needed, I guess you could do something like this:
patches = with lib;
if !versionAtLeast (getVersion rustPlatform.rust.rustc) "1.46.0" then [
# FIXME: Temporary fix for our rust 1.45.0 since rust-analyzer requires 1.46.0
./no-loop-in-const-fn.patch
./no-option-zip.patch
] else warn "Some patches for ${pname} needs to be removed." [];
(edited, it was missing a !
)
This would exclude the patches from the build and warn you about it once rustc
reaches 1.46.0.
You mean all about "how to build", yeah?
Yes.
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 you want to make absolutely sure that you remove the patch when it's no longer needed, I guess you could do something like this
These patches just do the same thing in a more compatible way and don't change any semantics. I think it's not quite necessary to do that check.
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 makes sense.
# Version specific args | ||
, rev, version, sha256, cargoSha256 }: | ||
{ rev, version, sha256, cargoSha256 }: | ||
|
||
{ lib, stdenv, fetchFromGitHub, rustPlatform, darwin, cmake | ||
, useMimalloc ? false | ||
, doCheck ? true | ||
}: |
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.
Could you also make this a simple function instead of a nested one?
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 it necessary? Some are just extracted version related parameters, while others are passed through callPackages
which can be overrided. It's not expected to directly configure rev, version and hashes like other packages in nixpkgs.
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.
It's only a matter of style but I found the original version easier to read than the nested version, although they basically do the same thing.
original:
rust-analyzer-unwrapped = callPackage ./generic.nix rec {
rev = ...;
...
};
nested:
rust-analyzer-unwrapped = callPackage (import ./generic.nix rec {
rev = ...;
...
}) {};
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.
LGTM. The remaining point is a minor style issue, so I don't see much point holding this up.
@oxalica This still needs to go through committer review, but you might want to squash the commits in the meantime. |
The global node-packages ( What's the best practice about these npm packages as only build-dependency? |
50793c7
to
cc5262f
Compare
I refactored the node packages part to use generated standalone @midchildan Have a look? What do you think about it? |
Using node2nix outside of |
@midchildan I'm just tired of generating and generating again over ALL NPM packages used by nixpkgs every time having merge conflict (it's updated quite often). We have (Also Note that just when I typing this comment, there's another update on |
The current situation isn't ideal, but I believe this discussion would be best done in a separate issue because this affects how node packaging should be done in general, and isn't limited to this package. #82662 seems like a good place to start. For now, I'd recommend ignoring merge conflicts until you receive committer approval. You can perform a rebase afterwards. |
cc5262f
to
e6f871c
Compare
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.
LGTM
failures are broken on target branch
https://github.com/NixOS/nixpkgs/pull/97444
2 packages failed to build:
dat vimPlugins.coc-imselect
17 packages built:
bitwarden-cli castnow epgstation joplin lumo mirakurun netlify-cli redoc-cli rust-analyzer rust-analyzer-unwrapped thelounge vimPlugins.coc-eslint vimPlugins.coc-git vimPlugins.coc-metals vimPlugins.coc-prettier vimPlugins.coc-stylelint vimPlugins.coc-vetu
Motivation for this change
Bump version and do some clean-up.
unstable-2020-09-07
requires rustc 1.46.0 to compile but we still have 1.45.2 in master. Patches are introduced for a temporary fix.jemalloc
is removed now, and a new featuresmimalloc
is introduced.rust-analyzer
, which doesn't need it anymore.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)r? @danieldk