-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
couchdb: add support for version 3.0.0 #84246
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
Conversation
What is the status of this PR? Can you please update it to latest master to avoid the conflict? |
@DamienCassou The last maintainer for couchdb2 seemed to have removed themself, so I wasn't sure if there's someone with enough interest in couchdb and experience in nixos to review this. I've updated this request against master. It would now also make sense to update the couchdb3 version to 3.1.0 with spidermonkey_68. I have some changes for that which I can either integrate into this pull request or a subsequent pull request. Thanks! |
Can you please change your commit to update directly to the very latest?
--
Damien Cassou
|
Hi @DamienCassou I've updated the commit to the latest couchdb version and checked that it must be using the newer version of spidermonkey correctly by using ES6(fat-arrow) and ES10(Object.fromEntries) in a design document. It seems functionally good to me, please let me know if there's anything I can improve to make it suitable for merging. |
Result of 1 package blacklisted:
1 package built:
|
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 is really great work. Thank you. I'm no expert so please take my feedback with a grain of salt. Feel free to ask others for feedback on IRC or on discourse.
pkgs/top-level/all-packages.nix
Outdated
@@ -16185,6 +16185,10 @@ in | |||
erlang = erlangR21; | |||
}; | |||
|
|||
couchdb3 = callPackage ../servers/http/couchdb/3.0.0.nix { |
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.
shouldn't the filename be 3.nix
instead?
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.
Here I'd followed the 2.0.0.nix and used it as a template (relevant bellow). I kind of thought the semver made sense, but probably more for versions like 1.X and 4.X than 2 and 3, since couchdb2&couchdb3 don't have so much going on that is likely to accidentally break compatibility between their minor versions. I could rename both files 2.nix and 3.nix?
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 know
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
version = "3.1.0"; | ||
|
||
|
||
# when updating this, please consider bumping the OTP version |
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.
what do you mean by OTP?
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 is from the 2.0.0.nix and is referring to the erlang/otp version. I removed it entirely since the current version for erlang in nixos is 22 and couchdb3 accepts 22.X, but I will hardcode it to erlang = erlangR22
since couchdb3's pinning is unlikely to keep up with nix's default erlang.
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
postPatch = '' | ||
substituteInPlace src/couch/rebar.config.script --replace '/usr/include/mozjs-68' "${spidermonkey.dev}/include/mozjs-68" | ||
|
||
patch bin/rebar <<EOF |
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.
why isn't that automatically patched by patchShebang?
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.
rebar2 is used at configure/build so fixup is too late, but I changed this to manually call patchShebang.
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
postPatch = '' | ||
substituteInPlace src/couch/rebar.config.script --replace '/usr/include/mozjs-68' "${spidermonkey.dev}/include/mozjs-68" | ||
|
||
patch bin/rebar <<EOF |
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 guess substituteInPlace
would be cleaner than patch
here.
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
|
||
patch bin/rebar <<EOF | ||
1c1 | ||
< #!/usr/bin/env escript |
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 nixpkgs usually use patches in context or unified formats (i.e., +
and -
instead of <
and >
). I might be wrong though.
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
1c1 | ||
< #!/usr/bin/env escript | ||
--- | ||
> #!${coreutils}/bin/env escript |
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.
why going through env
instead of directly #!${pkgs.erlang}/bin/escript
?
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
''; | ||
|
||
configurePhase = '' | ||
./configure --spidermonkey-version 68 |
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 you should use configureFlagsArray
instead
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
''; | ||
|
||
buildPhase = '' | ||
make release |
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 you should use makeFlagsArray
or buildFlagsArray
.
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
installPhase = '' | ||
mkdir -p $out | ||
cp -r rel/couchdb/* $out | ||
wrapProgram $out/bin/couchdb --suffix PATH : ${bash}/bin |
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.
why is the wrapping necessary?
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.
The only purpose seemed to be to achieve the same as patchShebang for the original couchdb script, since patchShebang is fixing the original script, I've removed the wrapping.
pkgs/servers/http/couchdb/3.0.0.nix
Outdated
|
||
meta = with stdenv.lib; { | ||
description = "A database that uses JSON for documents, JavaScript for MapReduce queries, and regular HTTP for an API"; | ||
homepage = http://couchdb.apache.org; |
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.
unquoted urls are deprecated by NixOS/rfcs#45. Please use double-quotes.
Result of 1 package blacklisted:
1 package built:
|
Really good job, thank you! |
Thank you @DamienCassou, I'm very happy with how well the couchdb3 definition cleaned up with your review! |
Motivation for this change
couchdb 3 has been released as a major cleanup release.
Things done
tasks:
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
(None were reported by the wip review)
./result/bin/
)nix path-info -S
before and after)(I think the only relevant documentation is autogenerated from option descriptions, etc?)