rules_nim

Nim rules for Bazel

Active Pure Nim score 66/100 · last commit 2026-09-04 · 6 stars · tests present · no docs generated

Summary

Latest Version Unknown
License Apache-2.0
CI Status Failing
Stars 6
Forks 1
Open Issues 7
Last Commit 2026-09-04
Downloads 0
Last Indexed 2026-09-07 06:07

Installation

nimble install rules_nim
choosenim install rules_nim
git clone https://github.com/kczulko/rules_nim

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
rules_nim - - - - - - -

Source

Repository https://github.com/kczulko/rules_nim
Homepage https://github.com/kczulko/rules_nim
Registry Source github

README

Nim rules for Bazel

CI

linux_amd64 linux_arm64 linux_armv7l osx_aarch64 osx_amd64

Installation

rules_nim has not been yet published to BCR. Please add following git_override to your MODULE.bazel:

bazel_dep(name = "rules_nim")

git_override(
    module_name = "rules_nim",
    remote = "https://github.com/kczulko/rules_nim",
    commit = PUT_SPECIFIC_COMMIT_HERE,
)

# Nim toolchain registration - choose one of supported Nim versions.
nim = use_extension("@rules_nim//nim:extensions.bzl", "nim")
nim.toolchain(nim_version = "2.2.0")
use_repo(nim, "nim_toolchains")
register_toolchains("@nim_toolchains//:all")

Public API

Rules

Repository rules

  • nimble_lock - Gets dependencies from nimble.lock (native Bazel repository cache support).
  • nimble_install - Gets dependencies through running nimble executable (no caching).

Usage examples

Check the e2e examples directory: - nimble - Shows the usage of rules_nim for a nimble project. - numericalnim - Shows the usage of rules_nim for a numericalnim project. - nim_cc_binary - Simple example of nim_cc_binary usage. - nim_cc_library - Simple example of nim_cc_library usage. - nim_cc_test - Simple example of nim_cc_test usage. - c_invocation - Shows the backend C invocation in Nim. - nim_invocation_from_c - Shows the Nim invocation from C. - cross compilation - Shows cross-compilation example for aarch64 target platform.

Hermeticity

nim compiler tends to fully resolve symbolic links which may lead to a non-hermetic issues for a Bazel build definitions. To prevent such situations, it is highly recommended to enable --experimental_use_hermetic_linux_sandbox flag for a local build executions. See nimble e2e and its .bazelrc as the example.