本文へ移動
cccskills
無料GitHub で公開

rust

Package a Rust crate for corepkgs. Use when writing or editing a buildRustPackage derivation — covers cargoHash, cargoBuildFlags, checkFlags, shell completions, and cross-compilation.

日本語の概要は準備中です。原文の説明を表示しています。

ekala-project/corepkgsスター 94(GitHub 94 + cccskills 0)

実行スコア 未検証

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Rust Packages

Rust packages live in pkgs/<name>/default.nix using rustPlatform.buildRustPackage.

Minimal Example

{
  lib,
  rustPlatform,
  fetchFromGitHub,
}:

rustPlatform.buildRustPackage (finalAttrs: {
  pname = "example";
  version = "1.0.0";

  src = fetchFromGitHub {
    owner = "example";
    repo = "example";
    tag = "v${finalAttrs.version}";
    hash = "sha256-...";
  };

  cargoHash = "sha256-...";

  meta = {
    description = "Example Rust tool";
    license = lib.licenses.mit;
    mainProgram = "example";
  };
})

Essential Attributes

  • cargoHash — SRI hash of vendored Cargo dependencies. Set to lib.fakeHash to get the correct value from the build error.
  • cargoBuildFlags — extra flags passed to cargo build (e.g., [ "--package" "foo" "--bin" "foo" ] for workspaces)
  • cargoTestFlags — extra flags passed to cargo test
  • checkFlags — flags appended to the test command. Use --skip to disable specific tests:
    checkFlags = [
      "--skip=tests::network_test"
      "--skip=tests::flaky_timing"
    ];
    

Auto-Generated Tests

buildRustPackage automatically provides passthru.tests.build — a variant that re-runs with doCheck = true. User-supplied passthru.tests entries merge alongside it.

Native Dependencies

Rust crates that link C libraries need explicit inputs:

nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl zlib ];

Shell Completions

nativeBuildInputs = [ installShellFiles ];

postInstall = ''
  installShellCompletion --cmd example \
    --bash <($out/bin/example completions bash) \
    --fish <($out/bin/example completions fish) \
    --zsh <($out/bin/example completions zsh)
'';

Guard with build platform check when cross-compiling:

postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
  installShellCompletion ...
'';

Complete Example

{
  lib,
  rustPlatform,
  fetchFromGitHub,
  pkg-config,
  erlang,
  git,
}:

rustPlatform.buildRustPackage (finalAttrs: {
  pname = "gleam";
  version = "1.18.1";

  src = fetchFromGitHub {
    owner = "gleam-lang";
    repo = "gleam";
    tag = "v${finalAttrs.version}";
    hash = "sha256-...";
  };

  cargoHash = "sha256-...";

  nativeBuildInputs = [ pkg-config erlang ];
  nativeCheckInputs = [ git ];

  checkFlags = [
    "--skip=tests::all_files_have_copyright_notice"
    "--skip=tests::echo::"
  ];

  meta = {
    description = "Statically typed language for the Erlang VM";
    homepage = "https://gleam.run/";
    license = lib.licenses.asl20;
    mainProgram = "gleam";
  };
})

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Review a package expression for best-practices compliance. Use when reviewing PRs or auditing existing packages — checks meta completeness, build-system idioms (cmakeEntries, mesonEntries, pyproject), dependency placement, and packaging conventions.

日本語の概要は準備中です。原文の説明を表示しています。

ekala-project/corepkgs942026年10月26日 更新

cmake

無料

Package a CMake-based project for corepkgs. Use when a source tree has a CMakeLists.txt — covers the minimal derivation, cmakeEntries, cross-compilation, and diagnosing CMake configure failures.

日本語の概要は準備中です。原文の説明を表示しています。

ekala-project/corepkgs942026年10月26日 更新

Fix all broken package builds in the repository. Runs a full build of ci/packages.nix in the background while iterating on failures in the foreground until everything builds.

日本語の概要は準備中です。原文の説明を表示しています。

ekala-project/corepkgs942026年10月26日 更新

go

無料

Package a Go module for corepkgs. Use when writing or editing a buildGoModule derivation — covers vendorHash, ldflags, subPackages, tags, env.CGO_ENABLED, proxyVendor, shell completions, and pinning a Go version.

日本語の概要は準備中です。原文の説明を表示しています。

ekala-project/corepkgs942026年10月26日 更新

meson

無料

Package a Meson/Ninja project for corepkgs. Use when a source tree has a meson.build — covers mesonFlags, auto features, cross-compilation, and diagnosing Meson setup failures.

日本語の概要は準備中です。原文の説明を表示しています。

ekala-project/corepkgs942026年10月26日 更新

Work with multi-version packages under pkgs-many (guile, go, erlang, perl, openssl, ...). Use when adding or changing a package that ships several versions side by side — covers the default.nix/variants.nix/generic.nix three-file pattern, the packageOlder/packageAtLeast version helpers, and mkVariantPassthru.

日本語の概要は準備中です。原文の説明を表示しています。

ekala-project/corepkgs942026年10月26日 更新

ekala-project のスキルをすべて見る

このスキルの問題を報告する