Install
$ agentstack add skill-shikanime-labs-skills-nix-module-bulk-edit ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Nix Module Bulk Edit
Reliable patterns for bulk-editing Nix module files in a project like devenv.
When to use
- Adding a new config line/block to many language modules
- Updating template references across many files
- Any repetitive Nix file modification across a directory
Pitfalls
1. Don't use execute_code Python scripts for bulk file writes
The sandbox can run out of disk space (OSError: [Errno 28] No space left on device). Use terminal with perl or sed instead.
2. Don't use patch tool for Nix files with complex indentation
The patch tool's fuzzy matching often fails on Nix due to subtle whitespace differences. Use terminal with perl -i -0pe for reliable multi-line replacements.
3. Always verify Nix option paths
In devenv, gitnr is config.gitnr, NOT config.integrations.gitnr. Using the wrong path causes: The option 'integrations' does not exist. Check the module's options block to confirm the exact path.
4. Verify template existence before committing
Many assumed templates don't exist. Always check:
- GitHub main:
https://api.github.com/repos/github/gitignore/contents/ - GitHub community:
https://api.github.com/repos/github/gitignore/contents/community
- GitHub global:
https://api.github.com/repos/github/gitignore/contents/Global - TopTal:
https://www.toptal.com/developers/gitignore/api/list
5. Handle multi-line blocks carefully
When removing previously-added blocks, use perl -0pe with /s flag:
perl -i -0pe 's/^\s+integrations\.gitnr\."\.gitignore"\.templates =
\[\n.*?\];\n//gms' file.nix
Workflow
- Map first: Build a complete mapping of file → template before editing
- Verify options first: Use
search.nixos.orgor the module docs to
confirm the exact NixOS option path before editing
- Prefer direct module options: If a module exposes a native option, use it
instead of raw environment.etc / tmpfiles plumbing
- Clean first: Remove any previously-added incorrect lines
- Apply: Use
terminal+perlfor bulk insertion - Verify:
grepor a module-specific check to confirm correct lines exist - Build: Run the relevant rebuild/build command to validate
Nix style
- Prefer short-hand attr syntax when it stays readable and accurate.
- Keep YAML-shaped Nix attrsets close to the final manifest shape; avoid
unnecessary wrapper layers.
- For RKE2 manifests on NixOS, prefer
services.rke2.manifestswithtarget+
content over manual environment.etc and systemd.tmpfiles.rules.
See references/rke2-manifests.md for the option shape and the RKE2 manifest pattern.
NixOS module editing notes
- Prefer
services..manifests,services..settings, or similar
native options when the module already supports generated configuration.
- Use raw filesystem staging only when the module has no native declarative
hook.
- For RKE2,
services.rke2.manifests..contentcan generate YAML directly,
and target controls the manifest filename under /var/lib/rancher/rke2/server/manifests.
- Keep generated YAML minimal and explicit; avoid extra tmpfiles indirection
when the module can write the file itself.
- For already-formatted external disks on hosts, prefer
fileSystemswith
by-label/by-uuid and nofail + x-systemd.automount; see references/external-disks-by-label.md.
- See
references/rke2-manifests.mdfor the concise option shape and the
manifest-generation pattern.
Example: Adding gitnr to language modules
# Step 1: Clean any previous attempts
for f in $(grep -rl 'integrations\.gitnr\|gitnr\.' src/modules/languages/); do
perl -i -0pe 's/^\s+integrations\.gitnr\."\.gitignore"\.templates =
\[.*?\];\n//gm' "$f"
perl -i -0pe 's/^\s+integrations\.gitnr\."\.gitignore"\.templates =
\[\n.*?\];\n//gms' "$f"
done
# Step 2: Add correct line (example for go.nix)
perl -i -pe 's/(config = lib\.mkIf cfg\.enable \{)/$1\n
gitnr.\".gitignore\".templates = [ \"gh:Go\" ];/' src/modules/languages/go.nix
# Step 3: Verify
grep -rn 'gitnr' src/modules/languages/
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: shikanime-labs
- Source: shikanime-labs/skills
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.