2023-09-25 18:05:07 +00:00
|
|
|
{ pkgs, config, ... }:
|
2023-09-15 14:53:38 +00:00
|
|
|
let
|
|
|
|
ssh = "${pkgs.openssh}/bin/ssh";
|
|
|
|
|
2023-09-26 19:45:31 +00:00
|
|
|
git-gburd = pkgs.writeShellScriptBin "git-gburd" ''
|
2023-09-19 17:05:08 +00:00
|
|
|
repo="$(git remote -v | grep git@burd.me | head -1 | cut -d ':' -f2 | cut -d ' ' -f1)"
|
2023-09-15 14:53:38 +00:00
|
|
|
# Add a .git suffix if it's missing
|
|
|
|
if [[ "$repo" != *".git" ]]; then
|
|
|
|
repo="$repo.git"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" == "init" ]; then
|
|
|
|
if [ "$2" == "" ]; then
|
|
|
|
echo "You must specify a name for the repo"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-09-19 17:05:08 +00:00
|
|
|
${ssh} -A git@burd.me << EOF
|
2023-09-15 14:53:38 +00:00
|
|
|
git init --bare "$2.git"
|
|
|
|
git -C "$2.git" branch -m main
|
|
|
|
EOF
|
2023-09-19 17:05:08 +00:00
|
|
|
git remote add origin git@burd.me:"$2.git"
|
2023-09-15 14:53:38 +00:00
|
|
|
elif [ "$1" == "ls" ]; then
|
2023-09-19 17:05:08 +00:00
|
|
|
${ssh} -A git@burd.me ls
|
2023-09-15 14:53:38 +00:00
|
|
|
else
|
2023-09-19 17:05:08 +00:00
|
|
|
${ssh} -A git@burd.me git -C "/srv/git/$repo" $@
|
2023-09-15 14:53:38 +00:00
|
|
|
fi
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
2023-09-26 19:45:31 +00:00
|
|
|
home.packages = [ git-gburd ];
|
2023-09-15 14:53:38 +00:00
|
|
|
programs.git = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.gitAndTools.gitFull;
|
2023-09-19 17:05:08 +00:00
|
|
|
userName = "Greg Burd";
|
2023-09-26 19:45:31 +00:00
|
|
|
userEmail = "greg@burd.me";
|
|
|
|
signing = {
|
|
|
|
key = "D4BB42BE729AEFBD2EFEBF8822931AF7895E82DF";
|
|
|
|
signByDefault = true;
|
|
|
|
};
|
2023-09-15 14:53:38 +00:00
|
|
|
extraConfig = {
|
|
|
|
init.defaultBranch = "main";
|
|
|
|
gpg.program = "${config.programs.gpg.package}/bin/gpg2";
|
|
|
|
};
|
|
|
|
lfs.enable = true;
|
|
|
|
ignores = [ ".direnv" "result" ];
|
|
|
|
};
|
|
|
|
}
|