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
Package hexd and pixd #31567
Package hexd and pixd #31567
Conversation
Cool! Can I suggest that you
|
Alright, will do. How should I format the commit message of the commit that only adds me to maintainers.nix? (Amusingly, I had three commits at first, but then rebased after reading the contributions guidelines, and their notes about commit message formats) |
Hehe, yes, I guess there is no standard for the lib/maintainers.nix file. (Looking at "git log -- lib/maintainers.nix" shows all kinds of formats.) I guess I'd use "maintainers: add X" or "Add X as maintainer". Your choice :-) |
916c8c4
to
8dc702d
Compare
Hmm, I made some changes to use the (newly released 😄) 1.0.0 releases of the two tools, but kind-of expected I might have to change the hashes too... however, when I try to build the derivations after making changes to them, I simply get I'm not entirely sure how to properly rebuild the derivations, what am I missing here? (For future reference/my own learning, if nothing else!)
|
Did you remember to update the derivation name/version, which in turn makes a change in the url passed to fetchurl? If you did, then it's a bug. If you didn't, it's a feature. (Oh, wait. You're using fetchFromGitHub... Well, it's just a wrapper around fetchurl.) fetchurl re-downloads if the name or sha256 changes. Most often "name" is not passed directly to fetchurl, instead it takes "name" from the basename of the URL. If there is no change in inputs for fetchurl, it returns the cached artifact (which is uniquely identified by its hash). I mostly change the first few chars of the hash to "00000...." and rebuild the package. Then update the hash according to the error message. There is also a tool called nix-prefetch-url which can be used. |
I did update the version in the derivation (that's why I put the firefly@as ~/local/repos/nixpkgs
% vim pkgs/tools/misc/hexd/default.nix # updating the hash to a dummy one
firefly@as ~/local/repos/nixpkgs
% nix-build -A hexd # still prints the path to an old, cached build in the store!
/nix/store/2q8wasr5zxn1cfp9jpgrfy3nd8clrcvq-hexd-2017-11-12
firefly@as ~/local/repos/nixpkgs
% git diff
diff --git a/pkgs/tools/misc/hexd/default.nix b/pkgs/tools/misc/hexd/default.nix
index b080e23b..a3de5f62 100644
--- a/pkgs/tools/misc/hexd/default.nix
+++ b/pkgs/tools/misc/hexd/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
owner = "FireyFly";
repo = "hexd";
rev = "v${version}";
- sha256 = "1lm0mj5c71id5kpqar8n44023s1kymb3q45nsz0hjh9v7p8libp0";
+ sha256 = "zzzzzzzzzzzzzzzzzzzzz4023s1kymb3q45nsz0hjh9v7p8libp0";
};
makeFlags = [ "PREFIX=$(out)" ]; I have no clue why the old, cached build is used here, now... I tried building with % diff /tmp/xxd.build.err /tmp/hexd.build.err
34,36d33
< evaluating file ‘/home/firefly/local/repos/nixpkgs/pkgs/tools/misc/xxd/default.nix’
< evaluating file ‘/home/firefly/local/repos/nixpkgs/pkgs/applications/editors/vim/default.nix’
< evaluating file ‘/home/firefly/local/repos/nixpkgs/pkgs/applications/editors/vim/common.nix’
95,96c92
< evaluating file ‘/home/firefly/local/repos/nixpkgs/pkgs/development/libraries/ncurses/default.nix’
< derivation is /nix/store/za3d6w6fi4w4pnkfl29mpbg8kvwzyicf-xxd-8.0.1257.drv
---
> derivation is /nix/store/qjwb50la23smwvmdb681yk90pk85586p-hexd-2017-11-12.drv I'm expecting my |
There is one odd thing here. Your derivation still outputs "/nix/store/...-hexd-2017-11-12". I think that should have been "...hexc-1.0.0", if you updated the version attribute. The only reason I can think of causing fetchurl to return the old source package is if the basename of the url did not change. |
This is a bit confusing, but it is intentional. c3255fe was made with the purpose to make all sources with the same content to be considered the same — in the case of |
@orivej: Thanks! |
@orivej Hmm, |
Could you attach the full |
This is stderr of Edit: oh, with
Here's the full log with |
And what is the output of |
... oh. Oh dear, that was silly of me. Before deciding to put these packages in nixpkgs I was experimenting with declarative management of user packages, and had put my Sorry about that. I'm getting the expected hash conflict now with the all-z hash, and getting the expected output after changing to the correct hash. Thanks for helping me debug this :) Also, I've now built the most recent versions (after switching to using the version tags) and they do build and work properly with the most recent force-pushed rebase. |
Applied to master (bdce932 and 2 parents). Thanks! |
Motivation for this change
Packaging
hexd
andpixd
, two closely related utilities I wrote.Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)hexd
is a simple hexdump tool which colourises different ranges of bytes with different colours, which makes it easy to spot patterns in the data. It also provides some useful flags, such as the ability to only hexdump a specific range of a file (or of several files).pixd
is based onhexd
but tweaked to use half-block characters and 24-bit colours, displaying each byte as a coloured half-block. Each of the 256 byte values gets assigned to a unique colour taken from a colour palette (which is overridable with an environment variable), again for purposes of showing the structure and repeating patterns. That said, in practice I findhexd
to be a lot more useful for reverse-engineering purposes, personally.I wrote pixd this spring, and although it was mostly an experiment in visualizing arbitrary binary data, a lot of people seemed to like it and it got packaged in some other assorted distros (mostly ones related to computer security, penetration testing and so on). I thought I might as well write my own nix derivations for them, and having written them I thought I might as well contribute them back as well. :)
That said, I've been using NixOS for a grand total of a week now, and these are the second and third nix derivations I've written, so it'd be great if they were thoroughly reviewed and I'd be happy for any suggestions of improvements/changes. (The first one I wrote was me packaging pangoterm, and although I'm intending to pull-request it too, it's not quite ready for that yet. Since
hexd
andpixd
basically amount tomake && make install
I figured they're good newbie derivations for me too.)