Initializes Nix flake.nix files for projects using flake-parts, automatically detecting programming languages (OpenSCAD, Python) and configuring appropriate development shells...
Automatically create and configure flake.nix files for projects that don't have them yet, using flake-parts as the base template. The skill detects programming languages used in the project and extends the default devShell with necessary development packages.
Detection criteria:
*.scad files in the project.scadDevShell packages:
openscad-unstable - Latest OpenSCAD versionDetection criteria:
*.py files in the projectrequirements.txt, pyproject.toml, or setup.pyDevShell packages:
requirements.txt exists: Parse it and create python3.withPackages including all modulespython3Python module extraction:
requirements.txt line by line==7.4.2)Use this base template for all flakes:
{
description = "PROJECT_DESCRIPTION";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
devShells.default = pkgs.mkShell {
name = "default-dev-shell";
meta.description = "Default development shell";
packages = with pkgs; [
LANGUAGE_SPECIFIC_PACKAGES
];
};
};
};
}
flake.nix already exists**/*.scad for OpenSCAD**/*.py for Pythonrequirements.txt for Python dependenciespyproject.toml, setup.py for Python projectsBased on detected languages, construct the packages list:
For OpenSCAD:
openscad-unstable
For Python with requirements.txt:
(python3.withPackages (ps: with ps; [ module1 module2 module3 ]))
For Python without requirements:
python3
.envrc for direnv integration with content: use flake.envrc uses Unix line endings (LF, \n) NOT DOS line endings (CRLF, \r\n)use flake\n (with Unix newline).gitignore to include .direnv/ if not already present.gitignore doesn't exist, create it with .direnv/ entrydirenv allow to activatenix flake check:git add flake.nixgit add .envrcgit add .gitignore (if modified or created)nix flake checkgit add flake.lock after first nix flake updateDetected files:
wifi-card.scad, qrcode-matrix.scadrequirements.txt with qrcode==7.4.2Generated packages:
packages = with pkgs; [
openscad-unstable
(python3.withPackages (ps: with ps; [ qrcode ]))
];
Detected files:
main.py, utils.pyrequirements.txt with requests==2.31.0 and flask==3.0.0Generated packages:
packages = with pkgs; [
(python3.withPackages (ps: with ps; [ requests flask ]))
];
Detected files:
model.scad, parts/base.scadGenerated packages:
packages = with pkgs; [
openscad-unstable
];
System Architecture: Default template uses x86_64-linux. Ask user if they need other systems (e.g., aarch64-linux, x86_64-darwin, aarch64-darwin)
nixpkgs Version: Default uses nixos-25.11. User can modify this to nixos-unstable or other channels if needed
Python Package Name Conversion: Most Python packages have the same name in nixpkgs, but some differ:
pillow (PyPI) → pillow (nixpkgs) ✓beautifulsoup4 (PyPI) → beautifulsoup4 (nixpkgs) ✓buildPythonPackagePost-Creation Steps: Always inform the user to:
git add if in a Git reponix flake check to verify the flake configurationnix flake update to generate flake.lockdirenv allow to activate direnv (or use nix develop manually).envrc and .gitignore updates are handled automaticallyGit Integration: Automatically stage files if in a git repo:
flake.nix.envrc.gitignore (if modified/created)flake.lock after generationLine Endings: Always use Unix line endings (LF) for all generated files, especially .envrc. DOS line endings (CRLF) can cause issues with direnv and shell scripts on Unix systems.
python3.withPackages with an empty list of packages.x86_64-linux, ask which systems they needThe skill is designed to be easily extended with additional languages:
Cargo.toml, add cargo, rustcpackage.json, add nodejs, nodePackages.npmgo.mod, add gopom.xml or build.gradle, add JDKTo extend, add new detection criteria and package mappings following the existing pattern.