Skip to content

dwarfs: init at 0.6.1 - #181723

Merged
winterqt merged 2 commits into
NixOS:masterfrom
keksbg:add-dwarfs
Aug 2, 2022
Merged

winterqt merged 2 commits into
NixOS:masterfrom
keksbg:add-dwarfs

Conversation

@keksbg

@keksbg keksbg commented Jul 16, 2022

Copy link
Copy Markdown
Contributor
Description of changes

Added dwarfs, a fast high compression read-only file system using FUSE. Linux-only as FUSE doesn't exist on any other platform (or maybe it does and I just don't know).

Added @keksbg as a new maintainer.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@ofborg ofborg Bot added the 8.has: package (new) This PR adds a new package label Jul 16, 2022
@keksbg keksbg changed the title Add dwarfs dwafs: init at 0.6.1 Jul 16, 2022
@ofborg ofborg Bot added 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Jul 16, 2022
@keksbg keksbg changed the title dwafs: init at 0.6.1 dwarfs: init at 0.6.1 Jul 16, 2022

@fufexan fufexan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tpwrules tpwrules left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thank you for your first submission to Nixpkgs.

I finally got around to preparing my derivation for submission but saw that you made this one first and thus deserve the credit.

That said, there are some things I'd like you to change about yours before it is ready for submission. I highly encourage you to take the logic from mine about enabling building and running the tests. As for the other differences, that's your choice.

@keksbg
keksbg requested a review from tpwrules July 19, 2022 09:16

@tpwrules tpwrules left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great now, thank you! I also tested that everything works on aarch64-linux and it does.

As a final comment, please squash your fix commits, then this should be ready to merge (though I can't do it).

@keksbg

keksbg commented Jul 20, 2022

Copy link
Copy Markdown
Contributor Author

I don't think I can squash this atm, I believe it should be done when it gets merged, though if there's something I have to do it'd be good to know.

@tpwrules

Copy link
Copy Markdown
Contributor

You can do anything to the pull request as long as it's not closed.

Here's how I would rebase it. With your PR branch checked out, run EDITOR=nano git rebase -i HEAD~5 (or use your favorite editor). Follow the directions to change the last three pick commands to squash. Save the file, then edit the commit message when prompted (in this case it should be just dwarfs: init at 0.6.1. Finally, git push --force to update the pull request. It's a fairly simple process and good to know how to do.

@keksbg

keksbg commented Jul 29, 2022

Copy link
Copy Markdown
Contributor Author

/marvin opt-in
/status needs_merger

@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/1048

@winterqt winterqt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, just a few comments and things to discuss.

@winterqt winterqt Jul 31, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So by my understanding of the project's CMakeLists file, FUSE 3 can also build the driver for FUSE 2. Maybe we should put this behind an option so people who don't want the FUSE 2 driver in addition to the FUSE 3 one can disable it? (Should it be enabled by default? Is there a common use case for FUSE 2 that makes it so it should?)

Or maybe we should just always compile it, as we do now? Not sure, let me know what you think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I based that on @tpwrules's derivation (found here) which talks about how (most) other FUSE filesystems include a FUSE legacy driver by default too. I haven't went out to confirm it myself, but I trust them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need fuse2 at all? If it is legacy we might as well not include it until someone needs it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've commented out the FUSE2 driver for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpwrules What's your opinion on the legacy FUSE driver option; was there a reason you originally included it in your derivation?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A somewhat random survey of existing FUSE filesystems in nixpkgs and because it was supported by dwarfs. If you don't think it's necessary to have by default I have no problem having it removed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do it in other packages, maybe it's worth enabling by default, but make it configurable via an override flag?

@tpwrules tpwrules Aug 2, 2022 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO that seems too complicated for now and I don't think anything currently existing has the option like that. It should either have both 2 and 3, or just 3. We can see if a legacy usecase presents itself down the line.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, then. If other packages have it unconditionally, it may be good to follow their lead? /shrug

@winterqt

Copy link
Copy Markdown
Member

Apologies for the duplicate review comments between Sandro and I -- that's my fault. I didn't realize he reviewed this.

@keksbg

keksbg commented Jul 31, 2022

Copy link
Copy Markdown
Contributor Author

I'll try getting a monkeypatch working now. I'll update you once that's done (under a seperate branch, probably)

@keksbg

keksbg commented Jul 31, 2022

Copy link
Copy Markdown
Contributor Author

I accidentally pushed another package I was working on, oops. Sorry.

@keksbg

keksbg commented Aug 1, 2022

Copy link
Copy Markdown
Contributor Author

I'll try getting a monkeypatch working now.

I ended up not having time to do this so.. sorry, but you'll just have to take my word for it. It'd be a mess. The current creating of a git repository, into patching one file should be better. As Winter pointed out, it should result in less breakage in the long run.

@winterqt winterqt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, you removed zstd and xxhash from buildInputs, so it falls back to the embedded copies. Do you mind adding them back? (I'm assuming it was by mistake.)

@keksbg

keksbg commented Aug 1, 2022

Copy link
Copy Markdown
Contributor Author

[...] (I'm assuming it was by mistake.)

That is indeed correct. Sorry, again.

@keksbg

keksbg commented Aug 1, 2022

Copy link
Copy Markdown
Contributor Author

Yes to everything you just said. I think this is the midnight brain having kicked in now and I'm just messing up minor shit left and right.

@winterqt winterqt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I submitted this a while ago, thanks GitHub.

@SuperSandro2000 SuperSandro2000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took a bit but now it is nice

@winterqt winterqt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's land it. Worst case scenario we add the legacy FUSE driver later.

@winterqt
winterqt merged commit 8849b7a into NixOS:master Aug 2, 2022
@tpwrules

tpwrules commented Aug 2, 2022

Copy link
Copy Markdown
Contributor

Thank you all. This process was a little bumpier than usual but it's a great contribution.

@keksbg

keksbg commented Aug 2, 2022

Copy link
Copy Markdown
Contributor Author

Quite bumpy, but at least it works as a first contribution. Thanks to all for the reviews and help.

@vobloeb

vobloeb commented Aug 4, 2022

Copy link
Copy Markdown
Contributor

Has anyone tried compressing the nix store with this?

@tpwrules

tpwrules commented Aug 4, 2022 •

Copy link
Copy Markdown
Contributor

Yeah, I did some experiments and saw ratios of 3-3.5x (that is, compressed size * ratio = original size) for my machines with stores >10 gigs. I didn't try actually booting a machine from it though or otherwise using nix tooling on it, but it should be possible with overlayfs and some cleverness in the initrd I think.

The biggest disadvantage is that there's no way yet to incrementally build a dwarfs image, so you'd have to periodically re-compress the whole thing, including stuff you'd compressed previously, as you modified the store over time.

--- /dev/null
+++ b/include/dwarfs/version.h
@@ -0,0 +1,16 @@
+// autogenerated code, do not modify

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keksbg @tpwrules How does one generate it, and when should one?

The default.nix would really benefit from some comments on what is going on.

Trying to upgrade to a newer version, the build fails with 'PRJ_GIT_DATE' was not declared in this scope and there isn't a good explanation of what needs to be done about it.

@tpwrules What about the special flags upstream made for us in mhx/dwarfs#155 ?

Should those be used?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not think it would need to be regenerated, it's autogenerated by the build system and we fill it in separately. But I guess its structure did change. We should migrate to the special flag then.

I can look at it myself in a day or two and ask you to review, or you can start a draft PR and I can weigh in.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing it in PR #321996

nh2 added a commit to nh2/nixpkgs that referenced this pull request Jun 23, 2024
The previous update to 0.9.9 didn't actually update the version because
it forgot to update the hash,
so the old source archive continued to be used:
NixOS#312656 (comment)

Because now the new code is actually pulled in, it needs new
dependencies and fixes.

* `PRJ_GIT_DATE` is needed.
  Remove the manual replacement of versions, and use the
  approach that upstream added for nixpkgs:
  NixOS#181723 (comment)
  This avoids cases like this, where new versioning fields are added;
  upstream takes care of it for us now.
* Use `finalAttrs` for correct version overriding.
* Fix compile error with `gtest`, see added comments.
* Enable FLAC support
  (and the tests don't pass without it on this version, see
  mhx/dwarfs@21901d7)
github-actions Bot pushed a commit that referenced this pull request Jun 24, 2024
The previous update to 0.9.9 didn't actually update the version because
it forgot to update the hash,
so the old source archive continued to be used:
#312656 (comment)

Because now the new code is actually pulled in, it needs new
dependencies and fixes.

* `PRJ_GIT_DATE` is needed.
  Remove the manual replacement of versions, and use the
  approach that upstream added for nixpkgs:
  #181723 (comment)
  This avoids cases like this, where new versioning fields are added;
  upstream takes care of it for us now.
* Use `finalAttrs` for correct version overriding.
* Fix compile error with `gtest`, see added comments.
* Enable FLAC support
  (and the tests don't pass without it on this version, see
  mhx/dwarfs@21901d7)

(cherry picked from commit 9bb686f)
veprbl pushed a commit that referenced this pull request Aug 20, 2024
The previous update to 0.9.9 didn't actually update the version because
it forgot to update the hash,
so the old source archive continued to be used:
#312656 (comment)

Because now the new code is actually pulled in, it needs new
dependencies and fixes.

* `PRJ_GIT_DATE` is needed.
  Remove the manual replacement of versions, and use the
  approach that upstream added for nixpkgs:
  #181723 (comment)
  This avoids cases like this, where new versioning fields are added;
  upstream takes care of it for us now.
* Use `finalAttrs` for correct version overriding.
* Fix compile error with `gtest`, see added comments.
* Enable FLAC support
  (and the tests don't pass without it on this version, see
  mhx/dwarfs@21901d7)

(cherry picked from commit 9bb686f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants