-
-
Notifications
You must be signed in to change notification settings - Fork 15.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
blkhash: init at 0.7.1 #215551
base: master
Are you sure you want to change the base?
blkhash: init at 0.7.1 #215551
Conversation
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.
Looks good to me, but I don't know anything about Nix :-)
postUnpack = ''( | ||
cd "$sourceRoot/subprojects" | ||
cp -R --no-preserve=mode,ownership ${unity} unity | ||
)''; |
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 we fetch the source, the normal build flow documented in the project README.md
already handles the subprojects.
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.
Unfortunately, that's not a case here, as nix builds packages in offline sandbox to improve reproducibility.
Fetching subprojects manually gives control over the version of dependencies, so nix is able to build the same package with the same checksum independently from the changes on Unity repo.
I've tried to check how other packages using meson resolved that issue, and didn't find any better way to do that, but if anyone has better solution please let me know.
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.
Adding fetchSubmodules = true
to fetchFromGitLab will do the trick for you.
I tested this pr on with single user Nix install:
blksum looks funcional. Looks like all other files look right, but I don't know enough about Nix to detect issues. Issues:
Otherwise it is awesome to see this package here, thanks @noisersup! |
705576f
to
3d2eda5
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.
Currnet version works for me. See inline comments for possible improments.
asciidoc | ||
] ++ lib.optional (enableLibnbd) libnbd; | ||
|
||
mesonFlags = lib.optional (!enableLibnbd) ["-Dnbd=disabled"]; |
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.
meson should work automatically without specifying anything. The default value is "auto":
option('nbd', type: 'feature', value: 'auto', description: 'Support NBD URL')
So I think it is good enough to require libnbd only when it is available.
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 had some issues when I was trying to build derivation without libnbd. When I was compiling manually it worked correctly, but with nix - it just returns the error. Maybe it's because some default meson flags that nix uses.
EDIT: It seems it is because of -Dauto_features=enabled which is set by default, changed it to auto.
, pkg-config | ||
, cmake | ||
, openssl | ||
, enableLibnbd ? stdenv.isLinux, libnbd |
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.
isLinux is likely correct now, but I think a better way woul be to add the
dependency dynanically if a libnbd nix package is available for the target.
But I think it is good enough for now.
cmake | ||
openssl | ||
qemu-utils | ||
asciidoc |
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.
Sorting this list would be nice.
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 struggling with deciding what order should be used here. Many derivations in nixpkgs don't use lexicographical order. I would suggest to keep buildInputs
sorted, but for attribute set on top of nix file I suggest to place all things related to nix tooling (like lib or fetchFromGitLab) on top of other arguments.
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 sorting helps with simple lists. The order of top level things
should depend on the semantics. Your suggestion sounds good.
meson | ||
ninja | ||
pkg-config | ||
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.
cmake not needed.
3d2eda5
to
37421d8
Compare
Thank you for your detailed look on this PR! I've applied following changes:
|
37421d8
to
fe14afc
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.
Looks good to me.
I opened an issue in blkhash for the build failure on darwin:
https://gitlab.com/nirs/blkhash/-/issues/75
I think we can limit the build to Linux for now, and add darwin support
when blkhash is fixed.
Also tested on Fedora 37 with single user Nix setup.
@noisersup the macOS issue is fixed by: It can be useful to test this change with commit 389fbcf1a4906cb4987feb8b4f524f1cb947309c |
fe14afc
to
c49e851
Compare
@nirs Thank you for quickly fixing this issue, it looks like it works now! Would you rather merge nix derivation at 0.6.1 and mark darwin as broken until new version or wait for your fix to be merged? |
@noisersup Great! the fix is merged as fd611881862d375b83f216cf1c59574b3c8ccf70. I plan to release blkhash 0.7.1 this weekend. You can build this package based on the |
I believe that there's not much cases in nixpkgs where we track the commit in place of version/tag. ncmpcpp for example, is still on version from 2021, just because the upstream does not tag new changes (latest commit on master branch from Dec 31 2022). I would suggest to init blkhash at 0.6.1 without darwin support and if it's going to be merged, just add darwin support after weekend. If it's not merged yet, and I highly believe it won't :) then we will modify this PR to point at newer version. |
I would do the same. |
@noisersup blkhash 0.7.1 is available now, you can update the version. |
c49e851
to
027bd01
Compare
Hi, sorry for a little delay I'm on vacation right now :) I've bumped the version to 0.7.1, so CI should pass. Thank you for release! |
@noisersup: One issue - current build installs unity headers and pkgconfig files:
This is wrong, since unity is a test dependency and it should not be installed This is an issue with latest meson, fixed upstream like this: If there is a way to set arguments for the meson install command, you need to add |
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.
Need to avoid installing unity headers and libraries.
@noisersup I found why unity is installed: I posted a fix to unity: Once this is fixed in unity, there will be no need to add --skip-subprojects. Or, you can add this tiny patch to build with unity v2.5.2, which does not have |
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 unity fix was merged, so current code should be fine.
027bd01
to
7944544
Compare
Thank you for handling this problem! I've updated Unity repo revision to the latest and it seems that it doesn't import additional headers. |
@noisersup anything blocking this PR? |
The lack of reviewers. I'll ask in community. |
@noisersup new release landed, it would be nice to update this package. I don't think anything related to packaging was changed, so you just need to update |
@noisersup blkhash 0.9.1 released: |
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 the package should go to pkgs/by-name
, without adding top-level reference.
makeWrapper | ||
meson | ||
ninja | ||
openssl |
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.
openssl
should be in buildInputs
in most cases.
cp -R --no-preserve=mode,ownership ${unity} unity | ||
)''; | ||
|
||
buildInputs = [ ] ++ lib.optional (enableLibnbd) libnbd; |
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.
buildInputs = [ ] ++ lib.optional (enableLibnbd) libnbd; | |
buildInputs = lib.optionals enableLibnbd [ libnbd ]; |
homepage = "https://gitlab.com/nirs/blkhash"; | ||
license = licenses.lgpl21Plus; | ||
maintainers = with maintainers; [ noisersup ]; | ||
platforms = platforms.unix; |
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.
platforms = platforms.unix; | |
mainProgram = "blksum"; | |
platforms = platforms.unix; |
postUnpack = ''( | ||
cd "$sourceRoot/subprojects" | ||
cp -R --no-preserve=mode,ownership ${unity} unity | ||
)''; |
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.
Adding fetchSubmodules = true
to fetchFromGitLab will do the trick for you.
|
||
src = fetchFromGitLab { | ||
owner = "nirs"; | ||
repo = pname; |
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.
repo = pname; | |
repo = "blkhash"; |
]; | ||
|
||
# don't enforce libnbd | ||
mesonAutoFeatures = "auto"; |
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 can hide errors and make the product not as expected. For example, libnbd may not actually be found when building for Linux.
# don't enforce libnbd | ||
mesonAutoFeatures = "auto"; | ||
|
||
postInstall = '' |
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.
postInstall = '' | |
postFixup = '' |
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