From 4f507d6bd1135c803e38e1657f795ad9a458ae39 Mon Sep 17 00:00:00 2001 From: Christoph Schmatzler Date: Sun, 22 Mar 2026 21:09:54 +0000 Subject: [PATCH] up --- modules/_overlays/ast-grep.nix | 6 ++ modules/_overlays/cog-cli.nix | 44 ++++++++ modules/_overlays/himalaya.nix | 3 + modules/_overlays/jj-ryu.nix | 15 +++ modules/_overlays/jj-starship.nix | 1 + modules/_overlays/pi-agent-stuff.nix | 10 ++ modules/_overlays/pi-harness.nix | 33 ++++++ modules/_overlays/pi-mcp-adapter.nix | 16 +++ modules/_overlays/zjstatus.nix | 3 + modules/ai-tools.nix | 150 ++++++++++++++++++++++++++- modules/overlays.nix | 109 ++----------------- 11 files changed, 290 insertions(+), 100 deletions(-) create mode 100644 modules/_overlays/ast-grep.nix create mode 100644 modules/_overlays/cog-cli.nix create mode 100644 modules/_overlays/himalaya.nix create mode 100644 modules/_overlays/jj-ryu.nix create mode 100644 modules/_overlays/jj-starship.nix create mode 100644 modules/_overlays/pi-agent-stuff.nix create mode 100644 modules/_overlays/pi-harness.nix create mode 100644 modules/_overlays/pi-mcp-adapter.nix create mode 100644 modules/_overlays/zjstatus.nix diff --git a/modules/_overlays/ast-grep.nix b/modules/_overlays/ast-grep.nix new file mode 100644 index 0000000..080de38 --- /dev/null +++ b/modules/_overlays/ast-grep.nix @@ -0,0 +1,6 @@ +{inputs, ...}: final: prev: { + ast-grep = + prev.ast-grep.overrideAttrs (old: { + doCheck = false; + }); +} diff --git a/modules/_overlays/cog-cli.nix b/modules/_overlays/cog-cli.nix new file mode 100644 index 0000000..523f904 --- /dev/null +++ b/modules/_overlays/cog-cli.nix @@ -0,0 +1,44 @@ +{inputs, ...}: final: prev: let + version = "0.22.1"; + srcs = { + x86_64-linux = + prev.fetchurl { + url = "https://github.com/trycog/cog-cli/releases/download/v${version}/cog-linux-x86_64.tar.gz"; + hash = "sha256-ET+sNXisUrHShR1gxqdumegXycXcxGzJcQOdTr5005w="; + }; + aarch64-darwin = + prev.fetchurl { + url = "https://github.com/trycog/cog-cli/releases/download/v${version}/cog-darwin-arm64.tar.gz"; + hash = "sha256-jcN+DtOqr3or5C71jp7AIAz0wh73FYybCC4FRBykKO4="; + }; + }; +in { + cog-cli = + prev.stdenvNoCC.mkDerivation { + pname = "cog-cli"; + inherit version; + src = + srcs.${prev.stdenv.hostPlatform.system} + or (throw "Unsupported system for cog-cli: ${prev.stdenv.hostPlatform.system}"); + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + tar -xzf "$src" + install -Dm755 cog "$out/bin/cog" + runHook postInstall + ''; + + meta = with prev.lib; { + description = "Memory, code intelligence, and debugging for AI agents"; + homepage = "https://github.com/trycog/cog-cli"; + license = licenses.mit; + mainProgram = "cog"; + platforms = builtins.attrNames srcs; + sourceProvenance = [sourceTypes.binaryNativeCode]; + }; + }; +} diff --git a/modules/_overlays/himalaya.nix b/modules/_overlays/himalaya.nix new file mode 100644 index 0000000..ca650db --- /dev/null +++ b/modules/_overlays/himalaya.nix @@ -0,0 +1,3 @@ +{inputs, ...}: final: prev: { + himalaya = inputs.himalaya.packages.${prev.stdenv.hostPlatform.system}.default; +} diff --git a/modules/_overlays/jj-ryu.nix b/modules/_overlays/jj-ryu.nix new file mode 100644 index 0000000..df991d5 --- /dev/null +++ b/modules/_overlays/jj-ryu.nix @@ -0,0 +1,15 @@ +{inputs, ...}: final: prev: let + naersk-lib = prev.callPackage inputs.naersk {}; + manifest = (prev.lib.importTOML "${inputs.jj-ryu}/Cargo.toml").package; +in { + jj-ryu = + naersk-lib.buildPackage { + pname = manifest.name; + version = manifest.version; + src = inputs.jj-ryu; + nativeBuildInputs = [prev.pkg-config]; + buildInputs = [prev.openssl]; + OPENSSL_NO_VENDOR = 1; + doCheck = false; + }; +} diff --git a/modules/_overlays/jj-starship.nix b/modules/_overlays/jj-starship.nix new file mode 100644 index 0000000..7a1cc0a --- /dev/null +++ b/modules/_overlays/jj-starship.nix @@ -0,0 +1 @@ +{inputs, ...}: inputs.jj-starship.overlays.default diff --git a/modules/_overlays/pi-agent-stuff.nix b/modules/_overlays/pi-agent-stuff.nix new file mode 100644 index 0000000..751a49a --- /dev/null +++ b/modules/_overlays/pi-agent-stuff.nix @@ -0,0 +1,10 @@ +{inputs, ...}: final: prev: { + pi-agent-stuff = + prev.buildNpmPackage { + pname = "pi-agent-stuff"; + version = "1.5.0"; + src = inputs.pi-agent-stuff; + npmDepsHash = "sha256-pyXMNdlie8vAkhz2f3GUGT3CCYuwt+xkWnsijBajXIo="; + dontNpmBuild = true; + }; +} diff --git a/modules/_overlays/pi-harness.nix b/modules/_overlays/pi-harness.nix new file mode 100644 index 0000000..133b8d3 --- /dev/null +++ b/modules/_overlays/pi-harness.nix @@ -0,0 +1,33 @@ +{inputs, ...}: final: prev: { + pi-harness = + prev.stdenvNoCC.mkDerivation { + pname = "pi-harness"; + version = "0.0.0"; + src = inputs.pi-harness; + + pnpmDeps = + prev.fetchPnpmDeps { + pname = "pi-harness"; + version = "0.0.0"; + src = inputs.pi-harness; + pnpm = prev.pnpm_10; + fetcherVersion = 1; + hash = "sha256-FgtJnmJ0/udz2A9N2DQns+a2CspMDEDk0DPUAxmCVY4="; + }; + + nativeBuildInputs = [ + prev.pnpmConfigHook + prev.pnpm_10 + prev.nodejs + ]; + + dontBuild = true; + + installPhase = '' + runHook preInstall + mkdir -p $out/lib/node_modules/@aliou/pi-harness + cp -r . $out/lib/node_modules/@aliou/pi-harness + runHook postInstall + ''; + }; +} diff --git a/modules/_overlays/pi-mcp-adapter.nix b/modules/_overlays/pi-mcp-adapter.nix new file mode 100644 index 0000000..b5fd060 --- /dev/null +++ b/modules/_overlays/pi-mcp-adapter.nix @@ -0,0 +1,16 @@ +{inputs, ...}: final: prev: { + pi-mcp-adapter = + prev.buildNpmPackage { + pname = "pi-mcp-adapter"; + version = "2.2.0"; + src = + prev.fetchFromGitHub { + owner = "nicobailon"; + repo = "pi-mcp-adapter"; + rev = "v2.2.0"; + hash = "sha256-E6Kf+OyTN/pF8pKADJO0B1+buAPqNcXnZl9ssZwSP8U="; + }; + npmDepsHash = "sha256-myJ9h/zC/KDddt8NOVvJjjqbnkdEN4ZR+okCR5nu7hM="; + dontNpmBuild = true; + }; +} diff --git a/modules/_overlays/zjstatus.nix b/modules/_overlays/zjstatus.nix new file mode 100644 index 0000000..b475305 --- /dev/null +++ b/modules/_overlays/zjstatus.nix @@ -0,0 +1,3 @@ +{inputs, ...}: final: prev: { + zjstatus = inputs.zjstatus.packages.${prev.stdenv.hostPlatform.system}.default; +} diff --git a/modules/ai-tools.nix b/modules/ai-tools.nix index c674375..da51aef 100644 --- a/modules/ai-tools.nix +++ b/modules/ai-tools.nix @@ -2,6 +2,7 @@ den.aspects.ai-tools.homeManager = { pkgs, inputs', + lib, ... }: { home.packages = [ @@ -28,6 +29,152 @@ source = "${inputs.pi-elixir}/skills/elixir-dev"; recursive = true; }; + ".pi/agent/skills/jujutsu/SKILL.md".text = + lib.removePrefix "\n" (builtins.replaceStrings ["\t"] [""] '' + --- + name: jujutsu + description: Manages version control with Jujutsu (jj), including rebasing, conflict resolution, and Git interop. Use when tracking changes, navigating history, squashing/splitting commits, or pushing to Git remotes. + --- + + # Jujutsu + + Git-compatible VCS focused on concurrent development and ease of use. + + > ⚠️ **Not Git!** Jujutsu syntax differs from Git: + > + > - Parent: `@-` not `@~1` or `@^` + > - Grandparent: `@--` not `@~2` + > - Child: `@+` not `@~-1` + > - Use `jj log` not `jj changes` + + ## Key Commands + + | Command | Description | + | -------------------------- | -------------------------------------------- | + | `jj st` | Show working copy status | + | `jj log` | Show change log | + | `jj diff` | Show changes in working copy | + | `jj new` | Create new change | + | `jj desc` | Edit change description | + | `jj squash` | Move changes to parent | + | `jj split` | Split current change | + | `jj rebase -s src -d dest` | Rebase changes | + | `jj absorb` | Move changes into stack of mutable revisions | + | `jj bisect` | Find bad revision by bisection | + | `jj fix` | Update files with formatting fixes | + | `jj sign` | Cryptographically sign a revision | + | `jj metaedit` | Modify metadata without changing content | + + ## Basic Workflow + + ```bash + jj new # Create new change + jj desc -m "feat: add feature" # Set description + jj log # View history + jj edit change-id # Switch to change + jj new --before @ # Time travel (create before current) + jj edit @- # Go to parent + ``` + + ## Time Travel + + ```bash + jj edit change-id # Switch to specific change + jj next --edit # Next child change + jj edit @- # Parent change + jj new --before @ -m msg # Insert before current + ``` + + ## Merging & Rebasing + + ```bash + jj new x yz -m msg # Merge changes + jj rebase -s src -d dest # Rebase source onto dest + jj abandon # Delete current change + ``` + + ## Conflicts + + ```bash + jj resolve # Interactive conflict resolution + # Edit files, then continue + ``` + + ## Revset Syntax + + **Parent/child operators:** + + | Syntax | Meaning | Example | + | ------ | ---------------- | -------------------- | + | `@-` | Parent of @ | `jj diff -r @-` | + | `@--` | Grandparent | `jj log -r @--` | + | `x-` | Parent of x | `jj diff -r abc123-` | + | `@+` | Child of @ | `jj log -r @+` | + | `x::y` | x to y inclusive | `jj log -r main::@` | + | `x..y` | x to y exclusive | `jj log -r main..@` | + | `x\|y` | Union (or) | `jj log -r 'a \| b'` | + + **⚠️ Common mistakes:** + + - ❌ `@~1` → ✅ `@-` (parent) + - ❌ `@^` → ✅ `@-` (parent) + - ❌ `@~-1` → ✅ `@+` (child) + - ❌ `jj changes` → ✅ `jj log` or `jj diff` + - ❌ `a,b,c` → ✅ `a | b | c` (union uses pipe, not comma) + + **Functions:** + + ```bash + jj log -r 'heads(all())' # All heads + jj log -r 'remote_bookmarks()..' # Not on remote + jj log -r 'author(name)' # By author + jj log -r 'description(regex)' # By description + jj log -r 'mine()' # My commits + jj log -r 'committer_date(after:"7 days ago")' # Recent commits + jj log -r 'mine() & committer_date(after:"yesterday")' # My recent + ``` + + ## Templates + + ```bash + jj log -T 'commit_id ++ "\n" ++ description' + ``` + + ## Git Interop + + ```bash + jj bookmark create main -r @ # Create bookmark + jj git push --bookmark main # Push bookmark + jj git fetch # Fetch from remote + jj bookmark track main@origin # Track remote + ``` + + ## Advanced Commands + + ```bash + jj absorb # Auto-move changes to relevant commits in stack + jj bisect start # Start bisection + jj bisect good # Mark current as good + jj bisect bad # Mark current as bad + jj fix # Run configured formatters on files + jj sign -r @ # Sign current revision + jj metaedit -r @ -m "new message" # Edit metadata only + ``` + + ## Tips + + - No staging: changes are immediate + - Use conventional commits: `type(scope): desc` + - `jj undo` to revert operations + - `jj op log` to see operation history + - Bookmarks are like branches + - `jj absorb` is powerful for fixing up commits in a stack + + ## Related Skills + + - **gh**: GitHub CLI for PRs and issues + - **review**: Code review before committing + ''); ".pi/agent/themes" = { source = "${inputs.pi-rose-pine}/themes"; recursive = true; @@ -35,6 +182,7 @@ ".pi/agent/settings.json".text = builtins.toJSON { theme = "rose-pine-dawn"; + quietStartup = true; hideThinkingBlock = true; defaultProvider = "openai-codex"; defaultModel = "gpt-5.4"; @@ -53,7 +201,7 @@ themes = []; } { - source = "${inputs.pi-harness}"; + source = "${pkgs.pi-harness}/lib/node_modules/@aliou/pi-harness"; extensions = ["extensions/breadcrumbs/index.ts"]; skills = []; prompts = []; diff --git a/modules/overlays.nix b/modules/overlays.nix index 9a96497..afb3085 100644 --- a/modules/overlays.nix +++ b/modules/overlays.nix @@ -1,112 +1,23 @@ {inputs, ...}: let overlays = [ # himalaya - (final: prev: { - himalaya = inputs.himalaya.packages.${prev.stdenv.hostPlatform.system}.default; - }) + (import ./_overlays/himalaya.nix {inherit inputs;}) # ast-grep (test_scan_invalid_rule_id fails on darwin in sandbox) - (final: prev: { - ast-grep = - prev.ast-grep.overrideAttrs (old: { - doCheck = false; - }); - }) + (import ./_overlays/ast-grep.nix {inherit inputs;}) # jj-ryu - (final: prev: let - naersk-lib = prev.callPackage inputs.naersk {}; - manifest = (prev.lib.importTOML "${inputs.jj-ryu}/Cargo.toml").package; - in { - jj-ryu = - naersk-lib.buildPackage { - pname = manifest.name; - version = manifest.version; - src = inputs.jj-ryu; - nativeBuildInputs = [prev.pkg-config]; - buildInputs = [prev.openssl]; - OPENSSL_NO_VENDOR = 1; - doCheck = false; - }; - }) - + (import ./_overlays/jj-ryu.nix {inherit inputs;}) # cog-cli - (final: prev: let - version = "0.22.1"; - srcs = { - x86_64-linux = - prev.fetchurl { - url = "https://github.com/trycog/cog-cli/releases/download/v${version}/cog-linux-x86_64.tar.gz"; - hash = "sha256-ET+sNXisUrHShR1gxqdumegXycXcxGzJcQOdTr5005w="; - }; - aarch64-darwin = - prev.fetchurl { - url = "https://github.com/trycog/cog-cli/releases/download/v${version}/cog-darwin-arm64.tar.gz"; - hash = "sha256-jcN+DtOqr3or5C71jp7AIAz0wh73FYybCC4FRBykKO4="; - }; - }; - in { - cog-cli = - prev.stdenvNoCC.mkDerivation { - pname = "cog-cli"; - inherit version; - src = - srcs.${prev.stdenv.hostPlatform.system} - or (throw "Unsupported system for cog-cli: ${prev.stdenv.hostPlatform.system}"); - - dontUnpack = true; - dontConfigure = true; - dontBuild = true; - - installPhase = '' - runHook preInstall - tar -xzf "$src" - install -Dm755 cog "$out/bin/cog" - runHook postInstall - ''; - - meta = with prev.lib; { - description = "Memory, code intelligence, and debugging for AI agents"; - homepage = "https://github.com/trycog/cog-cli"; - license = licenses.mit; - mainProgram = "cog"; - platforms = builtins.attrNames srcs; - sourceProvenance = [sourceTypes.binaryNativeCode]; - }; - }; - }) + (import ./_overlays/cog-cli.nix {inherit inputs;}) # pi-agent-stuff (mitsuhiko) - (final: prev: { - pi-agent-stuff = - prev.buildNpmPackage { - pname = "pi-agent-stuff"; - version = "1.5.0"; - src = inputs.pi-agent-stuff; - npmDepsHash = "sha256-pyXMNdlie8vAkhz2f3GUGT3CCYuwt+xkWnsijBajXIo="; - dontNpmBuild = true; - }; - }) + (import ./_overlays/pi-agent-stuff.nix {inherit inputs;}) + # pi-harness (aliou) + (import ./_overlays/pi-harness.nix {inherit inputs;}) # pi-mcp-adapter - (final: prev: { - pi-mcp-adapter = - prev.buildNpmPackage { - pname = "pi-mcp-adapter"; - version = "2.2.0"; - src = - prev.fetchFromGitHub { - owner = "nicobailon"; - repo = "pi-mcp-adapter"; - rev = "v2.2.0"; - hash = "sha256-E6Kf+OyTN/pF8pKADJO0B1+buAPqNcXnZl9ssZwSP8U="; - }; - npmDepsHash = "sha256-myJ9h/zC/KDddt8NOVvJjjqbnkdEN4ZR+okCR5nu7hM="; - dontNpmBuild = true; - }; - }) + (import ./_overlays/pi-mcp-adapter.nix {inherit inputs;}) # jj-starship (passes through upstream overlay) - inputs.jj-starship.overlays.default + (import ./_overlays/jj-starship.nix {inherit inputs;}) # zjstatus - (final: prev: { - zjstatus = inputs.zjstatus.packages.${prev.stdenv.hostPlatform.system}.default; - }) + (import ./_overlays/zjstatus.nix {inherit inputs;}) ]; in { den.default.nixos.nixpkgs.overlays = overlays;