Missing systemd.unitName at top level breaks default instance on Linux #14

Open
opened 2026-02-15 17:04:29 -05:00 by yindo · 0 comments
Owner

Originally created by @elsbrock on GitHub (Jan 30, 2026).

Description

The top-level systemd option only defines enable, but the default instance logic copies the entire cfg.systemd object expecting both enable and unitName. This causes an attribute error when using the implicit default instance (without explicit instances configuration).

Location

File: nix/modules/home-manager/openclaw.nix

Top-level systemd option only has enable:

systemd.enable = lib.mkOption {
  type = lib.types.bool;
  default = true;
};

Default instance copies it verbatim:

defaultInstance = {
  systemd = cfg.systemd;  # only { enable = true; }, missing unitName
};

Instance template expects both enable and unitName:

systemd.unitName = lib.mkOption {
  type = lib.types.str;
  default = if name == "default" then "openclaw-gateway" else "openclaw-gateway-${name}";
};

Error

error: attribute 'unitName' missing
       at openclaw.nix:793:10

Reproduction

  1. Configure openclaw using top-level options (no explicit instances attr)
  2. Deploy on NixOS (Linux with systemd)
  3. Evaluation fails at inst.systemd.unitName

Fix

Add unitName to the top-level systemd options:

systemd = {
  enable = lib.mkOption {
    type = lib.types.bool;
    default = true;
  };
  unitName = lib.mkOption {
    type = lib.types.str;
    default = "openclaw-gateway";
  };
};

The same issue likely applies to launchd.label.

Workaround

Use explicit instances:

programs.openclaw = {
  enable = true;
  instances.default = {
    enable = true;
    systemd.enable = true;
    systemd.unitName = "openclaw-gateway";
  };
};
Originally created by @elsbrock on GitHub (Jan 30, 2026). ## Description The top-level `systemd` option only defines `enable`, but the default instance logic copies the entire `cfg.systemd` object expecting both `enable` and `unitName`. This causes an attribute error when using the implicit default instance (without explicit `instances` configuration). ## Location File: `nix/modules/home-manager/openclaw.nix` **Top-level systemd option** only has `enable`: ```nix systemd.enable = lib.mkOption { type = lib.types.bool; default = true; }; ``` **Default instance** copies it verbatim: ```nix defaultInstance = { systemd = cfg.systemd; # only { enable = true; }, missing unitName }; ``` **Instance template** expects both `enable` and `unitName`: ```nix systemd.unitName = lib.mkOption { type = lib.types.str; default = if name == "default" then "openclaw-gateway" else "openclaw-gateway-${name}"; }; ``` ## Error ``` error: attribute 'unitName' missing at openclaw.nix:793:10 ``` ## Reproduction 1. Configure openclaw using top-level options (no explicit `instances` attr) 2. Deploy on NixOS (Linux with systemd) 3. Evaluation fails at `inst.systemd.unitName` ## Fix Add `unitName` to the top-level `systemd` options: ```nix systemd = { enable = lib.mkOption { type = lib.types.bool; default = true; }; unitName = lib.mkOption { type = lib.types.str; default = "openclaw-gateway"; }; }; ``` The same issue likely applies to `launchd.label`. ## Workaround Use explicit instances: ```nix programs.openclaw = { enable = true; instances.default = { enable = true; systemd.enable = true; systemd.unitName = "openclaw-gateway"; }; }; ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/nix-openclaw#14