Skip to content

indexable-inc/kiln

Repository files navigation

Kiln

Kiln is a dynamic-derivations-based, vendor-free, incremental Rust build system: it compiles a Cargo workspace into one Nix derivation per rustc unit — no import-from-derivation, content-addressed outputs, per-unit incrementality — exposed as a small Nix library (buildWorkspace) alongside a toolchain reader (toolchain.fromFile) and a musl linker wrapper (linkers.clangMoldMusl).

Status: skeleton — nothing implemented. Every build-performing leaf throws kiln: not implemented: <path>; only the structural plumbing (forPkgs, eachSystem, mkApp, and the per-system surface) evaluates, so nix flake show and the shape checks pass while no real Rust/Nix build work happens yet.

Examples

A single binary.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    kiln.url  = "github:indexable-inc/kiln";
  }
  nixConfig.extra-experimental-features = [ "ca-derivations" "dynamic-derivations" ];

  outputs = { kiln, ... }:
    kiln.lib.eachSystem kiln.lib.defaultSystems (system:
      let ws = kiln.lib.${system}.buildWorkspace { src = ./.; };
      in {
        packages.default  = ws.bins.mycli;
        apps.default      = cinder.lib.mkApp ws.bins.mycli;
        devShells.default = ws.devShell;
      });
}

A workspace whose CI scales

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    kiln.url  = "github:indexable-inc/kiln";
  }
  nixConfig.extra-experimental-features = [ "ca-derivations" "dynamic-derivations" ];

  outputs = { kiln, ... }:
    kiln.lib.eachSystem kiln.lib.defaultSystems (system:
      let ws = kiln.lib.${system}.buildWorkspace { src = ./.; };
      in {
        packages = ws.bins // {
          ci      = ws.gate { };          # full required gate (main / merge queue)
          api-doc = ws.members.api.doc;   # any single facet of any crate
        };
        checks            = ws.checks;                              # per-crate clippy/test/fmt/doc
        apps.ci-affected  = ws.affected { base = "origin/main"; };  # PR-narrowed, fails closed
        devShells.default = ws.devShell;
      });
}

Core Surface

# ── entry (no flake-parts) ─────────────────────────────
kiln.lib.${system}               # the build surface for a system
kiln.lib.forPkgs pkgs            #   …or bound to your own pkgs (cross / overlays)
kiln.lib.eachSystem systems fn   # per-system fold — the assembler
kiln.lib.mkApp drv               # flake-app boilerplate

# ── the one builder ────────────────────────────────────
ws = kiln.lib.${system}.buildWorkspace {
  src            = ./.;                    # required
  toolchain      =;                      # optional — omit to read rust-toolchain.toml
  profile        = "release";              # optional — a profile from your Cargo.toml
  packages       = [];                  # optional — restrict to a subset
  target         = "x86_64-…-musl";        # optional — one triple (call twice to split)
  crateOverrides = {};                  # per-crate build-script env / native deps
  gitHashes      = {};                  # hashes for un-hashable git deps
  policy         = { clippyDriver =; };  # the one lint knob kiln can't auto-detect
  nativeBuildInputs = [];               # e.g. the musl linker wrapper
};

# ── the record: selection, checks, dev, incremental ────
ws.members.<name>   # { bin?, lib?, doc, check.{ test, clippy, fmt, doc }, tests }
ws.bins  ws.libs    # flat sets
ws.checks           # flat — what `nix flake check` consumes
ws.gate { }         # single-source required gate ( { packages = …; } narrows it )
ws.affected { base = "origin/main"; }    # affected package set + diff closure
ws.devShell         # toolchain + discovered native deps + linker

# ── toolchain ──────────────────────────────────────────
kiln.toolchain.fromFile ./rust-toolchain.toml   # → toolchain (exposes .packages)

# ── shipped ────────────────────────────────────────────
kiln.linkers.clangMoldMusl    # musl linker wrapper (mold default, runtime-switchable)

About

(WIP) elegent incremental rust builds with dynamic derivations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors