From c1f2708f521fa06e0791e28ba549208e6a626aab Mon Sep 17 00:00:00 2001 From: winston Date: Tue, 4 Feb 2025 19:06:37 +0100 Subject: [PATCH] feat(git): use my watchman fork for now refs: https://github.com/jgavris/rs-git-fsmonitor/pull/32 --- home/apps/git/default.nix | 7 +++++-- pkgs/overlays.nix | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/home/apps/git/default.nix b/home/apps/git/default.nix index 4adc4bc6..764bbdc9 100644 --- a/home/apps/git/default.nix +++ b/home/apps/git/default.nix @@ -19,7 +19,10 @@ in } ]; - home.packages = [ pkgs.git-ignore ]; + home.packages = with pkgs; [ + git-ignore + watchman + ]; # disable loading the system config on Darwin, where Nix tells it to use the # osxkeychain credential manager. @@ -72,7 +75,7 @@ in ]; extraConfig = { - core.fsmonitor = true; + core.fsmonitor = lib.getExe pkgs.rs-git-fsmonitor; credential.helper = "gopass"; init.defaultBranch = "main"; push.default = "current"; diff --git a/pkgs/overlays.nix b/pkgs/overlays.nix index 21d06d1c..1041ccb9 100644 --- a/pkgs/overlays.nix +++ b/pkgs/overlays.nix @@ -4,6 +4,7 @@ ( final: prev: let + inherit (final) lib; inherit (final.stdenv) system; nvfetcherSrcs = final.callPackage ../_sources/generated.nix { }; in @@ -20,6 +21,34 @@ nurpkgs = final; pkgs = final; }; + rs-git-fsmonitor = final.rustPlatform.buildRustPackage rec { + pname = "rs-git-fsmonitor"; + version = "0.2.0-git-rust-client"; + + src = final.fetchFromGitHub { + owner = "nekowinston"; + repo = "rs-git-fsmonitor"; + rev = "7317d9b201a540e12468bca3272baa59be1a5382"; + sha256 = "sha256-VdF7FamqveSJLrcspTLZ0LGk7SMgYG1+muryCYLjP78="; + }; + + cargoHash = "sha256-gcWi2gczg6eiYIJrrP76e9PqMBll0MTnAFT5BA/30as="; + + nativeBuildInputs = [ final.makeWrapper ]; + + fixupPhase = '' + wrapProgram $out/bin/rs-git-fsmonitor --prefix PATH ":" "${lib.makeBinPath [ final.watchman ]}" + ''; + + meta = { + description = "Fast git core.fsmonitor hook written in Rust"; + homepage = "https://github.com/jgavris/rs-git-fsmonitor"; + changelog = "https://github.com/jgavris/rs-git-fsmonitor/releases/tag/v${version}"; + license = lib.licenses.mit; + maintainers = [ ]; + mainProgram = "rs-git-fsmonitor"; + }; + }; starship = prev.starship.overrideAttrs (old: { patches = [ # to allow loading config values from env vars