Skip to content

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

@rhnvrm

Description

@rhnvrm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions