Locked Nix Flake DevShell for Clean-Host Toolchain #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Provide a hermetic, project-local Nix flake and devShell that supplies pinned Rust tooling (
rustc,cargo,rustfmt,clippy,rust-analyzer,pkg-config) without relying on global host installations or ad-hoc SDKs, establishing the clean-host contract across macOS Apple Silicon and Linux deployment targets.Background & Technical Rationale
The core architectural premise of this repository is a clean-host development contract: never globally install
rustup, Node.js, Python, or application SDK tooling on developer workstations or CI environments. Global toolchain installations cause non-reproducible builds, compiler drift, and subtle cross-platform incompatibilities between macOS (aarch64-darwin) and production Linux containers (x86_64-linuxandaarch64-linux).Instead, a project-local Nix flake (
flake.nix) backed by a pinnednixpkgsrevision acts as the single source of truth for the compiler, linter, language server, and build utilities.nix developis the canonical entry point into the development environment.direnv(via.envrc) provides optional shell convenience, not a secondary or diverging toolchain source. Updates to the compiler or toolchain packages must be version-controlled, explicit lockfile changes inflake.lock.Furthermore, build caches and dependency artifacts must remain strictly separated from production runtime state, and no host virtualization or container runtime is permitted to install language toolchains globally.
Exact Technical References & Specifications
Normative Toolchain Contract
From
docs/technical/development.md#toolchain-contract:Dependency Responsibilities
From
docs/technical/development.md#dependency-responsibilities:Canonical Development Workflow
From
docs/technical/development.md#future-development-workflow:Deployment Scenario D01 Requirement
From
docs/technical/verification.md#deployment-scenarios:Formal Section Citations
docs/technical/development.md#toolchain-contract: Defines the clean-host principle, platform coverage (aarch64-darwin,x86_64-linux), and lockfile ownership.docs/technical/development.md#dependency-responsibilities: Establishes ownership boundaries for compiler and build tooling.docs/technical/development.md#future-development-workflow: Specifies the standard shell invocation commands.docs/technical/verification.md#deployment-scenarios: Formulates normative scenario D01 for environment reproducibility.What to Build (Step-by-Step)
Create
flake.nix:inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";(or a stable nixpkgs release pin).["x86_64-linux", "aarch64-linux", "aarch64-darwin"].devShells.<system>.defaultcontaining:rustccargorustfmtclippyrust-analyzerpkg-configSecurity,CoreFoundation,SystemConfigurationon Darwin;opensslor native stubs on Linux).RUST_BACKTRACE = "1",RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSource}").Generate
flake.lock:nix flake lockto lock dependencies.flake.lockto git tracking.Configure Direnv Integration (
.envrc):.envrccontaining:direnvcan automatically enter the devShell, while leavingnix developas the canonical standalone entry point.Verify Environment Isolation:
nix develop --command cargo --versionsucceeds in a clean shell without~/.cargo/binor globalrustuppresent onPATH.aarch64-darwinand Linux environments.Acceptance Criteria
nix developcreates a subshell providingcargo,rustc,clippy,rustfmt, andrust-analyzeronPATH.rustup, global Node.js, or global Python SDKs are referenced or required.flake.lockexists and is tracked in version control, locking nixpkgs revisions deterministically.cargo --versioninside the devShell matches the exact version supplied by the lockednixpkgs..envrcis provided withuse flakefor direnv users.docs/technical/verification.md: "Required tools available without global rustup/SDKs; committed lockfiles reproduce selected dependencies".Blocked by
None - can start immediately.
Issue #001: Locked Nix Flake DevShell for Clean-Host Toolchainto Locked Nix Flake DevShell for Clean-Host Toolchain