Skip to content

Commit d17cc76

Browse files
dansanduleacclaude
andcommitted
resolve bundled plugins from flake input instead of hardcoded rev
Replace hardcoded rev/narHash in lib.nix with direct sub-flake evaluation from the nix-steipete-tools flake input. This: - Eliminates "not writing modified lock file" warnings caused by builtins.getFlake on sub-flakes without committed flake.lock files - Allows downstream consumers to override nix-steipete-tools via the standard flake input/follows mechanism instead of being pinned to a hardcoded revision - Introduces a "bundled:" URI scheme in plugins.nix that imports and evaluates sub-flakes directly from the source tree The nix-steipete-tools input is threaded to the HM module via _module.args.steipeteToolsInput, set once at the flake output level. Only lib.nix and plugins.nix (which are plain Nix files, not modules) receive it via explicit function arguments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 80373ef commit d17cc76

10 files changed

Lines changed: 65 additions & 17 deletions

File tree

flake.nix

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
};
7575
config-validity = pkgs.callPackage ./nix/checks/openclaw-config-validity.nix {
7676
openclawGateway = packageSetStable.openclaw-gateway;
77+
steipeteToolsInput = nix-steipete-tools;
7778
};
7879
}
7980
// (
@@ -84,10 +85,14 @@
8485
};
8586
config-options = pkgs.callPackage ./nix/checks/openclaw-config-options.nix {
8687
sourceInfo = sourceInfoStable;
88+
steipeteToolsInput = nix-steipete-tools;
89+
};
90+
default-instance = pkgs.callPackage ./nix/checks/openclaw-default-instance.nix {
91+
steipeteToolsInput = nix-steipete-tools;
8792
};
88-
default-instance = pkgs.callPackage ./nix/checks/openclaw-default-instance.nix { };
8993
hm-activation = import ./nix/checks/openclaw-hm-activation.nix {
9094
inherit pkgs home-manager;
95+
steipeteToolsInput = nix-steipete-tools;
9196
};
9297
}
9398
else
@@ -121,7 +126,11 @@
121126
// {
122127
overlays.default = overlay;
123128
nixosModules.openclaw-gateway = import ./nix/modules/nixos/openclaw-gateway.nix;
124-
homeManagerModules.openclaw = import ./nix/modules/home-manager/openclaw.nix;
125-
darwinModules.openclaw = import ./nix/modules/darwin/openclaw.nix;
129+
homeManagerModules.openclaw = {
130+
_module.args.steipeteToolsInput = nix-steipete-tools;
131+
imports = [ ./nix/modules/home-manager/openclaw ];
132+
};
133+
darwinModules.openclaw =
134+
import ./nix/modules/darwin/openclaw.nix { inherit nix-steipete-tools; };
126135
};
127136
}

nix/checks/openclaw-config-options.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
pkgs,
44
stdenv,
55
fetchFromGitHub,
6+
steipeteToolsInput,
67
fetchurl,
78
nodejs_22,
89
pnpm_10,
@@ -76,7 +77,8 @@ let
7677
pluginEval = lib.evalModules {
7778
modules = [
7879
stubModule
79-
../modules/home-manager/openclaw.nix
80+
{ _module.args.steipeteToolsInput = steipeteToolsInput; }
81+
../modules/home-manager/openclaw
8082
(
8183
{ lib, options, ... }:
8284
{

nix/checks/openclaw-config-validity.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
stdenv,
55
nodejs_22,
66
openclawGateway,
7+
steipeteToolsInput,
78
}:
89

910
let
@@ -61,7 +62,8 @@ let
6162
moduleEval = lib.evalModules {
6263
modules = [
6364
stubModule
64-
../modules/home-manager/openclaw.nix
65+
{ _module.args.steipeteToolsInput = steipeteToolsInput; }
66+
../modules/home-manager/openclaw
6567
(
6668
{ lib, ... }:
6769
{

nix/checks/openclaw-default-instance.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib,
33
pkgs,
44
stdenv,
5+
steipeteToolsInput,
56
}:
67

78
let
@@ -59,7 +60,8 @@ let
5960
eval = lib.evalModules {
6061
modules = [
6162
stubModule
62-
../modules/home-manager/openclaw.nix
63+
{ _module.args.steipeteToolsInput = steipeteToolsInput; }
64+
../modules/home-manager/openclaw
6365
(
6466
{ lib, ... }:
6567
{

nix/checks/openclaw-hm-activation.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
{ pkgs, home-manager }:
1+
{ pkgs, home-manager, steipeteToolsInput }:
22

33
let
4-
openclawModule = ../modules/home-manager/openclaw.nix;
4+
openclawModule = {
5+
_module.args.steipeteToolsInput = steipeteToolsInput;
6+
imports = [ ../modules/home-manager/openclaw ];
7+
};
58
testScript = builtins.readFile ../tests/hm-activation.py;
69

710
in

nix/modules/darwin/openclaw.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
{ nix-steipete-tools }:
12
{ config, lib, ... }:
23

34
{
45
config = lib.mkIf (config ? home-manager) {
5-
home-manager.sharedModules = [ ../home-manager/openclaw.nix ];
6+
home-manager.sharedModules = [
7+
{
8+
_module.args.steipeteToolsInput = nix-steipete-tools;
9+
imports = [ ../home-manager/openclaw ];
10+
}
11+
];
612
};
713
}

nix/modules/home-manager/openclaw/config.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
config,
33
lib,
44
pkgs,
5+
steipeteToolsInput,
56
...
67
}:
78

89
let
9-
openclawLib = import ./lib.nix { inherit config lib pkgs; };
10+
openclawLib = import ./lib.nix { inherit config lib pkgs steipeteToolsInput; };
1011
cfg = openclawLib.cfg;
1112
homeDir = openclawLib.homeDir;
1213
appPackage = openclawLib.appPackage;
@@ -51,6 +52,7 @@ let
5152
pkgs
5253
openclawLib
5354
enabledInstances
55+
steipeteToolsInput
5456
;
5557
};
5658

nix/modules/home-manager/openclaw/lib.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
config,
33
lib,
44
pkgs,
5+
steipeteToolsInput,
56
}:
67

78
let
@@ -26,11 +27,10 @@ let
2627

2728
bundledPluginSources =
2829
let
29-
stepieteRev = "c110209720cbc6c87fccb6c1e1c2b79b1d719245";
30-
stepieteNarHash = "sha256-1Vo7rcLGdKaqj39J3HhBKh8IbljSjgCUhinCFJbDPl8=";
31-
stepiete =
32-
tool:
33-
"github:openclaw/nix-steipete-tools?dir=tools/${tool}&rev=${stepieteRev}&narHash=${stepieteNarHash}";
30+
# Use a "bundled:" URI scheme that plugins.nix resolves by importing the
31+
# sub-flake directly from the nix-steipete-tools source tree, avoiding
32+
# builtins.getFlake and its lockfile warnings.
33+
stepiete = tool: "bundled:steipete/${tool}";
3434
in
3535
lib.mapAttrs (_name: plugin: plugin.source or (stepiete plugin.tool)) pluginCatalog;
3636

nix/modules/home-manager/openclaw/options.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
config,
33
lib,
44
pkgs,
5+
steipeteToolsInput,
56
...
67
}:
78

89
let
9-
openclawLib = import ./lib.nix { inherit config lib pkgs; };
10+
openclawLib = import ./lib.nix { inherit config lib pkgs steipeteToolsInput; };
1011
instanceModule = import ./options-instance.nix { inherit lib openclawLib; };
1112
pluginCatalog = import ./plugin-catalog.nix;
1213
mkSkillOption = lib.types.submodule {

nix/modules/home-manager/openclaw/plugins.nix

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,37 @@
33
pkgs,
44
openclawLib,
55
enabledInstances,
6+
steipeteToolsInput,
67
}:
78

89
let
910
resolvePath = openclawLib.resolvePath;
1011
toRelative = openclawLib.toRelative;
1112

13+
# Resolve a "bundled:steipete/<tool>" source by importing the sub-flake
14+
# directly from the steipeteToolsInput source tree instead of calling
15+
# builtins.getFlake with a URL (which requires a committed flake.lock in
16+
# every sub-flake directory to avoid warnings).
17+
resolveBundledFlake =
18+
source:
19+
let
20+
tool = lib.removePrefix "bundled:steipete/" source;
21+
subFlakeNix = import "${steipeteToolsInput}/tools/${tool}/flake.nix";
22+
in
23+
subFlakeNix.outputs {
24+
self = { };
25+
nixpkgs = { inherit lib; };
26+
root = steipeteToolsInput;
27+
};
28+
1229
resolvePlugin =
1330
plugin:
1431
let
15-
flake = builtins.getFlake plugin.source;
32+
flake =
33+
if lib.hasPrefix "bundled:" plugin.source then
34+
resolveBundledFlake plugin.source
35+
else
36+
builtins.getFlake plugin.source;
1637
system = pkgs.stdenv.hostPlatform.system;
1738
openclawPluginRaw =
1839
if flake ? openclawPlugin then

0 commit comments

Comments
 (0)