Skip to content

Commit a2fe91a

Browse files
committed
Pin happy-coder to monorepo migration PR and wire HAPPY_CLAUDE_PATH
Track nixpkgs PR #492656 (colonelpanic8/nixpkgs happy-coder-monorepo-migration) via a dedicated flake input and overlay until it lands in unstable. The overlay wraps happy/happy-mcp with nodejs on PATH since the CLI spawns child node processes via PATH lookup. Also set HAPPY_CLAUDE_PATH on the happy wrappers and daemon so happy-coder uses the pinned claude-code-bin instead of resolving claude from PATH.
1 parent 1b8374c commit a2fe91a

5 files changed

Lines changed: 43 additions & 2 deletions

File tree

flake.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
1111
nixpkgs-unstable-small.url = "github:nixos/nixpkgs/nixos-unstable-small";
1212

13+
# happy-coder PR #492656 — monorepo migration. Remove once merged into unstable.
14+
nixpkgs-happy-coder.url = "github:colonelpanic8/nixpkgs/happy-coder-monorepo-migration";
15+
1316
# Home manager - always use unstable
1417
home-manager-unstable.url = "github:nix-community/home-manager/master";
1518
home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";

home-manager/bcnelson/_mixins/happy/default.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ let
88
nativeBuildInputs = [ pkgs.makeWrapper ];
99
postBuild = ''
1010
wrapProgram $out/bin/happy \
11-
--set-default HAPPY_HOME_DIR ${happyHomeDir}
11+
--set-default HAPPY_HOME_DIR ${happyHomeDir} \
12+
--set-default HAPPY_CLAUDE_PATH ${pkgs.claude-code-bin}/bin/claude
1213
wrapProgram $out/bin/happy-mcp \
13-
--set-default HAPPY_HOME_DIR ${happyHomeDir}
14+
--set-default HAPPY_HOME_DIR ${happyHomeDir} \
15+
--set-default HAPPY_CLAUDE_PATH ${pkgs.claude-code-bin}/bin/claude
1416
'';
1517
inherit (pkgs.happy-coder) meta;
1618
};

modules/nixos/happy-daemon.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ in
1515

1616
authNotifyPackage = lib.mkPackageOption pkgs "happy-auth-notify" { };
1717

18+
claudePackage = lib.mkPackageOption pkgs "claude-code-bin" { };
19+
1820
happyHomeDir = lib.mkOption {
1921
type = lib.types.str;
2022
default = "/home/${cfg.user}/.local/share/happy";
@@ -60,6 +62,7 @@ in
6062
Environment = [
6163
"HOME=/home/${cfg.user}"
6264
"HAPPY_HOME_DIR=${cfg.happyHomeDir}"
65+
"HAPPY_CLAUDE_PATH=${cfg.claudePackage}/bin/claude"
6366
];
6467
ExecStart = "${cfg.package}/bin/happy daemon start-sync";
6568
Restart = "on-failure";

overlays/default.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@
99
# https://nixos.wiki/wiki/Overlays
1010
modifications = final: prev: {
1111
# libsForQt5.sddm = nixpkgs-unstable.libsForQt5.sddm;
12+
13+
# happy-coder PR #492656 — monorepo migration, pre-merge testing.
14+
# Remove once the PR lands in nixpkgs-unstable.
15+
# The PR's wrapper invokes node by absolute path but the CLI spawns child
16+
# `node` processes via PATH lookup (e.g. `happy daemon start-sync`),
17+
# so add nodejs to PATH here.
18+
happy-coder = (inputs.nixpkgs-happy-coder.legacyPackages.${final.stdenv.hostPlatform.system}.happy-coder).overrideAttrs (old: {
19+
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ final.makeWrapper ];
20+
postFixup = (old.postFixup or "") + ''
21+
wrapProgram $out/bin/happy \
22+
--prefix PATH : ${final.lib.makeBinPath [ final.nodejs ]}
23+
wrapProgram $out/bin/happy-mcp \
24+
--prefix PATH : ${final.lib.makeBinPath [ final.nodejs ]}
25+
'';
26+
});
27+
1228
claude-code-bin = prev.claude-code-bin.overrideAttrs (oldAttrs: {
1329
postFixup = (oldAttrs.postFixup or "") + ''
1430
wrapProgram $out/bin/claude \

0 commit comments

Comments
 (0)