Repository navigation
Conversation
xevrion
left a comment
There was a problem hiding this comment.
Thanks a lot for this, a flake is a nice addition and the rar-off default is exactly right.
A few things before merging:
- There's already a nixpkgs-style package in
packaging/nix/package.nixthat installs thehzlink, completions and the man page. Could the flake reuse it? It could takesrcas an argument, so the flake passesselfand nixpkgs passes the taggedfetchFromGitHub, and that would replace the new top-levelnix/folder. - The licence should be
MIT OR Apache-2.0(it only lists MIT), and the description should match the crate's. cargoInstallFlagsisn't read bybuildRustPackage's install step, andzstdandpkg-configshouldn't be needed, since zstd-sys builds its own copy.- The flake's nixpkgs has
allowUnfreeoff, sohatchzip-unfreewill probably failnix flake check. Could the README give the exact command (NIXPKGS_ALLOW_UNFREE=1 nix run --impure github:xevrion/hatchzip#hatchzip-rar)? Naming ithatchzip-rarmight be clearer about what it adds. - Please add
/resultand/result-*to.gitignore, mention in the README that the flake gives the command line tool only for now, and add a line topackaging/nix/README.mdthat a flake exists next to the nixpkgs file. - The devShell uses nixpkgs' rustc, not the 1.95.0 in
rust-toolchain.toml, so clippy may disagree with CI. Either pin it fromrust-toolchain.toml(rust-overlay or fenix) or leave the devShell out. - Small:
nixpkgs.legacyPackages.${system}instead of importing nixpkgs, anddefaultcan point athatchziprather than repeating it.
CI doesn't build Nix, so the flake is only checked by hand: could you paste the output of nix flake check and nix build on the final version? If you get the desktop app building too (it needs fontconfig, libxkbcommon, wayland and the X11 libraries on the library path), that would be great as a follow-up.
|
One more small thing: the PR title check needs a Conventional Commits title, since the title becomes the squashed commit, e.g. |
|
Hi! Thank you for the response. I'm fixing it asap and will @ you whenever it's ready for review. And about building the desktop app, I'll try and if I manage to succeed I'll update the PR title. |
aeb81f8 to
3d81bcf
Compare
|
I'm still trying to compile the GUI. Currently Edit: I have some broken tests for hatchzip-gui in darwin-arm64.
When I print
I guess it's because I have the mac in spanish cx I'll try to fix the test in a separate PR |
3d81bcf to
1a27b9e
Compare
1a27b9e to
9399da6
Compare
|
Hi @xevrion. I would say it's done. One thing worth considering is how this could be consumed from nixpkgs without duplicating the package definition. I'd suggest keeping Then, the nixpkgs package expression could fetch the upstream source and reuse that definition directly. Something along these lines: {
fetchFromGitHub,
nix-update-script,
callPackage,
...
}:
let
version = "0.1.8";
src = fetchFromGitHub {
owner = "xevrion";
repo = "hatchzip";
tag = "v${version}";
hash = "...";
};
in
(callPackage "${src}/packaging/nix/package.nix" {
inherit src version;
}).overrideAttrs (old: {
passthru = (old.passthru or {}) // {
updateScript = nix-update-script {};
};
})This way, nixpkgs only needs to maintain the version and source hash, while the actual packaging logic stays upstream and is shared with the flake. Since the derivation uses the upstream The same approach could be used for |
xevrion
left a comment
There was a problem hiding this comment.
Thanks for sticking with this @rlkandela, the CLI side looks really good now. The flake reuses package.nix, the licence is right, rar is off by default, and the version follows Cargo.toml without any bumping.
On the nixpkgs idea: I'm happy for package.nix to stay a reusable derivation that takes src and version, as long as the flake stays the one path we actually test. One catch: nixpkgs doesn't allow import-from-derivation. Calling a file from the fetched source, or reading its Cargo.lock and Cargo.toml, won't pass their CI, and they ask for cargoHash rather than cargoLock.lockFile. So nixpkgs would still carry its own copy with fetchFromGitHub and cargoHash, but it can be taken straight from this file. Could you note that in packaging/nix/README.md, and update the parts there that still mention the release tag and the hashes?
A few things on the GUI:
hatchzip-gui-rardoesn't passenableRar = true(flake.nix:36-38), so it's the same ashatchzip-gui.- On Linux, fontconfig is found through pkg-config at build time (
yeslogic-fontconfig-sys, via fontique), sopkg-configneeds to come back innativeBuildInputs, with fontconfig inbuildInputs. Has it been built on Linux yet? wrapProgrammoves the binary to.hatchzip-gui-wrapped, and the app registers its right-click menu with its own path (crates/gui/src/shell.rs:15). Those entries would start it without the library path.patchelf --add-rpath ${lib.makeLibraryPath runtimeLibraries} $out/bin/hatchzip-guiinpostFixupavoids the wrapper.- Could it install the desktop file, the metainfo and
packaging/linux/icons/hicolor, like the .deb does (Linux only)? Without them there's no launcher. - For nixpkgs it would need the libraries as separate arguments instead of
pkgs.
Smaller:
nix flake checkstill fails without--impure. Building just the two rar variants from a nixpkgs instance with anallowUnfreePredicatefor hatchzip would fix that, and achecksoutput would make it build the CLI too.lib.licenses.unraris the nixpkgs entry for the UnRAR licence.- Please mention the GUI packages in the README. The title could then be
build(nix): add a flake for the command line tool and desktop app. - The empty
optionalAttrsinappscan go, and theunset ZSTD_SYS_USE_PKG_CONFIGlines look unneeded. Is there a reason for them?
If you'd rather get the CLI in first, splitting the GUI into its own PR is totally fine. Either way, could you paste the nix flake check and nix build output from the final version, ideally from Linux for the GUI? CI doesn't build Nix, so that's our only check.
9399da6 to
d0ae399
Compare
What this changes
Adds a Nix flake and package definition for HatchZip, supporting Linux and macOS on x86_64 and aarch64. Provides default and unfree package variants, as well as runnable flake apps and a development shell.
Why
Makes HatchZip available to Nix users and provides a reproducible way to build and run it across supported platforms, including an opt-in build with RAR support.
Verification
cargo fmt --all --checkandcargo clippy --all-targets -- -D warningspasscargo testpasses