Imported from Ginner/ApexOS (
nixosModules/services/AGENTS.md). Install upstream withnpx skills add Ginner/ApexOS --skill services. Copyright stays with the author.
AGENTS.md — nixosModules/services/
System-level daemons and services. A module belongs here if it manages a running system process (systemd service, udev rule, kernel feature).
What belongs here vs programs/
- services/: background daemons, hardware management, kernel features
- Examples: pipewire (audio), greetd (login manager), tlp (power), tailscale (network), xremap (input), bolt (Thunderbolt), fwupd (firmware), brightnessctl (backlight), kde-connect, openssh, podman
- programs/: system-level CLI tools or programs that require system-level enablement
- Examples: hyprland (requires system setuid/capabilities), zsh (requires
/etc/shells), usbutils, agenix
- Examples: hyprland (requires system setuid/capabilities), zsh (requires
Current services
| Module | Option path | Description |
|---|---|---|
| bolt.nix | myModules.services.bolt |
Thunderbolt device management |
| brightnessctl.nix | myModules.services.brightnessctl |
Screen backlight control |
| fwupd.nix | myModules.services.fwupd |
Firmware update daemon |
| greetd.nix | myModules.services.greetd |
Display/login manager (tuigreet) |
| kde-connect.nix | myModules.services.kde-connect |
KDE Connect service |
| openssh.nix | myModules.services.openssh |
SSH daemon |
| pipewire.nix | myModules.services.pipewire |
Audio (PipeWire + PulseAudio compat) |
| podman.nix | myModules.services.podman |
Container runtime |
| printing.nix | myModules.services.printing |
CUPS printing + Avahi mDNS printer discovery, managed via CUPS web UI |
| scanning.nix | myModules.services.scanning |
SANE + driverless eSCL/WSD scanning |
| tailscale.nix | myModules.services.tailscale |
VPN mesh networking |
| tlp.nix | myModules.services.tlp |
Power management (battery thresholds) |
| xremap.nix | myModules.services.xremap |
Key remapping |
Module conventions
{ config, lib, pkgs, ... }:
let cfg = config.myModules.services.<name>; in
{
options.myModules.services.<name> = {
enable = lib.mkEnableOption "<description>";
# Additional configurable options with sensible defaults
};
config = lib.mkIf cfg.enable {
services.<name>.enable = true;
# ...
};
}
Patterns observed:
greetd.nix: exposessessionCommandoption (default: tuigreet with Hyprland). Session type is configurable without touching the module.tlp.nix: exposesbatteryThresholds.BAT0/BAT1.{start,stop}andextraSettings. Useslib.mkMergefor multiple config blocks.xremap.nix: exposesmodmaps,extraConfig,includeDefaults(CapsLock → Super/Esc remap). Readsconfig.userGlobals.usernameto add the user toinput/uinputgroups.
Accessing the primary user: Use config.userGlobals.username when the service needs to add the user to a group or create user-specific paths.
Using flake inputs in services: Some services reference inputs.xremap-flake.packages.* (xremap.nix). Declare inputs in the module's argument list and it arrives via specialArgs. Note: inputs.rose-pine-hyprcursor is used in nixosModules/shared/stylix.nix, not in any file under services/.
Adding a new service module
See skills/new-nixos-module.md.