Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/codex/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Use activation script instead of home.file symlink
# Codex CLI uses atomic writes that break symlinks, so we force-copy on each switch
home.activation.codexConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
$DRY_RUN_CMD mkdir -p ~/.codex
$DRY_RUN_CMD cp -f ${./config.toml} ~/.codex/config.toml
$DRY_RUN_CMD chmod 600 ~/.codex/config.toml
'';
Expand Down
30 changes: 19 additions & 11 deletions config/openclaw/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,25 @@ let

mode = if host.isKyber then "gateway" else "client";

hydrateScript = pkgs.replaceVars ./hydrate.sh ({
sed = "${pkgs.gnused}/bin/sed";
template = ./openclaw.template.json;
inherit mode;
} // (if host.isKyber then {
chromium = pkgs.chromium;
openclaw = "${homeDir}/.bun";
} else {
chromium = "/unused";
openclaw = "/unused";
}));
hydrateScript = pkgs.replaceVars ./hydrate.sh (
{
sed = "${pkgs.gnused}/bin/sed";
template = ./openclaw.template.json;
inherit mode;
}
Comment on lines +15 to +19

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Sort the base attribute set alphabetically.

mode (via inherit mode;) should be ordered before sed and template to follow the Nix attribute sorting guideline. As per coding guidelines, “Sort attribute sets alphabetically in Nix files.”

Suggested adjustment
-    {
-      sed = "${pkgs.gnused}/bin/sed";
-      template = ./openclaw.template.json;
-      inherit mode;
-    }
+    {
+      inherit mode;
+      sed = "${pkgs.gnused}/bin/sed";
+      template = ./openclaw.template.json;
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
sed = "${pkgs.gnused}/bin/sed";
template = ./openclaw.template.json;
inherit mode;
}
{
inherit mode;
sed = "${pkgs.gnused}/bin/sed";
template = ./openclaw.template.json;
}
🤖 Prompt for AI Agents
In `@config/openclaw/default.nix` around lines 15 - 19, Reorder the base attribute
set so attributes are alphabetized: move the inherited attribute `mode` to
appear before `sed` and `template` (i.e., ensure `mode` comes first, then `sed =
"${pkgs.gnused}/bin/sed";`, then `template = ./openclaw.template.json;`) so the
attribute set containing `sed`, `template`, and `inherit mode;` follows the Nix
alphabetical sorting guideline.

// (
if host.isKyber then
{
chromium = pkgs.chromium;
openclaw = "${homeDir}/.bun";
}
else
{
chromium = "/unused";
openclaw = "/unused";
}
)
);
Comment on lines +14 to +32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While the reformatting improves readability by adding more whitespace, it also becomes quite verbose. A let ... in expression can be used to separate the conditional logic, making the main attribute set definition cleaner and more focused. This improves maintainability by isolating the conditional parts.

  hydrateScript = pkgs.replaceVars ./hydrate.sh (
    let
      kyberAttrs = if host.isKyber then {
        chromium = pkgs.chromium;
        openclaw = "${homeDir}/.bun";
      } else {
        chromium = "/unused";
        openclaw = "/unused";
      };
    in
    {
      sed = "${pkgs.gnused}/bin/sed";
      template = ./openclaw.template.json;
      inherit mode;
    } // kyberAttrs
  );

in
{
# Hydrate OpenClaw config from .env secrets
Expand Down
Loading