From b378599f0a0dcee80049a10f6428bf90bedd6c40 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 9 Nov 2024 16:30:39 +0100 Subject: pkgs: rough packaging of mergiraf, a git merge tool --- home/home-minimal.nix | 25 +++++++++++++++++++++++++ home/packages-minimal.nix | 2 +- pkgs/default.nix | 2 +- pkgs/overlay.nix | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/home/home-minimal.nix b/home/home-minimal.nix index 42f358d..78d6014 100644 --- a/home/home-minimal.nix +++ b/home/home-minimal.nix @@ -138,8 +138,33 @@ commit.verbose = true; rerere.enabled = true; branch.sort = "-authordate"; + + merge.mergiraf = { + name = "mergiraf"; + driver = "merigraf merge --git %O %A %B -s %S -x %X -y %Y -p %P"; + }; }; + attributes = [ + "*.java merge=mergiraf" + "*.rs merge=mergiraf" + "*.go merge=mergiraf" + "*.js merge=mergiraf" + "*.jsx merge=mergiraf" + "*.json merge=mergiraf" + "*.yml merge=mergiraf" + "*.yaml merge=mergiraf" + "*.html merge=mergiraf" + "*.htm merge=mergiraf" + "*.xhtml merge=mergiraf" + "*.xml merge=mergiraf" + "*.c merge=mergiraf" + "*.h merge=mergiraf" + "*.cpp merge=mergiraf" + "*.hpp merge=mergiraf" + "*.cs merge=mergiraf" + ]; + # diff-so-fancy.enable = true; # difftastic.enable = true; delta = { diff --git a/home/packages-minimal.nix b/home/packages-minimal.nix index fe09bc3..f2294ec 100644 --- a/home/packages-minimal.nix +++ b/home/packages-minimal.nix @@ -21,7 +21,7 @@ # nix tools nixpkgs-review nix-top nix-diff nix-tree # git - gitAndTools.gitAnnex git-bug git-appraise + gitAndTools.gitAnnex git-bug git-appraise mergiraf # other things gauche # html, js & co diff --git a/pkgs/default.nix b/pkgs/default.nix index f9d50c0..3f8dda3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -7,7 +7,7 @@ travelynx crs-tracker crs-php bahnhof-name matrix-to hikari_unstable heartwood radicle-interface radicle-tui inweb nomsring bookwyrm mollysocket git-annex-remote-remarkable2 - ntfy-matrix-bot transport_validator; + ntfy-matrix-bot transport_validator mergiraf; pkgs = nixpkgs; } diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index 3a37b8f..c7e929e 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -50,6 +50,39 @@ in cargoLock.lockFile = "${src}/Cargo.lock"; }; + mergiraf = self.rustPlatform.buildRustPackage rec { + pname = "mergiraf"; + version = "git"; + src = self.fetchgit { + url = "https://codeberg.org/mergiraf/mergiraf"; + rev = "v0.2.0"; + hash = "sha256-egtX2daCbPXi5rX2OxbEZA/VI9R4HMj5LRKbUEBFo+E="; + }; + # TODO: probably unnecessary once we are on nixpkgs 24.11; earlier version + # hardcode --frozen here, but cargo wants --offline. + # the postBuild hook is necessary to set up things for the install hook + buildPhase = '' + cargo build -j $NIX_BUILD_CORES \ + --target x86_64-unknown-linux-gnu \ + --release \ + --offline + + runHook postBuild + ''; + # no idea why this didn't work with either test or build inputs .. + preCheck = '' + export PATH=$PATH:${self.gitMinimal}/bin + ''; + cargoLock = { + lockFile = "${src}/Cargo.lock"; + outputHashes = { + "tree-sitter-go-0.23.1" = "sha256-elPqkvVYs0vADOuN/umDteWP5hqcXhQAoSkqYDtTxaU="; + "tree-sitter-xml-0.7.0" = "sha256-RTWvOUAs3Uql9DKsP1jf9FZZHaZORE40GXd+6g6RQZw="; + "tree-sitter-yaml-0.6.1" = "sha256-gS+SjOnGl/86U9VV/y1ca7naYIe7DAOvOv++jCRLTKo="; + }; + }; + }; + rustex = rustPlatform.buildRustPackage rec { pname = "rustex"; version = "git"; -- cgit v1.2.3