nixbook: expose pw scripts and add bare git clone alias

This commit is contained in:
Tristan 2024-08-16 16:27:12 +01:00
parent 24de630982
commit f478715f4b
3 changed files with 27 additions and 25 deletions

View file

@ -1,4 +1,4 @@
{
{pkgs, ...}: {
programs.git = {
enable = true;
aliases = {
@ -6,6 +6,25 @@
amend = "commit --amend --no-edit";
sdiff = "diff --staged";
t = "tag --annotate";
bclone = "!sh ${pkgs.writeShellScriptBin "bare-clone" ''
url=$1
basename=''${url##*/}
name=''${2:-''${basename%.*}}
mkdir "$name"
git clone --bare "$url" "$name/.bare" || {
rm -r "$name"
exit 1
}
cd "$name"
echo "gitdir: ./.bare" > .git
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
''}/bin/bare-clone";
};
delta = {
enable = true;