一键导入
create-rust-derivation
Create a new Rust derivation from a GitHub URL. Use when the user wants to add a new Rust package to their nix derivations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new Rust derivation from a GitHub URL. Use when the user wants to add a new Rust package to their nix derivations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Help author, validate, and edit mori/cookbook.dhall cookbook extension catalogs. Covers entry fields, content types, topics, imports, and validation rules. TRIGGER when: user wants to create, edit, or validate their mori/cookbook.dhall config.
Bootstrap a complete corpus project from a repo name — initializes git, adds upstream subtrees, writes mori.dhall and Justfile, validates, registers, and optionally sets up cookbook and documentation entries. TRIGGER when: user wants to create a corpus project, wrap upstream repos as subtrees, or set up a third-party code reading workspace.
Help author, validate, and edit mori.dhall project configuration files. Covers project identity, packages, dependencies, repositories, documentation, skills, and subagents. TRIGGER when: user wants to create, edit, or understand their mori.dhall config.
Create, implement, discuss, or update execution plans (ExecPlans) — self-contained design documents that guide a coding agent or novice through delivering a working feature or system change. Use when planning significant work, implementing from a plan, or recording design decisions. TRIGGER when: user wants to plan a feature, follow a plan, or manage ExecPlan documents.
Create and manage master plans that decompose large initiatives into multiple coordinated ExecPlans with dependencies and integration points. TRIGGER when: user wants to plan a large initiative, coordinate multiple exec-plans, or track multi-plan progress.
Create a new Bun/TypeScript derivation using bun2nix from a GitHub URL. Use when the user wants to package a JavaScript/TypeScript npm package as a Nix derivation.
| name | create-rust-derivation |
| description | Create a new Rust derivation from a GitHub URL. Use when the user wants to add a new Rust package to their nix derivations. |
Create a new Rust derivation from: $ARGUMENTS
Parse the GitHub URL: Extract the owner and repo name from the provided GitHub URL (e.g., https://github.com/owner/repo).
Fetch repo information: Use gh repo view owner/repo --json description,licenseInfo,latestRelease,name to get:
Inspect Cargo.toml: Fetch the Cargo.toml from the repo's default branch to determine:
gh api repos/<owner>/<repo>/contents/Cargo.toml --jq '.content' | base64 -d
Create the derivation file: Create derivations/<pname>.nix using the standard template:
{ lib
, rustPlatform
, fetchFromGitHub
}:
rustPlatform.buildRustPackage rec {
pname = "<package-name>";
version = "<version>";
src = fetchFromGitHub {
owner = "<owner>";
repo = "<repo>";
rev = "v${version}";
hash = "<source-hash>";
};
cargoHash = "<cargo-hash>";
doCheck = false;
meta = with lib; {
description = "<description>";
homepage = "https://github.com/<owner>/<repo>";
license = with licenses; [ <license> ];
maintainers = with maintainers; [ ];
platforms = platforms.unix;
mainProgram = "<binary-name>";
};
}
Notes on the template:
rev may be "v${version}" or version depending on the repo's tag convention. Check the repo's tags to determine this.nativeBuildInputs, buildInputs, or env only if needed (e.g., for openssl, pkg-config, darwin SDKs).doCheck = false; by default (tests often fail in the nix sandbox).Get the source hash:
nix-prefetch-url --unpack "https://github.com/<owner>/<repo>/archive/refs/tags/<rev>.tar.gz"
Then convert to SRI format:
nix hash to-sri --type sha256 <hash>
Update the hash in fetchFromGitHub with the SRI hash.
Set cargoHash to placeholder: Set cargoHash = lib.fakeHash; to trigger nix to compute the correct hash.
Build to get cargoHash:
nix build --impure --expr 'let pkgs = import <nixpkgs> {}; in pkgs.callPackage ./derivations/<pname>.nix {}' 2>&1 | grep -A2 "got:"
Extract the correct cargoHash from the error output.
Update cargoHash: Replace lib.fakeHash with the actual cargoHash from the build output.
Verify the build:
nix build --impure --expr 'let pkgs = import <nixpkgs> {}; in pkgs.callPackage ./derivations/<pname>.nix {}'
Ensure the build completes successfully. If it fails due to missing dependencies (e.g., openssl, pkg-config), add the appropriate nativeBuildInputs/buildInputs and rebuild.
Add to flake.nix: Add the new package to the my-packages overlay in flake.nix:
<pname> = final.callPackage (self + "/derivations/<pname>.nix") { };
Also expose it in the flake packages output if the other derivations are exposed there.
Summary: Report what was created (package name, version, file path) and remind to run darwin-rebuild switch --flake . to apply changes.
rustPlatform.buildRustPackage with cargoHashsha256-...)v (e.g., v1.0.0 vs 1.0.0)rev and set version to a date or commit-based stringmit, asl20 for Apache-2.0, gpl3Only, etc.)