1.4 KiB
1.4 KiB
Playbook: Add a Script Unit
- Name: Add a script via
mkscript - Purpose: Ship a script package with optional user service and timer.
- Prerequisites: Identify target users (
my.toggleUsers.scriptsdefaults), secureHost status if the script needs secrets, and whether a timer/service is required. - Inputs: Script name, package derivation, description, timer schedule, users list, service needs.
- Steps:
- Add a definition under
my.scripts.<name>inmodules/scripts/<name>.nixusingmkscriptoptions (enable,install,service,users,timer,package,description). - Ensure the package exposes the executable name used by the service/timer.
- For user scoping, set
usersto a single user or list; defaults come frommy.toggleUsers.scripts. - If secrets are required, guard references with
lib.mkIf config.my.secureHostand map them to the appropriate secrets file. - Enable the script toggle in
hosts/<host>/toggles.nixunderscriptsorunits, and ensure timers/services are expected on that host.
- Add a definition under
- Validation:
- Script installs for intended users; systemd user service/timer activates only when
enableandserviceare true. - secureHost gating present for any secrets; no orphaned timers.
- Script installs for intended users; systemd user service/timer activates only when
- Outputs: New script module and updated host toggles if needed.
- References:
docs/constitution.md(Terminology, Secrets Map),docs/reference/index.md(Module Directories, Secrets Map, Hosts and Roles)