# GitButler CLI (`but`). nixpkgs `gitbutler` is GUI-only and builds from source. # ponytail: pinned by hand; bump `version`, `build`, and both hashes (see releases JSON at # https://app.gitbutler.com/releases/version/) to upgrade. { lib, stdenvNoCC, fetchurl, autoPatchelfHook, dbus, zlib, stdenv, }: let version = "0.22.3"; build = "3234"; base = "https://releases.gitbutler.com/releases/release/${version}-${build}"; isDarwin = stdenvNoCC.hostPlatform.isDarwin; src = if isDarwin then fetchurl { url = "${base}/macos/aarch64/GitButler.app.tar.gz"; hash = "sha256-7fD2gMEC/4b67h2RnqKmFm/L5uOpiYZwbJGjju1mL3Q="; } else fetchurl { url = "${base}/linux/x86_64/but"; hash = "sha256-P09UOmzNkxzmyGxIQFjb5eKUOVl9AB9qCpwo2eUz6hg="; }; in stdenvNoCC.mkDerivation { pname = "but"; inherit version src; sourceRoot = "."; unpackPhase = if isDarwin then "tar xzf $src" else "true"; nativeBuildInputs = lib.optional (!isDarwin) autoPatchelfHook; buildInputs = lib.optionals (!isDarwin) [ dbus zlib stdenv.cc.cc.lib ]; # Re-signing/stripping would break the app's code signature on macOS. dontFixup = isDarwin; installPhase = if isDarwin then '' mkdir -p $out/Applications $out/bin cp -r GitButler.app $out/Applications/ # the app binary acts as the CLI when invoked as `but` ln -s $out/Applications/GitButler.app/Contents/MacOS/gitbutler-tauri $out/bin/but '' else '' install -Dm755 $src $out/bin/but ''; meta = { description = "GitButler CLI"; homepage = "https://gitbutler.com"; license = lib.licenses.fsl11Mit; mainProgram = "but"; platforms = [ "aarch64-darwin" "x86_64-linux" ]; }; }