xiaohongshu
xiaohongshu
dotfiles-expert
Expert guidance for peterstorm's NixOS dotfiles repository using flake-parts architecture. Use this skill when working with: NixOS system configuration, home-manager user configurations, flake-parts modular architecture, role-based configuration patterns (host.mkHost, user.mkHMUser), SOPS secrets...
Full skill instructions
Expert guidance for peterstorm's NixOS dotfiles repository with flake-parts architecture.
flake.nix # Main flake with inputs and outputs via flake-parts
├── lib/ # Utility functions
│ ├── host.nix # host.mkHost - creates NixOS configurations
│ ├── user.nix # user.mkHMUser - creates home-manager configs
│ ├── sops.nix # SOPS template-based secrets API
│ └── default.nix # Exports: host, user, shell, sops
├── roles/ # NixOS system roles
│ ├── core/ # Essential system config, nix settings, sops
│ ├── efi/ # EFI bootloader
│ ├── wifi/ # Network manager
│ ├── desktop-plasma/ # KDE + xmonad
│ └── ...
├── roles/home-manager/ # User roles
│ ├── core-apps/ # Essential user packages
│ ├── window-manager/ # xmonad config
│ └── ...
├── machines/ # Hardware-specific configs
├── secrets/ # SOPS-encrypted secrets
│ ├── common/ # Shared secrets
│ ├── hosts/{hostname}/ # Host-specific secrets
│ └── users/{username}/ # User-specific secrets
└── k8s/ # Kubernetes infrastructure
├── argocd/ # GitOps app definitions
└── terraform/ # Infrastructure as code
flake.nix defines hosts via host.mkHost and users via user.mkHMUserroles list that maps to directories in roles/ or roles/home-manager/util object (containing sops helpers) is passed to all roles via extraSpecialArgs# NixOS rebuild
sudo nixos-rebuild switch --flake .#HOSTNAME
./system-apply.sh
# Home Manager
nix build .#homeManagerConfigurations.$USER.activationPackage && result/activate
./hm-apply.sh
# Testing (ALWAYS git add new files first!)
nix build .#nixosConfigurations.HOSTNAME.config.system.build.toplevel --dry-run --show-trace
nix build .#homeManagerConfigurations.USERNAME.activationPackage --dry-run --show-trace
nix flake check
# Evaluate specific config
nix eval .#nixosConfigurations.HOSTNAME.config.sops.templates --apply 'builtins.attrNames'
# In flake.nix, add to legacyPackages.nixosConfigurations:
new-host = host.mkHost {
name = "new-host";
roles = [ "core" "wifi" "efi" "desktop-plasma" ]; # Compose roles
machine = [ "new-host" ]; # References machines/new-host/default.nix
NICs = [ "wlp0s20f3" ];
kernelPackage = pkgs.linuxPackages_latest;
initrdAvailableMods = [ "xhci_pci" "nvme" ];
initrdMods = [];
kernelMods = [];
kernelPatches = [];
kernelParams = [];
users = [{
name = "username";
groups = [ "wheel" "networkmanager" "docker" ];
uid = 1000;
ssh_keys = [];
}];
cpuCores = 8;
};
Then create machines/new-host/default.nix:
{ pkgs, lib, config, ...}:
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/YOUR-UUID";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/YOUR-BOOT-UUID";
fsType = "vfat";
};
hardware.cpu.intel.updateMicrocode = true;
}
# In flake.nix, add to legacyPackages.homeManagerConfigurations:
newuser = user.mkHMUser {
roles = [ "core-apps" "window-manager/xmonad" ]; # Compose roles
username = "newuser";
};
# roles/my-new-role/default.nix (NixOS role)
{ config, pkgs, lib, util, ... }:
{
# util.sops is available for secrets
environment.systemPackages = [ pkgs.some-package ];
}
# roles/home-manager/my-role/default.nix (home-manager role)
{ config, pkgs, lib, util, ... }:
{
home.packages = [ pkgs.some-package ];
}
Roles support path nesting: "core-apps/neovim" → roles/home-manager/core-apps/neovim/default.nix
Templates prevent secrets from entering the Nix store:
{ lib, config, pkgs, util, ... }:
(util.sops.mkSecretsAndTemplatesConfig
# 1. Define secrets (references to encrypted values)
[
(util.sops.userSecret "github-token" "personal-github.yaml" "token")
(util.sops.hostSecret "api-key" "service.yaml" "api_key" { owner = "root"; })
(util.sops.commonSecret "shared-secret" "common.yaml" "key")
]
# 2. Define templates (rendered files with actual values)
[
(util.sops.envTemplate "app-env" {
GITHUB_TOKEN = "github-token";
API_KEY = "api-key";
})
(util.sops.configTemplate "app-config" ''
token = ${config.sops.placeholder."github-token"}
'')
]
# 3. Regular configuration
{
systemd.services.myservice = {
serviceConfig.EnvironmentFile = config.sops.templates."app-env".path;
};
}
) { inherit config lib; }
userSecret: secrets/users/{current-user}/filename.yamlhostSecret: secrets/hosts/{current-host}/filename.yamlcommonSecret: secrets/common/filename.yaml/run/secrets/rendered/{template-name}~/.config/sops-nix/secrets/rendered/{template-name}~/.config/sops-nix/secrets/rendered/{template-name}/var/lib/sops-nix/keys.txt~/Library/Application Support/sops/age/keys.txt# Encrypt new file
sops -e -i secrets/users/username/secret.yaml
# Edit existing
sops secrets/hosts/hostname/secret.yaml
# Update keys after adding recipient to .sops.yaml
sops updatekeys secrets/path/file.yaml
For detailed information on specific domains:
Build fails with "file not found"
git add . # Nix flakes only see git-tracked files
SOPS decryption fails
# Check key location and presence
ls -la /var/lib/sops-nix/keys.txt # Linux
ls -la "$HOME/Library/Application Support/sops/age/keys.txt" # Darwin
# Verify public key in .sops.yaml
age-keygen -y /path/to/keys.txt
# Re-encrypt with correct keys
sops updatekeys secrets/path/file.yaml
Templates show placeholders at runtime
# Restart sops-nix service (Darwin)
launchctl kickstart gui/$(id -u)/org.nix-community.home.sops-nix
# Verify templates rendered
ls -la ~/.config/sops-nix/secrets/rendered/
Nix evaluation errors
# Always use --show-trace for debugging
nix build .#nixosConfigurations.HOSTNAME.config.system.build.toplevel --dry-run --show-trace 2>&1 | less
# Test template evaluation without full build
nix eval .#nixosConfigurations.HOSTNAME.config.sops.templates.template-name.content
{ config, pkgs, lib, util, ... }: function argumentswith lib; only when using many lib functionsmkIf, mkMerge, optionalAttrs for conditional configimports = [ ... ]; to compose sub-rolesdefault.nixutil.sops helpers passed through extraSpecialArgsxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience