Skip to content

Instantly share code, notes, and snippets.

@jtojnar
Last active April 18, 2023 04:38
Show Gist options
  • Save jtojnar/c14bc10ae6052b5a6fb19bfdac077a01 to your computer and use it in GitHub Desktop.
Save jtojnar/c14bc10ae6052b5a6fb19bfdac077a01 to your computer and use it in GitHub Desktop.
How to use Nix to build fresh GIMP

Nix is a package manager that you can install in parallel with your system package manager on Linux or MacOS. It allows you to effortlesly build any of the thousands of packages defined in the nixpkgs repository or write your own package expressions. Packages in the nixpkgs repository get periodically built by our CI server so the GIMP dependencies will be obtained from binary cache saving you time.

To obtain Nix, you can simply run an installation script, or use your package manager if it is packaged in your distro repositories. Notably, there is a package in Arch’s AUR and Debian Unstable.

The pull request containing changes for the latest changes for GIMP master is NixOS/nixpkgs#67576. I usually update the branch several times a month to point to the latest GIMP master.

You can use the following command nix-build https://github.com/jtojnar/nixpkgs/archive/gimp-meson.tar.gz -A gimp to obtain nixpkgs expressions from the branch associated with the pull request and build GIMP from there. The command will produce a result symlink and you will be able to start GIMP by running result/bin/gimp-2.99.

If you want to develop GIMP, building it in isolated environment of Nix all the time will not be very convenient. You can run nix-shell 'https://github.com/jtojnar/nixpkgs/archive/gimp-meson.tar.gz' -A gimp in your local GIMP source tree and you will find yourself in an environment containing all the things necessary for building GIMP. Then you can build GIMP as you would normally (meson build, ninja -C build and ninja -C build install).

If I did not update the pull request with the latest master yet or you want to tweak the build recipe, you can clone the gimp-meson branch of my nixpkgs fork and replace the URL in the Nix commands by the path to your local checkout.

If you need some help, feel free to ping me on #nixos on chat.freenode.net or on #gimp on irc.gimp.org (or their Matrix equivalents #NixOS:matrix.org and #gimp:gnome.org).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment