mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 14:50:40 +02:00
feat: add git-fuzzy package with patch to load config from git
This commit is contained in:
parent
89fd5abd88
commit
736287e536
4 changed files with 83 additions and 14 deletions
|
@ -2,9 +2,11 @@
|
|||
(import ./caddy.nix)
|
||||
(import ./oauth2-proxy)
|
||||
(_self: super: {
|
||||
segoe-ui-ttf = super.callPackage ./segoe-ui-ttf.nix {};
|
||||
|
||||
git-fuzzy = super.callPackage ./git-fuzzy {};
|
||||
kanidm-secret-manipulator = super.callPackage ./kanidm-secret-manipulator.nix {};
|
||||
segoe-ui-ttf = super.callPackage ./segoe-ui-ttf.nix {};
|
||||
zsh-histdb-skim = super.callPackage ./zsh-skim-histdb.nix {};
|
||||
|
||||
kanidm = super.kanidm.overrideAttrs (_finalAttrs: _previousAttrs: {
|
||||
patches = [
|
||||
(super.fetchpatch {
|
||||
|
@ -21,17 +23,5 @@
|
|||
|
||||
doCheck = false;
|
||||
});
|
||||
|
||||
bottles-unwrapped = super.bottles-unwrapped.overrideAttrs (_finalAttrs: _previousAttrs: {
|
||||
version = "51.9";
|
||||
src = super.fetchFromGitHub {
|
||||
owner = "bottlesdevs";
|
||||
repo = "bottles";
|
||||
rev = "51.9";
|
||||
hash = "sha256-iZUszwVcbVn6Xsqou6crSp9gJBRmm5vEqxS87h/s3PQ=";
|
||||
};
|
||||
});
|
||||
|
||||
zsh-histdb-skim = super.callPackage ./zsh-skim-histdb.nix {};
|
||||
})
|
||||
]
|
||||
|
|
21
pkgs/git-fuzzy/0001-load-git-config.patch
Normal file
21
pkgs/git-fuzzy/0001-load-git-config.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
diff --git a/bin/git-fuzzy b/bin/git-fuzzy
|
||||
index 27eaa4f..a33dc8c 100755
|
||||
--- a/bin/git-fuzzy
|
||||
+++ b/bin/git-fuzzy
|
||||
@@ -21,6 +21,7 @@ script_dir="$( cd -P "$( dirname "$script_source" )" >/dev/null 2>&1 && pwd )"
|
||||
# -----------------------------------------
|
||||
git_fuzzy_dir="$script_dir/.."
|
||||
|
||||
+. "$git_fuzzy_dir/lib/load-configs-from-git.sh"
|
||||
. "$git_fuzzy_dir/lib/load-configs.sh"
|
||||
|
||||
. "$git_fuzzy_dir/lib/snapshot.sh"
|
||||
diff --git a/lib/load-configs-from-git.sh b/lib/load-configs-from-git.sh
|
||||
new file mode 100644
|
||||
index 0000000..58b6371
|
||||
--- /dev/null
|
||||
+++ b/lib/load-configs-from-git.sh
|
||||
@@ -0,0 +1,3 @@
|
||||
+#!/usr/bin/env bash
|
||||
+
|
||||
+# <<AUTOMATICALLY GENERATED>>
|
57
pkgs/git-fuzzy/default.nix
Normal file
57
pkgs/git-fuzzy/default.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
fetchFromGitHub,
|
||||
stdenvNoCC,
|
||||
lib,
|
||||
makeWrapper,
|
||||
gitAndTools,
|
||||
bat,
|
||||
extraPackages ? [],
|
||||
}: let
|
||||
binPath = lib.makeBinPath ([gitAndTools.hub gitAndTools.delta bat] ++ extraPackages);
|
||||
in
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "git-fuzzy";
|
||||
version = "unstable-2023-09-18";
|
||||
src = fetchFromGitHub {
|
||||
owner = "bigH";
|
||||
repo = "git-fuzzy";
|
||||
rev = "fb02ba3522e19ae1c69be80e2a58561fe2416155";
|
||||
hash = "sha256-Eo2TCx3w3SppoXi8RZu8EC1NhLOnL39bFliHDc2YsyM=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./0001-load-git-config.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
for GF_key in $(grep -o -- 'GF_[A-Z0-9_]*' lib/load-configs.sh | sort -u); do
|
||||
key=''${GF_key#"GF_"}
|
||||
key=''${key,,}
|
||||
cat >> lib/load-configs-from-git.sh <<EOF
|
||||
if val=\$(git config --get fuzzy.''${key@Q}); then
|
||||
$GF_key=\$val
|
||||
fi
|
||||
EOF
|
||||
done
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
installPhase = ''
|
||||
install -m755 -D ./bin/git-fuzzy $out/bin/git-fuzzy
|
||||
install -d "$out/lib"
|
||||
cp -r lib "$out/lib/git-fuzzy"
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
sed -i 's%lib_dir="$script_dir/../lib"%lib_dir='"$out"'/lib/git-fuzzy%' $out/bin/git-fuzzy
|
||||
wrapProgram "$out/bin/git-fuzzy" --prefix PATH : ${binPath}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "FZF-based github cli interface";
|
||||
homepage = "https://github.com/bigH/git-fuzzy";
|
||||
maintainers = with lib.maintainers; [oddlama];
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
|
@ -16,6 +16,7 @@
|
|||
rsync
|
||||
sd
|
||||
tree
|
||||
wget
|
||||
];
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue