{ pkgs, ... }: let
# TODO: update to support untracked files
git-wip = builtins.derivation {
name = "git-wip";
system = builtins.currentSystem;
src = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/bartman/git-wip/1c095e93539261370ae811ebf47b8d3fe9166869/git-wip";
sha256 = "00gq5bwwhjy68ig26a62307pww2i81y3zcx9yqr8fa36fsqaw37h";
};
builder = pkgs.writeShellScript "git-wip-builder" ''
source ${pkgs.stdenv}/setup
mkdir -p $out/bin
dst=$out/bin/git-wip
cp $src $dst
chmod +w $dst
sed -i 's/#!\/bin\/bash/#!\/usr\/bin\/env bash/g' $dst
chmod -w $dst
chmod a+x $dst
'';
};
in {
imports = [
./compact-graph
./gh.nix
./lazygit
];
home.packages = with pkgs; [
mr
git-wip
git-quick-stats
];
programs.git = {
enable = true;
settings = {
core = {
editor = "vim";
};
commit.verbose = true;
credential.helper = "store";
init.defaultBranch = "main";
alias = {
# The original "log --decorate --oneline" does not contain date and author.
# Append time and author to `--decorate --oneline` style by a customized the format
viz = toString [
"log"
''--format="%Cblue%ad %Cgreen%<(8,trunc)%an %C(auto)%h %(graph)%d %s"''
''--date=format:"%Y.%m.%d"''
];
};
user = {
email = "xieby1@outlook.com";
name = "xieby1";
};
protocol.file.allow = "always";
# Used when this account serves Git repos over SSH, e.g. Nix/npins
# fetching a pinned commit that is not advertised by any branch or tag.
uploadpack.allowAnySHA1InWant = true;
};
lfs.enable = true;
};
systemd.user.tmpfiles.rules = [
"L? %h/.mrconfig - - - - %h/Gist/Config/mrconfig"
];
# mr status not work in non-home dir
home.shellAliases.mr = "mr -d ~";
}