naitokosuke · dotfiles

gwq is to worktrees what ghq is to clones. The TOML config is generated from Nix: worktree.basedir is the shared source root, and the naming template appends ---<branch> to the repository path, so each worktree sits beside the clone it came from (home/claude-sandbox.nix relies on that layout).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20# gwq is to worktrees what ghq is to clones. The TOML config is generated from
# Nix: `worktree.basedir` is the shared source root, and the naming template
# appends `---<branch>` to the repository path, so each worktree sits beside
# the clone it came from (home/claude-sandbox.nix relies on that layout).
{
  config,
  pkgs,
  ...
}:

let
  tomlFormat = pkgs.formats.toml { };
in
{
  xdg.configFile."gwq/config.toml".source = tomlFormat.generate "gwq-config.toml" {
    worktree.basedir = config.naitokosuke.srcDirectory;
    naming.template = "{{.Host}}/{{.Owner}}/{{.Repository}}---{{.Branch}}";
  };
}
20 lines·607 chars·NIX