[PR #24] feat(nixos): add NixOS module for isolated system user #44

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

📋 Pull Request Information

Original PR: https://github.com/openclaw/nix-openclaw/pull/24
Author: @jeanlucthumm
Created: 1/26/2026
Status: 🔄 Open

Base: mainHead: userseg


📝 Commits (10+)

  • 50ff5de fix: resolve ~ paths in systemd service config
  • 006317d fix: bundle extensions dir
  • d8fc64b ci: auto-update version strings in update-pins.sh
  • b608a06 feat: add aarch64-linux support
  • e46f5a2 CLAUDE.md
  • 4742475 PR.md
  • 43c0bee feat(nixos): add option definitions for system service module
  • e745cda feat(nixos): add main module with systemd hardening
  • 9e022e4 feat(flake): export nixosModules.clawdbot
  • b9cfedd test(nixos): add VM integration test for system service module

📊 Changes

11 files changed (+1191 additions, -10 deletions)

View changed files

📝 .gitignore (+1 -0)
CLAUDE.md (+59 -0)
PR.md (+72 -0)
📝 flake.nix (+6 -1)
nix/checks/nixos-module-test.nix (+88 -0)
📝 nix/modules/home-manager/openclaw/config.nix (+9 -9)
nix/modules/nixos/documents-skills.nix (+161 -0)
nix/modules/nixos/openclaw.nix (+364 -0)
nix/modules/nixos/options.nix (+403 -0)
📝 nix/scripts/gateway-install.sh (+8 -0)
📝 scripts/update-pins.sh (+20 -0)

📄 Description

Summary

Adds a NixOS module (nixosModules.clawdbot) that runs the gateway as an isolated system user with systemd hardening.

Closes #22

Important

Depends on #10 - This PR is based on cherry-picked commits from #10 (NixOS and aarch64-linux support). It should be rebased once #10 is merged.

Security Motivation

Currently the home-manager module runs the gateway as the user's personal account, giving the LLM full access to SSH keys, credentials, personal files, etc. Running as a dedicated locked-down system user contains the blast radius.

Features

  • Dedicated clawdbot system user with minimal privileges
  • System-level systemd service with hardening:
    • ProtectHome=true, ProtectSystem=strict
    • PrivateTmp=true, PrivateDevices=true
    • NoNewPrivileges=true
    • CapabilityBoundingSet="" (no capabilities)
    • SystemCallFilter=@system-service
    • Full namespace/kernel protection
  • Multi-instance support via instances.<name>
  • Credential loading from files at runtime
  • Documents and skills installation support

Usage

services.clawdbot = {
  enable = true;
  providers.anthropic.oauthTokenFile = config.age.secrets.clawdbot-token.path;
  providers.telegram = {
    enable = true;
    botTokenFile = config.age.secrets.telegram-token.path;
    allowFrom = [ 12345678 ];
  };
};

Test plan

  • NixOS VM integration test (nix build .#checks.x86_64-linux.nixos-clawdbot)
  • Deployed and tested on real system

Todos

  • Wait for #10 to close
  • Rebase + cleanup
  • Figure out what to do about options duplication between hm and nixos module.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/openclaw/nix-openclaw/pull/24 **Author:** [@jeanlucthumm](https://github.com/jeanlucthumm) **Created:** 1/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `userseg` --- ### 📝 Commits (10+) - [`50ff5de`](https://github.com/openclaw/nix-openclaw/commit/50ff5de9bdd6a4f81c058528b4924a141cdfc400) fix: resolve ~ paths in systemd service config - [`006317d`](https://github.com/openclaw/nix-openclaw/commit/006317def05329942e6830dc77cc0bc6c0ec2098) fix: bundle extensions dir - [`d8fc64b`](https://github.com/openclaw/nix-openclaw/commit/d8fc64b6964e28a7a17f4e62529b47ce69058ba7) ci: auto-update version strings in update-pins.sh - [`b608a06`](https://github.com/openclaw/nix-openclaw/commit/b608a06b2f41bcbc4ed3dda0220eca2d0555a701) feat: add aarch64-linux support - [`e46f5a2`](https://github.com/openclaw/nix-openclaw/commit/e46f5a2f29148fa53701a9810ae27859a9278bab) CLAUDE.md - [`4742475`](https://github.com/openclaw/nix-openclaw/commit/4742475095b791257e1f460dfe30aa237e77bdd3) PR.md - [`43c0bee`](https://github.com/openclaw/nix-openclaw/commit/43c0bee378939f68c5dd3548f6662a8506734a55) feat(nixos): add option definitions for system service module - [`e745cda`](https://github.com/openclaw/nix-openclaw/commit/e745cda7e49221f371197075015099d9c3abadba) feat(nixos): add main module with systemd hardening - [`9e022e4`](https://github.com/openclaw/nix-openclaw/commit/9e022e4a91186a4bfacd9dcc3824f3c6cbca5d2f) feat(flake): export nixosModules.clawdbot - [`b9cfedd`](https://github.com/openclaw/nix-openclaw/commit/b9cfedde7fe310a2479de65c9ec6b8d5750e8472) test(nixos): add VM integration test for system service module ### 📊 Changes **11 files changed** (+1191 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+1 -0) ➕ `CLAUDE.md` (+59 -0) ➕ `PR.md` (+72 -0) 📝 `flake.nix` (+6 -1) ➕ `nix/checks/nixos-module-test.nix` (+88 -0) 📝 `nix/modules/home-manager/openclaw/config.nix` (+9 -9) ➕ `nix/modules/nixos/documents-skills.nix` (+161 -0) ➕ `nix/modules/nixos/openclaw.nix` (+364 -0) ➕ `nix/modules/nixos/options.nix` (+403 -0) 📝 `nix/scripts/gateway-install.sh` (+8 -0) 📝 `scripts/update-pins.sh` (+20 -0) </details> ### 📄 Description ## Summary Adds a NixOS module (`nixosModules.clawdbot`) that runs the gateway as an isolated system user with systemd hardening. Closes #22 > [!IMPORTANT] > **Depends on #10** - This PR is based on cherry-picked commits from #10 (NixOS and aarch64-linux support). It should be rebased once #10 is merged. ## Security Motivation Currently the home-manager module runs the gateway as the user's personal account, giving the LLM full access to SSH keys, credentials, personal files, etc. Running as a dedicated locked-down system user contains the blast radius. ## Features - Dedicated `clawdbot` system user with minimal privileges - System-level systemd service with hardening: - `ProtectHome=true`, `ProtectSystem=strict` - `PrivateTmp=true`, `PrivateDevices=true` - `NoNewPrivileges=true` - `CapabilityBoundingSet=""` (no capabilities) - `SystemCallFilter=@system-service` - Full namespace/kernel protection - Multi-instance support via `instances.<name>` - Credential loading from files at runtime - Documents and skills installation support ## Usage ```nix services.clawdbot = { enable = true; providers.anthropic.oauthTokenFile = config.age.secrets.clawdbot-token.path; providers.telegram = { enable = true; botTokenFile = config.age.secrets.telegram-token.path; allowFrom = [ 12345678 ]; }; }; ``` ## Test plan - [x] NixOS VM integration test (`nix build .#checks.x86_64-linux.nixos-clawdbot`) - [x] Deployed and tested on real system ## Todos - [ ] Wait for #10 to close - [ ] Rebase + cleanup - [ ] Figure out what to do about options duplication between hm and nixos module. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 17:04:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/nix-openclaw#44