How to Install Pixelator on NixOS

  1. Download Pixelator.
  2. Clone my fork of nix-patchtools.
  3. Modify examples/pixelator.nix with the appropriate path to your pixelator-1.0.5-linux-x64.zip.
with import <nixpkgs> {};

let
  autopatchelf = import ../default.nix;
in
stdenv.mkDerivation {
  name = "pixelator";
  src = ~/downloads/pixelator-1.0.5-linux-x64.zip;
  nativeBuildInputs = [
    libudev0-shim
    udev
    dpkg
    autopatchelf
    unzip
    zlib
    harfbuzz
    freetype
    makeWrapper
];
  libs = stdenv.lib.makeLibraryPath [
    glibc
    libgcc
    gcc-unwrapped
    gtk2-x11
    zlib
    gnome2.pango
    atk
    cairo
    gdk_pixbuf
    glib
    fontconfig
    freetype
    dbus_daemon.lib
    dbus.lib
    xlibs.libX11
    xlibs.libxcb
    xlibs.libXi
    xlibs.libXcursor
    xlibs.libXdamage
    xlibs.libXrandr
    xlibs.libXcomposite
    xlibs.libXext
    nix
    xlibs.libXfixes
    xlibs.libXrender
    xlibs.libXtst
    xlibs.libXScrnSaver
    gnome2.GConf.out
    nss.out
    alsaLib.out
    nspr.out
    cups.lib
    xorg_sys_opengl.out
    expat.out
    harfbuzz.out
    libudev0-shim
];
  installPhase = ''
    chmod +xX pixelator
    chmod +xX _pixelator_cmd.exe
    mkdir -p $out/bin
    mv * $out
    autopatchelf $out

    ln -s $out/pixelator $out/bin/pixelator
    ln -s $out/_pixelator_cmd.exe $out/bin/_pixelator_cmd.exe
  '';
  preFixup = let
    runtimeLibs = lib.makeLibraryPath [ libudev0-shim ];
  in ''
  wrapProgram "$out/pixelator" --prefix LD_LIBRARY_PATH : ${runtimeLibs}
  '';
  dontStrip = true;
}

Building it

$ cd nix-patchtools/examples
$ nix-build pixelator.nix

The output will be something like,

/nix/store/j89yqn3zhpz2r9jwrng45yl09arxq4h0-pixelator

Installing it

nix-env -i /nix/store/j89yqn3zhpz2r9jwrng45yl09arxq4h0-pixelator

Running it

Pixelator expects the pixelator and _pixelator_cmd.exe binaries to be in the directory that you launch it from. You can solve that via

$ mkdir -p ~/scratch/pixelator
$ cd ~/scratch/pixelator
$ ln -s /nix/store/ksxwcam55sl20bpv39lj1244n5kvcnq9-pixelator/_pixelator_cmd.exe .
$ ln -s /nix/store/ksxwcam55sl20bpv39lj1244n5kvcnq9-pixelator/pixelator pixelator

Success!

You've read this far⁠—want more?

Subscribe and I'll e-mail you updates along with the ideas that I don't share anywhere else.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.