Skip to content

Commit

Permalink
Add nix package.
Browse files Browse the repository at this point in the history
  • Loading branch information
vifino committed May 29, 2022
1 parent b2cf731 commit 07d86c7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ffshot
result
6 changes: 6 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
with import <nixpkgs> {};
stdenv.mkDerivation {
src = ./.;
name = "ffshot";
buildInputs = [ xorg.libxcb xorg.xcbutilimage ];
enableParallelBuilding = true;

installPhase = ''
make install PREFIX=$out
'';
}
3 changes: 2 additions & 1 deletion ffshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ int main(int argc, char* argv[]) {
free(gr);

// Get image from the X server. Yuck.
fprintf(stderr, "%08x: %ux%u\n", wid, width, height);
ic = xcb_get_image(con, XCB_IMAGE_FORMAT_Z_PIXMAP, wid, 0, 0, width, height, ~0);
ir = xcb_get_image_reply(con, ic, NULL);
if (!ir)
Expand All @@ -97,6 +96,8 @@ int main(int argc, char* argv[]) {
default:
errx(2, "No support for bit depths other than 24/30/32 bit: bit depth %i. Fix me?", bpp);
}

fprintf(stderr, "%08x: %ux%u @ %ubpp\n", wid, width, height, bpp);

// allocate buffer.
uint16_t* img = malloc(width * height * 8);
Expand Down
4 changes: 4 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
with import <nixpkgs> {};
pkgs.mkShell {
buildInputs = [ xorg.libxcb xorg.xcbutilimage ];
}

0 comments on commit 07d86c7

Please sign in to comment.