nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchFromGitHub,
3 fetchpatch, # Delete at next version bump.
4 lib,
5 libgit2,
6 stdenv,
7}:
8
9stdenv.mkDerivation rec {
10 pname = "debase";
11 # NOTE: When updating version, also update commit hash in prePatch.
12 version = "3";
13
14 src = fetchFromGitHub {
15 owner = "toasterllc";
16 repo = "debase";
17 tag = "v${version}";
18 hash = "sha256-IOh5TlFHFhIaP5bpQHYzY4wwmQUdwKePmSzEM2qx8oE=";
19 fetchSubmodules = true;
20 };
21
22 prePatch = ''
23 # xcrun is not available in the Darwin stdenv, but we don't need it anyway.
24 substituteInPlace Makefile \
25 --replace-fail 'xcrun dsymutil' dsymutil
26
27 # NOTE: Update this when updating version.
28 substituteInPlace Makefile \
29 --replace-fail 'git rev-parse HEAD' 'echo aa083074d67938d50336bd3737c960b038d91134' \
30 --replace-fail '$(GITHASHHEADER): .git/HEAD .git/index' '$(GITHASHHEADER):'
31 '';
32
33 patches = [
34 # Ignore debase's vendored copy of libgit2 in favor of the nixpkgs version.
35 ./ignore-vendored-libgit2.patch
36 ];
37
38 buildInputs = [
39 libgit2
40 ];
41
42 installPhase = ''
43 runHook preInstall
44 install -Dm755 build-${
45 if stdenv.hostPlatform.isDarwin then "mac" else "linux"
46 }/release/debase $out/bin/debase
47 runHook postInstall
48 '';
49
50 enableParallelBuilding = true;
51
52 makeFlags = [
53 "ARCHS=${
54 if stdenv.hostPlatform.isx86_64 then
55 "x86_64"
56 else if stdenv.hostPlatform.isAarch64 then
57 "arm64"
58 else
59 throw "unsupported system: ${stdenv.system}"
60 }"
61 ];
62
63 meta = {
64 description = "TUI for drag-and-drop manipulation of git commits";
65 homepage = "https://toaster.llc/debase";
66 license = lib.licenses.publicDomain;
67 mainProgram = "debase";
68 maintainers = with lib.maintainers; [
69 jeremyschlatter
70 aleksana
71 ];
72 platforms = [
73 # Only these systems are supported by Makefile
74 "x86_64-linux"
75 "x86_64-darwin"
76 "aarch64-linux"
77 "aarch64-darwin"
78 ];
79 };
80}