Nix Ecosystem

Configure Nix flakes and Home Manager for reproducible system environments.

Updated Mar 15, 2025
One-click install
npx skills add https://github.com/yasushiasahi/nix-config --skill nix-ecosystem-yasushiasahi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Nix Ecosystem
Source: https://github.com/yasushiasahi/nix-config/tree/main/home-manager/agent-skills/skills/nix-ecosystem
Command: npx skills add https://github.com/yasushiasahi/nix-config --skill nix-ecosystem-yasushiasahi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and patterns for working with the Nix package manager, its advanced features like flakes, and the Home Manager configuration tool, enabling users to build reproducible and declarative system configurations.

Core Features & Use Cases

  • Nix Language Fundamentals: Understand core concepts like lazy evaluation, pure functions, and attribute sets.
  • Nix Patterns: Learn idiomatic ways to structure Nix expressions, use overlays, and define derivations with mkDerivation.
  • Flakes: Master the structure of flake.nix, define outputs for packages, dev shells, and modules, and manage inputs effectively.
  • Home Manager: Configure user environments declaratively, manage dotfiles, and integrate with NixOS.
  • Use Case: A developer needs to set up a consistent development environment across multiple machines for a project using Nix flakes and Home Manager. This skill provides the necessary patterns and examples to achieve this.

Quick Start

Show me an example of a Nix flake that defines a development shell with Node.js and Git.

Frequently Asked Questions about Nix Ecosystem

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define a development shell with specific packages using Nix flakes?

You define a development shell in Nix flakes by specifying the required packages like Node.js and Git within the outputs attribute of your flake.nix file. This creates a reproducible, declarative environment that works consistently across multiple machines.

What is the best way to manage dotfiles and user environments declaratively?

Home Manager is the best way to manage dotfiles and user environments declaratively. It integrates directly with NixOS, allowing you to define your user-level configurations and packages within your Nix expressions for reproducible environment management.

How does Nix language lazy evaluation work for reproducible builds?

Nix language lazy evaluation works by only computing values when they are explicitly demanded, using pure functions and attribute sets to ensure reproducible builds. This functional approach guarantees that package derivations remain deterministic and isolated from side effects.

Can I use Home Manager with NixOS for system and user configuration?

Yes, you can use Home Manager with NixOS to manage both system and user configuration. The integration allows you to declare your entire system environment and user dotfiles in Nix, ensuring reproducible builds across your complete setup.

When do I need to use overlays and module definitions in Nixpkgs?

You need overlays and module definitions in Nixpkgs when you want to customize or extend existing package sets and system configurations. They provide idiomatic patterns for structuring Nix expressions and injecting dependencies without altering the core nixpkgs repository.

How do I structure a flake.nix to define outputs for packages and modules?

To structure a flake.nix for packages and modules, you define the outputs function to return attribute sets containing your derivations, dev shells, and NixOS modules. Managing inputs effectively within this structure ensures reproducible builds and declarative configuration.