From ec0030fde82135a08f720fbc6f4c6fe24fcfb73f Mon Sep 17 00:00:00 2001 From: binmohm Date: Tue, 9 Jun 2026 15:27:59 +0800 Subject: [PATCH 01/11] feat(profile-development): add git-bug to home.packages --- nix/profiles/development.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/profiles/development.nix b/nix/profiles/development.nix index f217cde9..4e0e1303 100644 --- a/nix/profiles/development.nix +++ b/nix/profiles/development.nix @@ -33,6 +33,7 @@ in { pkgs, ... }: { home.packages = with pkgs; [ + git-bug ddgr gh ripgrep From d5a3562391e434c1e2d071e5be5d875334acd009 Mon Sep 17 00:00:00 2001 From: binmohm Date: Tue, 9 Jun 2026 15:55:50 +0800 Subject: [PATCH 02/11] feat(ssh-config): add ssh key to ssh-agent on login --- nix/modules/ssh-config.nix | 40 +++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/nix/modules/ssh-config.nix b/nix/modules/ssh-config.nix index 7c47cd36..0bfaa0a8 100644 --- a/nix/modules/ssh-config.nix +++ b/nix/modules/ssh-config.nix @@ -18,8 +18,26 @@ in enable = true; extraConfig = renderSettings settings; }; + home-manager.sharedModules = [ + ( + { config, ... }: + { + launchd.agents.ssh-add = { + enable = true; + config = { + ProgramArguments = [ + "/bin/sh" + "-c" + "ssh-add ${config.home.homeDirectory}/.ssh/id_ed25519" + ]; + RunAtLoad = true; + KeepAlive = false; + }; + }; + } + ) + ]; }; - config.flake.modules.nixos.ssh-config = { primaryUser, ... }: { @@ -28,5 +46,25 @@ in inherit settings; }; users.users.root.openssh.authorizedKeys.keys = primaryUser.sshAuthorizedKeys; + home-manager.sharedModules = [ + ( + { pkgs, config, ... }: + { + systemd.user.services.ssh-add = { + Unit = { + Description = "Add SSH key to agent on login"; + After = [ "ssh-agent.service" ]; + }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.openssh}/bin/ssh-add ${config.home.homeDirectory}/.ssh/id_ed25519"; + RemainAfterExit = true; + }; + Install.WantedBy = [ "default.target" ]; + }; + } + ) + ]; }; + } From a2ec61ad49b7166ca85dd298cd91068a47b5c2a6 Mon Sep 17 00:00:00 2001 From: binmohm Date: Tue, 9 Jun 2026 16:04:16 +0800 Subject: [PATCH 03/11] feat(profile-development): add git-bug tui alias --- nix/profiles/development.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/profiles/development.nix b/nix/profiles/development.nix index 4e0e1303..d4ddc90f 100644 --- a/nix/profiles/development.nix +++ b/nix/profiles/development.nix @@ -40,6 +40,7 @@ in ]; home.shellAliases = { cd = "echo \"Please use z\""; + gb = "git-bug termui"; gc = "git commit"; gcam = "git commit -am"; gcamend = "git commit -a --amend --no-edit"; From fb0f7db5ce9427a3e72080d15b3693705fe4cf42 Mon Sep 17 00:00:00 2001 From: binmohm Date: Tue, 9 Jun 2026 17:01:57 +0800 Subject: [PATCH 04/11] feat(starship): add git-bug status to prompt --- nix/profiles/development.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nix/profiles/development.nix b/nix/profiles/development.nix index d4ddc90f..8e3c8d84 100644 --- a/nix/profiles/development.nix +++ b/nix/profiles/development.nix @@ -69,7 +69,7 @@ in settings = { add_newline = false; format = lib.strings.concatStrings [ - "$hostname$directory$git_branch$git_status$git_state" + "$hostname$directory$git_branch$git_status$git_state\${custom.git-bug}" "$fill" "$nix_shell" "$time" @@ -90,6 +90,17 @@ in shlvl.disabled = false; username.disabled = true; fill.symbol = " "; + custom.git-bug = { + when = '' + git for-each-ref --count=1 refs/bugs/ > /dev/null 2>&1 || exit 1 + l=$(git for-each-ref refs/bugs/ --format="%(objectname) %(refname:lstrip=2)" 2>/dev/null | sort) + r=$(git for-each-ref refs/remotes/origin/bugs/ --format="%(objectname) %(refname:lstrip=4)" 2>/dev/null | sort) + [ "$l" != "$r" ] + ''; + command = "true"; + format = "[ 🐛]($style)"; + shell = [ "${lib.getExe pkgs.bash}" ]; + }; }; }; zoxide.enable = true; From 97b0d38411654937a7d39170674af1649a961b00 Mon Sep 17 00:00:00 2001 From: binmohm Date: Tue, 9 Jun 2026 17:04:11 +0800 Subject: [PATCH 05/11] enhancement(profile-dev): add git-bug push to gu alias --- nix/profiles/development.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/profiles/development.nix b/nix/profiles/development.nix index 8e3c8d84..37a59249 100644 --- a/nix/profiles/development.nix +++ b/nix/profiles/development.nix @@ -52,7 +52,7 @@ in gds = "git diff --staged"; grc = "git rebase --continue"; gs = "git status"; - gu = "git push"; + gu = "git push && git-bug push"; v = "$EDITOR"; e = "fish -c 'set -e var; set var (sk); test -n \"$var\"; and $EDITOR $var'"; }; From 907a5025d598afb4d16daa6ff4064aa8d45bef68 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 10 Jun 2026 18:36:25 +0800 Subject: [PATCH 06/11] fix(ssh-config): start the ssh agent for nixos --- nix/modules/ssh-config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/modules/ssh-config.nix b/nix/modules/ssh-config.nix index 0bfaa0a8..87fc202a 100644 --- a/nix/modules/ssh-config.nix +++ b/nix/modules/ssh-config.nix @@ -46,6 +46,7 @@ in inherit settings; }; users.users.root.openssh.authorizedKeys.keys = primaryUser.sshAuthorizedKeys; + programs.ssh.startAgent = true; home-manager.sharedModules = [ ( { pkgs, config, ... }: From 0260a970ee52da3dfe1e1ae09cdfc121771c37b4 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 10 Jun 2026 18:53:37 +0800 Subject: [PATCH 07/11] ssh-config: move ssh-agent configuration to development profile --- nix/modules/ssh-config.nix | 41 +--------------------------------- nix/profiles/development.nix | 43 ++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/nix/modules/ssh-config.nix b/nix/modules/ssh-config.nix index 87fc202a..7c47cd36 100644 --- a/nix/modules/ssh-config.nix +++ b/nix/modules/ssh-config.nix @@ -18,26 +18,8 @@ in enable = true; extraConfig = renderSettings settings; }; - home-manager.sharedModules = [ - ( - { config, ... }: - { - launchd.agents.ssh-add = { - enable = true; - config = { - ProgramArguments = [ - "/bin/sh" - "-c" - "ssh-add ${config.home.homeDirectory}/.ssh/id_ed25519" - ]; - RunAtLoad = true; - KeepAlive = false; - }; - }; - } - ) - ]; }; + config.flake.modules.nixos.ssh-config = { primaryUser, ... }: { @@ -46,26 +28,5 @@ in inherit settings; }; users.users.root.openssh.authorizedKeys.keys = primaryUser.sshAuthorizedKeys; - programs.ssh.startAgent = true; - home-manager.sharedModules = [ - ( - { pkgs, config, ... }: - { - systemd.user.services.ssh-add = { - Unit = { - Description = "Add SSH key to agent on login"; - After = [ "ssh-agent.service" ]; - }; - Service = { - Type = "oneshot"; - ExecStart = "${pkgs.openssh}/bin/ssh-add ${config.home.homeDirectory}/.ssh/id_ed25519"; - RemainAfterExit = true; - }; - Install.WantedBy = [ "default.target" ]; - }; - } - ) - ]; }; - } diff --git a/nix/profiles/development.nix b/nix/profiles/development.nix index 37a59249..92df8495 100644 --- a/nix/profiles/development.nix +++ b/nix/profiles/development.nix @@ -14,7 +14,26 @@ in pi-agent yazi ]; - home-manager.sharedModules = [ cfg.modules.homeManager.profile-development ]; + home-manager.sharedModules = [ + cfg.modules.homeManager.profile-development + ( + { config, ... }: + { + launchd.agents.ssh-add = { + enable = true; + config = { + ProgramArguments = [ + "/bin/sh" + "-c" + "ssh-add ${config.home.homeDirectory}/.ssh/id_ed25519" + ]; + RunAtLoad = true; + KeepAlive = false; + }; + }; + } + ) + ]; }; nixos.profile-development = { imports = with cfg.modules.nixos; [ @@ -27,7 +46,27 @@ in yazi ]; networking.networkmanager.enable = true; - home-manager.sharedModules = [ cfg.modules.homeManager.profile-development ]; + programs.ssh.startAgent = true; + home-manager.sharedModules = [ + cfg.modules.homeManager.profile-development + ( + { pkgs, config, ... }: + { + systemd.user.services.ssh-add = { + Unit = { + Description = "Add SSH key to agent on login"; + After = [ "ssh-agent.service" ]; + }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.openssh}/bin/ssh-add ${config.home.homeDirectory}/.ssh/id_ed25519"; + RemainAfterExit = true; + }; + Install.WantedBy = [ "default.target" ]; + }; + } + ) + ]; }; homeManager.profile-development = { pkgs, ... }: From 4a3b154902342ea018f4e17f246fde513760d7f8 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 10 Jun 2026 18:55:03 +0800 Subject: [PATCH 08/11] aliases: add gy for git and git-bug pull --- nix/profiles/development.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/profiles/development.nix b/nix/profiles/development.nix index 92df8495..6ebf37ed 100644 --- a/nix/profiles/development.nix +++ b/nix/profiles/development.nix @@ -92,6 +92,7 @@ in grc = "git rebase --continue"; gs = "git status"; gu = "git push && git-bug push"; + gy = "git pull && git-bug pull"; v = "$EDITOR"; e = "fish -c 'set -e var; set var (sk); test -n \"$var\"; and $EDITOR $var'"; }; From 2fb9e8c4f5da3b337776f95fa782eafa7561397f Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 10 Jun 2026 19:33:35 +0800 Subject: [PATCH 09/11] ssh-add: set SSH_AUTH_SOCK to %t/ssh-agent --- nix/profiles/development.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nix/profiles/development.nix b/nix/profiles/development.nix index 6ebf37ed..b996cd26 100644 --- a/nix/profiles/development.nix +++ b/nix/profiles/development.nix @@ -55,10 +55,12 @@ in systemd.user.services.ssh-add = { Unit = { Description = "Add SSH key to agent on login"; + Wants = [ "ssh-agent.service" ]; After = [ "ssh-agent.service" ]; }; Service = { Type = "oneshot"; + Environment = "SSH_AUTH_SOCK=%t/ssh-agent"; ExecStart = "${pkgs.openssh}/bin/ssh-add ${config.home.homeDirectory}/.ssh/id_ed25519"; RemainAfterExit = true; }; From f15706a570cedc1e71d58fd5c6a0f14d37d92ec2 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 10 Jun 2026 20:02:19 +0800 Subject: [PATCH 10/11] docs: add articles for ssh-add and git-bug --- docs/cli/git-bug.md | 16 ++++++++++++++++ docs/services/ssh-add.md | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 docs/cli/git-bug.md create mode 100644 docs/services/ssh-add.md diff --git a/docs/cli/git-bug.md b/docs/cli/git-bug.md new file mode 100644 index 00000000..e2fd1ed4 --- /dev/null +++ b/docs/cli/git-bug.md @@ -0,0 +1,16 @@ +git-bug +======= + +rel: 8f34a17 + +`git-bug` is used for issue tracking. The remote used is `origin` (git@github.com:rrvsh/tools). + +Aliases: +- `gu`: runs `git push` and `git-bug push`. +- `gy`: runs `git pull` and `git-bug pull`. + +A custom Starship module diffs `.git/refs/bugs/` against `.git/refs/remotes/origin/bugs/` and displays an 🐛 emoji when they are not in sync. + +The `ssh-add` user service is a dependency, because git-bug requires the ssh-agent to have the private key saved and can't use the private key file as a fallback like git. + +There was a bug in the nixpkgs derivation that resulted in fish shell completions being broken - fixed in [this PR](https://github.com/NixOS/nixpkgs/pull/529885). diff --git a/docs/services/ssh-add.md b/docs/services/ssh-add.md new file mode 100644 index 00000000..0b4efca1 --- /dev/null +++ b/docs/services/ssh-add.md @@ -0,0 +1,6 @@ +ssh-add +======= + +rel: 8f34a17 + +This runs as a user service to initialise the ssh-agent with my private key on login. This helps with `git-bug`, which requires the ssh agent to be configured instead of falling back to the private key file. From 987b527751df405ee4f2c84f8dabde0b371f71f7 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Wed, 10 Jun 2026 20:13:02 +0800 Subject: [PATCH 11/11] docs: add note about being unable to adopt remote user --- docs/cli/git-bug.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/cli/git-bug.md b/docs/cli/git-bug.md index e2fd1ed4..d1c4b03f 100644 --- a/docs/cli/git-bug.md +++ b/docs/cli/git-bug.md @@ -14,3 +14,13 @@ A custom Starship module diffs `.git/refs/bugs/` against `.git/refs/remotes/orig The `ssh-add` user service is a dependency, because git-bug requires the ssh-agent to have the private key saved and can't use the private key file as a fallback like git. There was a bug in the nixpkgs derivation that resulted in fish shell completions being broken - fixed in [this PR](https://github.com/NixOS/nixpkgs/pull/529885). + +Note that when running `git-bug pull` on an existing remote onto a new machine, you will be unable to adopt the identity of the existing user. You will have to create a new user for the bootstrap, then git-bug pull, then adopt the existing user. Here are the commands for this: + +```sh +git update-ref -d refs/identities/ +rm -rf .git/git-bug/cache/identities .git/git-bug/indexes/identities +git reflog expire --expire=now --expire-unreachable=now --all +git gc --prune=now +``` +See for more information.