create-nix-package

Create Nix package derivations from code, scripts, or binary sources.

8|1|Updated Oct 21, 2015
One-click install
npx skills add https://github.com/iamruinous/nix-config --skill create-nix-package
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-nix-package
Source: https://github.com/iamruinous/nix-config/tree/main/.opencode/skills/create-nix-package
Command: npx skills add https://github.com/iamruinous/nix-config --skill create-nix-package

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Packaging software into reproducible Nix derivations can be tedious when sources come from GitHub, git repos, URLs, or local directories. This skill standardizes and automates the creation of Nix packages from diverse sources and build systems, reducing boilerplate and errors.

Core Features & Use Cases

  • Source-agnostic packaging: fetch sources from GitHub, git repositories, direct URLs, or local directories.
  • Language-aware templates: buildGoModule, buildRustPackage, buildPythonPackage, and stdenv.mkDerivation for shell and binary packages.
  • End-to-end packaging: from source fetch to a derivation under packages/<package-name> with version metadata and reproducible results.
  • Use Case: package a Go project from GitHub into a shareable Nix package for multi-platform deployments.

Quick Start

Create a package named myapp from GitHub using the Go module template.

Frequently Asked Questions about create-nix-package

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

FAQPage Schema
How do I create a Nix package from a GitHub repository?

You can package a GitHub repository by using the fetchFromGitHub utility, which obtains the source code and applies language-specific build templates like buildGoModule to output a reproducible Nix derivation under packages/<name>.

Can I build Rust and Go projects into Nix derivations automatically?

Yes, you can build Rust and Go projects automatically by using language-aware templates like buildRustPackage and buildGoModule, which generate reproducible Nix derivations from your source code while reducing manual boilerplate.

What sources are supported for generating Nix derivations?

Supported sources for generating Nix derivations include GitHub repositories, generic git repositories, direct URLs, and local directories. The skill uses fetchFromGitHub, fetchgit, and fetchurl to retrieve and package these diverse source types.

Does this packaging approach work for shell scripts and Python modules?

Yes, this packaging approach works for shell scripts and Python modules by utilizing stdenv.mkDerivation for shell and binary packages, and buildPythonPackage for Python projects, ensuring reproducible builds across different environments.

Why use automated Nix packaging instead of writing derivations manually?

Automated Nix packaging standardizes the creation of derivations from diverse sources and build systems, reducing the boilerplate and errors commonly associated with manually writing Nix derivations for various language ecosystems.

Do I need to specify the build system when packaging local source code?

When packaging local source code, the skill applies the appropriate language-specific build template such as buildGoModule or stdenv.mkDerivation based on the project type, ensuring the correct build workflow is used for your code or scripts.