Agent skill
nix
Nix package manager for reproducible builds, flakes, nix-shell development environments, and declarative package management
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/nix
SKILL.md
Skill: nix
What I do
I provide reproducible, declarative package management and build systems. Every build is deterministic, isolated, and pinned to exact versions. I eliminate "works on my machine" problems by treating packages as immutable values built from pure functions.
When to use me
- Creating reproducible development environments across teams and CI.
- Managing complex dependency trees with potential version conflicts.
- Building hermetic, bit-reproducible artefacts and immutable containers.
- Pinning exact dependencies for long-term project stability.
- Running multiple versions of tools side-by-side without interference.
Core principles
- Reproducibility - Same inputs always produce identical outputs, regardless of machine state.
- Purity - Builds are hermetic; they cannot access the network or undeclared system state.
- Declarative - Configuration is expressed as pure functions in the Nix language.
- Immutability - Packages in
/nix/storeare never modified; upgrades create new versions. - Atomic Operations - Installations and upgrades succeed completely or leave the system unchanged.
Patterns & examples
Pattern: flake.nix for Go projects (Modern)
{
description = "Go project flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
packages.default = pkgs.buildGoModule {
pname = "myapp";
version = "0.1.0";
src = ./.;
vendorHash = "sha256-abc123..."; # Pin dependencies
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ go_1_21 gopls golangci-lint ];
shellHook = "echo 'Go development environment loaded'";
};
});
}
Pattern: buildGoModule with testing
pkgs.buildGoModule {
pname = "myapp";
version = "1.0.0";
src = ./.;
vendorHash = "sha256-abc...";
checkPhase = ''
go test -v ./...
'';
installPhase = ''
install -Dm755 $GOPATH/bin/myapp $out/bin/myapp
'';
}
Pattern: Docker image from Nix
pkgs.dockerTools.buildImage {
name = "myapp";
tag = "latest";
contents = [ self.packages.${system}.default ];
config.Cmd = [ "/bin/myapp" ];
}
Anti-patterns
- ❌ Impure Builds - Accessing network/system state without declaring it in inputs.
- ❌ Imperative Usage - Using
nix-env -iinstead of declarativeflake.nixorshell.nix. - ❌ Hardcoded Paths - Using
/usr/bin/instead of${pkgs.package}/bin/command. - ❌ Missing Lockfiles - Not committing
flake.lock, leading to non-deterministic builds. - ❌ Mixing Package Managers - Using
aptorbrewalongside Nix for the same dependencies.
KB Reference
~/vaults/baphled/3. Resources/Knowledge Base/AI Development System/Skills/DevOps-Operations/Nix.md
Related skills
infrastructure-as-code- Declarative patterns for system state.dependency-management- Pinning and updating software versions.docker- Creating minimal, reproducible container images.automation- Scripting reproducible workflows.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?