Skip to content

Redistributing GitKraken

This page explains how NixKraken redistributes specific GitKraken versions by importing matching commits from nixpkgs.

It documents how to build the packages, how versions are tracked, and the contributor workflow for adding new versions.

See the version option documentation for how users select a GitKraken version. Using that option lets NixKraken provide prebuilt GitKraken binaries from its binary cache, reducing build and install time compared with relying on nixpkgs.

Build

Latest Version

sh
# Using new Nix commands
$ nix build '.#gitkraken'
sh
# ...or with classic Nix commands
$ nix-build ./gitkraken

Specific Version

WARNING

These dashed attributes are primarily for maintainers and CI to prebuild and cache each redistributed version.

Users should install the plain gitkraken derivation instead.

sh
# Using new Nix commands
$ nix build '.#gitkraken.gitkraken-v11-1-0'
sh
# ...or with classic Nix commands
$ nix-build ./gitkraken -A gitkraken-v11-1-0

How Redistribution Works

gitkraken/default.nix defines a Nix function that accepts an optional version argument. Based on this argument, the behavior will differ and either return a derivation for the latest version or a specific version of GitKraken.

If version is provided, the function:

  • validates the version
  • imports the corresponding nixpkgs commit
  • returns the GitKraken derivation for that version

If version is omitted, the function:

About passthru

The Flake uses derivations exposed by the passthru attribute to surface them as Flake outputs (e.g., gitkraken-v<dashed-version>), which Garnix CI can target to build and populate the binary cache.

The function also automatically adds GitKraken to allowed unfree packages for the build, so users do not have to set allowUnfreePredicate manually when installing NixKraken.

Handling Versions

The mapping of redistributed versions is maintained in gitkraken/versions.nix.

Each version entry is an attribute set with required fields:

  • commit: the nixpkgs commit SHA where this GitKraken version is packaged
  • hash: the nixpkgs source hash for that derivation

Additionally, to keep track of the latest version of GitKraken, a single version entry can define the latest attribute.

Example entry:

nix
{
  "11.1.0" = {
    commit = "...";
    hash = "...";
    latest = true; # Only on the one latest entry
  };
}

WARNING

The build will fail if the latest flag is missing or present more than once.

Add a New Redistributed Version

Below are the steps required to add a new version of GitKraken to redistribute:

1. Add a new attribute for version

Use the dotted version as key (e.g., "11.2.0" = { ... }) and set:

  • commit to the nixpkgs commit SHA where the GitKraken package was updated
  • hash temporarily to the empty string ""

How to find the commit SHA?

Look at GitKraken's package history and copy the commit SHA that corresponds to the update.

GitKraken package update to v11.1.0 in nixpkgs

The full commit SHA can be copied by using the button on the right of the short SHA (36dcda8).

2. Obtain the correct hash

  • attempt to build the redistributed derivation - this will fail and print the expected hash
  • use the printed expected hash value to update hash
  • re-run the build to confirm success

3. Update latest

If this new version should be the redistributed latest, add latest = true to the new entry and remove latest from the previous latest.

WARNING

Ensure only one entry has latest = true.

4. Commit, push and open a PR following the contribution workflow

Released under the MIT License