Bug: Hardcoded /bin/mkdir and /bin/ln paths fail on NixOS #1

Closed
opened 2026-02-15 17:04:25 -05:00 by yindo · 2 comments
Owner

Originally created by @rhnvrm on GitHub (Jan 19, 2026).

Description

The home-manager module uses hardcoded paths /bin/mkdir and /bin/ln in activation scripts, which don't exist on NixOS. On NixOS, these binaries are located at /run/current-system/sw/bin/.

Environment

  • NixOS 24.11 (unstable)
  • nix-clawdbot (latest from main branch)
  • Deployed via nixos-anywhere to Hetzner Cloud

Error

During home-manager activation (as part of nixos-rebuild switch):

/nix/store/c23s6r3g3xv3gwyg42smqkxydccy0ghq-home-manager-generation/activate: line 276: /bin/mkdir: No such file or directory

Affected Code

In nix/modules/home-manager/clawdbot.nix, the activation scripts use hardcoded paths:

home.activation.clawdbotDirs = lib.hm.dag.entryAfter [ "writeBoundary" ]
  '/bin/mkdir -p ...'

home.activation.clawdbotConfigFiles = ...
  '/bin/ln -sfn ...'

Workaround

Create symlinks manually on the NixOS host before running home-manager:

sudo mkdir -p /bin
sudo ln -sf /run/current-system/sw/bin/mkdir /bin/mkdir
sudo ln -sf /run/current-system/sw/bin/ln /bin/ln

Suggested Fix

Replace hardcoded paths with the home-manager $DRY_RUN_CMD convention which handles PATH correctly:

home.activation.clawdbotDirs = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
  $DRY_RUN_CMD mkdir -p ...
'';

home.activation.clawdbotConfigFiles = ... ''
  $DRY_RUN_CMD ln -sfn ...
'';

Alternatively, use explicit nix store paths:

home.activation.clawdbotDirs = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
  ${pkgs.coreutils}/bin/mkdir -p ...
'';

Both approaches are portable across NixOS, macOS, and traditional Linux distributions.

Originally created by @rhnvrm on GitHub (Jan 19, 2026). ## Description The home-manager module uses hardcoded paths `/bin/mkdir` and `/bin/ln` in activation scripts, which don't exist on NixOS. On NixOS, these binaries are located at `/run/current-system/sw/bin/`. ## Environment - NixOS 24.11 (unstable) - nix-clawdbot (latest from main branch) - Deployed via nixos-anywhere to Hetzner Cloud ## Error During `home-manager` activation (as part of `nixos-rebuild switch`): ``` /nix/store/c23s6r3g3xv3gwyg42smqkxydccy0ghq-home-manager-generation/activate: line 276: /bin/mkdir: No such file or directory ``` ## Affected Code In `nix/modules/home-manager/clawdbot.nix`, the activation scripts use hardcoded paths: ```nix home.activation.clawdbotDirs = lib.hm.dag.entryAfter [ "writeBoundary" ] '/bin/mkdir -p ...' home.activation.clawdbotConfigFiles = ... '/bin/ln -sfn ...' ``` ## Workaround Create symlinks manually on the NixOS host before running home-manager: ```bash sudo mkdir -p /bin sudo ln -sf /run/current-system/sw/bin/mkdir /bin/mkdir sudo ln -sf /run/current-system/sw/bin/ln /bin/ln ``` ## Suggested Fix Replace hardcoded paths with the home-manager `$DRY_RUN_CMD` convention which handles PATH correctly: ```nix home.activation.clawdbotDirs = lib.hm.dag.entryAfter [ "writeBoundary" ] '' $DRY_RUN_CMD mkdir -p ... ''; home.activation.clawdbotConfigFiles = ... '' $DRY_RUN_CMD ln -sfn ... ''; ``` Alternatively, use explicit nix store paths: ```nix home.activation.clawdbotDirs = lib.hm.dag.entryAfter [ "writeBoundary" ] '' ${pkgs.coreutils}/bin/mkdir -p ... ''; ``` Both approaches are portable across NixOS, macOS, and traditional Linux distributions.
yindo closed this issue 2026-02-15 17:04:25 -05:00
Author
Owner

@zenware commented on GitHub (Jan 27, 2026):

The correct way to solve this problem per home-manager: https://nix-community.github.io/home-manager/options.xhtml#opt-home.activation

Is to prefix commands with run in a home-manager activation context. Which also has the benefit of respecting env vars like DRY_RUN=1 or flags like --verbose

I've been trying to build a check that runs on nix flake check or which runs in the CI that can clearly show as a pair of two commits, that the issue exists in the activation stage, and that a change to run mkdir solves it... But for some reason it's been really tricky to get the activation scripts to trigger unless actually building and running (e.g. home-manager switch)

🤞 hoping the project maintainer can find a weekend to review some of these PRs

@zenware commented on GitHub (Jan 27, 2026): The correct way to solve this problem per home-manager: https://nix-community.github.io/home-manager/options.xhtml#opt-home.activation Is to prefix commands with `run` in a home-manager activation context. Which also has the benefit of respecting env vars like `DRY_RUN=1` or flags like `--verbose` I've been trying to build a check that runs on `nix flake check` or which runs in the CI that can clearly show as a pair of two commits, that the issue exists in the activation stage, and that a change to `run mkdir` solves it... But for some reason it's been really tricky to get the activation scripts to trigger unless actually building **and running** (e.g. `home-manager switch`) 🤞 hoping the project maintainer can find a weekend to review some of these PRs
Author
Owner

@joshp123 commented on GitHub (Feb 3, 2026):

[🤖 this message brought to you by codex] should be fixed in b2721d72 (HM activation uses run + coreutils). Closing for now — come and yell at me in #golden-path-deployments on discord if you're still having issues! Stability work continues; we are making this better every week.

@joshp123 commented on GitHub (Feb 3, 2026): [🤖 this message brought to you by codex] should be fixed in b2721d72 (HM activation uses run + coreutils). Closing for now — come and yell at me in #golden-path-deployments on discord if you're still having issues! Stability work continues; we are making this better every week.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/nix-openclaw#1