2024-06-24 18:47:55 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
rustPlatform,
|
|
|
|
buildGoModule,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pnpm_9,
|
|
|
|
wrapGAppsHook3,
|
|
|
|
cargo-tauri,
|
|
|
|
darwin,
|
|
|
|
desktop-file-utils,
|
|
|
|
esbuild,
|
|
|
|
git,
|
|
|
|
glib-networking,
|
|
|
|
jq,
|
|
|
|
nodejs,
|
|
|
|
pkg-config,
|
|
|
|
libsoup,
|
|
|
|
moreutils,
|
|
|
|
openssl,
|
2024-10-04 16:56:33 +00:00
|
|
|
rust,
|
2024-06-24 18:47:55 +00:00
|
|
|
webkitgtk,
|
|
|
|
nix-update-script,
|
2024-09-19 14:19:46 +00:00
|
|
|
cacert,
|
2024-06-24 18:47:55 +00:00
|
|
|
}:
|
2024-10-04 16:56:33 +00:00
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "gitbutler";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.12.16";
|
2024-06-24 18:47:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gitbutlerapp";
|
|
|
|
repo = "gitbutler";
|
|
|
|
rev = "release/${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-L4PVaNb3blpLIcyA7XLc71qwUPUADclxvbOkq1Jc1no=";
|
2024-06-24 18:47:55 +00:00
|
|
|
};
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
# deactivate the upstream updater in tauri configuration & set the version
|
2024-06-24 18:47:55 +00:00
|
|
|
postPatch = ''
|
2024-10-04 16:56:33 +00:00
|
|
|
tauri_conf="crates/gitbutler-tauri/tauri.conf.release.json"
|
|
|
|
jq '.package.version = "${version}" | .tauri.updater.active = false' "$tauri_conf" | sponge "$tauri_conf"
|
2024-06-24 18:47:55 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"tauri-plugin-context-menu-0.7.1" = "sha256-vKfq20hrFLmfoXO94D8HwAE3UdGcuqVZf3+tOBhLqj0=";
|
2024-09-19 14:19:46 +00:00
|
|
|
"tauri-plugin-log-0.0.0" = "sha256-gde2RS5NFA0Xap/Xb7XOeVQ/5t2Nw+j+HOwfeJmSNMU=";
|
2024-06-24 18:47:55 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
pnpmDeps = pnpm_9.fetchDeps {
|
|
|
|
inherit pname version src;
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-r2PkNDvOofginL5Y0K+7Qhnsev2zle1q9qraG/ub7Wo=";
|
2024-06-24 18:47:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2024-10-04 16:56:33 +00:00
|
|
|
cargo-tauri.hook
|
2024-06-24 18:47:55 +00:00
|
|
|
desktop-file-utils
|
|
|
|
jq
|
|
|
|
moreutils
|
|
|
|
nodejs
|
|
|
|
pkg-config
|
|
|
|
pnpm_9.configHook
|
|
|
|
wrapGAppsHook3
|
2024-09-19 14:19:46 +00:00
|
|
|
cacert
|
2024-06-24 18:47:55 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[ openssl ]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
2024-06-24 18:47:55 +00:00
|
|
|
glib-networking
|
|
|
|
libsoup
|
|
|
|
webkitgtk
|
|
|
|
]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin (
|
2024-06-24 18:47:55 +00:00
|
|
|
with darwin.apple_sdk.frameworks;
|
|
|
|
[
|
|
|
|
AppKit
|
|
|
|
CoreServices
|
|
|
|
Security
|
|
|
|
WebKit
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
# extended release configuration
|
|
|
|
tauriBuildFlags = [ "--config crates/gitbutler-tauri/tauri.conf.release.json" ];
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
env = {
|
2024-10-04 16:56:33 +00:00
|
|
|
# make sure `crates/gitbutler-tauri/inject-git-binaries.sh` can find our
|
|
|
|
# target dir
|
|
|
|
# https://github.com/gitbutlerapp/gitbutler/blob/56b64d778042d0e93fa362f808c35a7f095ab1d1/crates/gitbutler-tauri/inject-git-binaries.sh#L10C10-L10C26
|
|
|
|
TRIPLE_OVERRIDE = rust.envVars.rustHostPlatformSpec;
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
# `pnpm`'s `fetchDeps` and `configHook` uses a specific version of pnpm, not upstream's
|
|
|
|
COREPACK_ENABLE_STRICT = 0;
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
# disable turbo telemetry
|
|
|
|
TURBO_TELEMETRY_DEBUG = 1;
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
# we depend on nightly features
|
|
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
|
|
|
|
# we also need to have `tracing` support in `tokio` for `console-subscriber`
|
|
|
|
RUSTFLAGS = "--cfg tokio_unstable";
|
|
|
|
|
|
|
|
ESBUILD_BINARY_PATH = lib.getExe (
|
|
|
|
esbuild.override {
|
|
|
|
buildGoModule =
|
|
|
|
args:
|
|
|
|
buildGoModule (
|
|
|
|
args
|
|
|
|
// rec {
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.20.2";
|
2024-06-24 18:47:55 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "evanw";
|
|
|
|
repo = "esbuild";
|
|
|
|
rev = "v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-h/Vqwax4B4nehRP9TaYbdixAZdb1hx373dNxNHvDrtY=";
|
2024-06-24 18:47:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2024-09-19 14:19:46 +00:00
|
|
|
|
|
|
|
# Needed to get openssl-sys to use pkgconfig.
|
|
|
|
OPENSSL_NO_VENDOR = true;
|
2024-06-24 18:47:55 +00:00
|
|
|
};
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
preBuild = ''
|
2024-09-19 14:19:46 +00:00
|
|
|
pushd packages/ui
|
|
|
|
pnpm package
|
|
|
|
popd
|
2024-06-24 18:47:55 +00:00
|
|
|
'';
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
postInstall =
|
|
|
|
lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2024-06-24 18:47:55 +00:00
|
|
|
mv $out/Applications/GitButler.app/Contents/MacOS/GitButler $out/bin/git-butler
|
|
|
|
ln -s $out/bin/git-butler $out/Applications/GitButler.app/Contents/MacOS/GitButler
|
|
|
|
''
|
2024-09-26 11:04:55 +00:00
|
|
|
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
2024-06-24 18:47:55 +00:00
|
|
|
desktop-file-edit \
|
|
|
|
--set-comment "A Git client for simultaneous branches on top of your existing workflow." \
|
|
|
|
--set-key="Keywords" --set-value="git;" \
|
|
|
|
--set-key="StartupWMClass" --set-value="GitButler" \
|
|
|
|
$out/share/applications/git-butler.desktop
|
|
|
|
'';
|
|
|
|
|
|
|
|
# the `gitbutler-git` crate's checks do not support release mode
|
|
|
|
checkType = "debug";
|
|
|
|
|
|
|
|
nativeCheckInputs = [ git ];
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script {
|
|
|
|
extraArgs = [
|
|
|
|
"--version-regex"
|
|
|
|
"release/(.*)"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Git client for simultaneous branches on top of your existing workflow";
|
|
|
|
homepage = "https://gitbutler.com";
|
|
|
|
changelog = "https://github.com/gitbutlerapp/gitbutler/releases/tag/release/${version}";
|
|
|
|
mainProgram = "git-butler";
|
|
|
|
license = lib.licenses.fsl11Mit;
|
2024-09-19 14:19:46 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
getchoo
|
|
|
|
techknowlogick
|
|
|
|
];
|
2024-06-24 18:47:55 +00:00
|
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
|
|
|
};
|
|
|
|
}
|