agentleFS
bolivian-perubolivian-peru/os-moda/skills/drift-detection/SKILL.md

drift-detection

Skill118 starsChanged 6 months agoApache-2.0View on GitHub

Detect configuration drift — manual changes that exist outside NixOS management. Offer to bring imperative changes into declarative config.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If packages found: offer to add them to environment.systemPackages in NixOS config.

    line 27

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Configuration Drift Detection

NixOS is declarative — the config should be the single source of truth. But reality drifts: manual edits, imperative installs, ad-hoc cron jobs. Detect and reconcile.

Checks

1. Imperatively installed packages

shell_exec({ command: "nix-env -q 2>/dev/null || echo 'none'" })

If packages found: offer to add them to environment.systemPackages in NixOS config.

2. Manual files outside NixOS

shell_exec({ command: "find /etc -newer /etc/NIXOS -not -path '/etc/nixos/*' -not -path '/etc/resolv.conf' -type f 2>/dev/null | head -20" })

Files modified after last NixOS rebuild may be manual edits.

3. Manual cron jobs

shell_exec({ command: "ls /etc/cron.d/ /var/spool/cron/crontabs/ 2>/dev/null" })

Offer to convert to systemd timers in NixOS config.

4. Stale NixOS generations

shell_exec({ command: "nixos-rebuild list-generations 2>/dev/null | wc -l" })

More than 20 generations → suggest cleanup.

5. Orphaned systemd units

shell_exec({ command: "systemctl list-units --state=failed --no-pager" })

Remediation

For each drift finding, offer to bring it into NixOS:

Drift Report:

⚠️ 3 packages installed via nix-env: htop, ncdu, tree
   → Add to environment.systemPackages? [Y/n]

⚠️ /etc/cron.d/backup exists outside NixOS
   → Convert to systemd timer in NixOS config? [Y/n]

⚠️ 47 old NixOS generations (using 18GB)
   → Keep current + last 5, remove rest? [Y/n]

✅ No unauthorized file changes in /etc/nixos/
✅ All systemd services match NixOS config

Why This Matters

On Ubuntu, configuration drift is invisible and irreversible. On NixOS with osModa, you can:

  1. Detect that something was changed manually
  2. Reconcile by adding it to the declarative config
  3. Prove with the audit ledger that nothing unauthorized happened
  4. Reproduce the exact system state on new hardware

This is useful supporting evidence for compliance programs (SOC 2, etc.) — though not by itself proof of regulatory readiness.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.