nix-flake-init

Generate flake.nix files with detected OpenSCAD and Python devShell packages.

20|Updated Apr 14, 2016
One-click install
npx skills add https://github.com/binarin/nixos-config --skill nix-flake-init
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nix-flake-init
Source: https://github.com/binarin/nixos-config/tree/main/files/claude-skills/nix-flake-init
Command: npx skills add https://github.com/binarin/nixos-config --skill nix-flake-init

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automatically generates a flake.nix for projects lacking one, using flake-parts, and enriches development environments by detecting languages (OpenSCAD, Python) and extending devShells with language-specific packages.

Core Features & Use Cases

  • Language detection: Scans for OpenSCAD (.scad) and Python (.py) files, and manifests like requirements.txt or pyproject.toml to decide devShell contents.
  • Flake generation: Produces a pinned, multi-system flake.nix using flake-parts, avoiding :latest pins.
  • DevShell enrichment: Adds OpenSCAD or Python packages based on detected languages.
  • Direnv integration: Optional creation of .envrc and automatic .gitignore updates.
  • Guided validation workflow: Provides steps to validate with nix flake check and relate commands.

Quick Start

Run the skill on a project missing flake.nix to generate flake.nix, then run nix flake update and nix develop (or direnv allow) to activate the development shell. Optionally commit flake.lock and enable direnv for your workflow.

Frequently Asked Questions about nix-flake-init

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

FAQPage Schema
How do I automatically generate a flake.nix for a project that doesn't have one?

This Skill automatically creates a flake.nix using flake-parts, detecting your project's languages (OpenSCAD, Python) and manifests (requirements.txt, pyproject.toml, setup.py) to populate devShell packages with pinned versions and multi-system support.

Can I use flake-parts to build a development environment with language-specific packages?

Yes. This Skill generates a flake-parts-based flake.nix that scans your repository for language files and dependency manifests, then derives and pins language-specific devShell packages automatically without requiring manual configuration.

What's the best way to set up direnv integration with Nix flakes?

This Skill optionally creates a .envrc file with Unix LF line endings and updates .gitignore, enabling direnv to automatically activate your flake-based devShell when you enter the project directory after running direnv allow.

Does Nix flake generation detect Python and OpenSCAD dependencies automatically?

Yes. This Skill scans for .py and .scad files plus manifests like requirements.txt and pyproject.toml, then automatically includes appropriate language packages in your generated flake.nix devShell without manual intervention.

How do I validate and activate a newly generated flake.nix in my workflow?

After generation, run nix flake check to validate, then nix flake update to pin dependencies in flake.lock, and finally nix develop (or direnv allow if enabled) to activate your language-aware development shell.

What happens if my project already has a flake.nix?

This Skill checks for existing flakes before generation to avoid conflicts, and provides guidance on integrating detected language packages into your existing flake workflow.