From 31ed54dab458cb3c0a6472f3e508ccdc7a9b4d79 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 4 Nov 2025 06:36:04 +0000 Subject: moved to flakes --- FLAKE_MIGRATION_COMPLETE.md | 203 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 FLAKE_MIGRATION_COMPLETE.md (limited to 'FLAKE_MIGRATION_COMPLETE.md') diff --git a/FLAKE_MIGRATION_COMPLETE.md b/FLAKE_MIGRATION_COMPLETE.md new file mode 100644 index 0000000..2d2514d --- /dev/null +++ b/FLAKE_MIGRATION_COMPLETE.md @@ -0,0 +1,203 @@ +# Flake Migration Complete + +**Date:** November 4, 2025 +**Change:** Migrated from shell.nix to flake.nix + +## What Changed + +### Files Modified + +1. **Created: grasp-audit/flake.nix** + - Based on ../ngit/flake.nix + - Uses rust-overlay for Rust toolchain + - Includes devShell and package outputs + - Properly configured with dependencies + +2. **Removed: grasp-audit/shell.nix** + - Old Nix shell configuration + - Replaced by flake.nix + +3. **Updated Documentation:** + - grasp-audit/README.md + - grasp-audit/QUICK_START.md + - NEXT_SESSION_QUICKSTART.md + - SMOKE_TEST_REPORT.md + - FILES_CREATED.md + +All references to `nix-shell` changed to `nix develop`. + +## New Flake Configuration + +```nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { nixpkgs, rust-overlay, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; + manifest = pkgs.lib.importTOML ./Cargo.toml; + in with pkgs; { + devShells.default = mkShell { + nativeBuildInputs = [ + rust-bin.stable.latest.default + pkg-config + gitlint + ]; + buildInputs = [ + openssl + ]; + shellHook = '' + echo "πŸ¦€ GRASP Audit development environment loaded" + # ... helpful messages ... + export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} + ''; + }; + + packages.default = pkgs.rustPlatform.buildRustPackage { + pname = manifest.package.name; + version = manifest.package.version; + src = ./.; + cargoLock = { lockFile = ./Cargo.lock; }; + buildInputs = [ openssl ]; + nativeBuildInputs = [ pkg-config ]; + doCheck = false; + }; + }); +} +``` + +## Flake Validation + +```bash +$ cd grasp-audit && nix flake show +git+file:///persistent/dcdev/clones/ngit-grasp?dir=grasp-audit +β”œβ”€β”€β”€devShells +β”‚ β”œβ”€β”€β”€aarch64-darwin +β”‚ β”‚ └───default: omitted (use '--all-systems' to show) +β”‚ β”œβ”€β”€β”€aarch64-linux +β”‚ β”‚ └───default: omitted (use '--all-systems' to show) +β”‚ β”œβ”€β”€β”€x86_64-darwin +β”‚ β”‚ └───default: omitted (use '--all-systems' to show) +β”‚ └───x86_64-linux +β”‚ └───default: development environment 'nix-shell' +└───packages + β”œβ”€β”€β”€aarch64-darwin + β”‚ └───default: omitted (use '--all-systems' to show) + β”œβ”€β”€β”€aarch64-linux + β”‚ └───default: omitted (use '--all-systems' to show) + β”œβ”€β”€β”€x86_64-darwin + β”‚ └───default: omitted (use '--all-systems' to show) + └───x86_64-linux + └───default: package 'grasp-audit-0.1.0' +``` + +βœ… Flake is valid and provides: +- Dev shell for all major systems +- Package output for grasp-audit binary + +## Usage + +### Old Way (shell.nix) +```bash +cd grasp-audit +nix-shell +cargo build +``` + +### New Way (flake.nix) +```bash +cd grasp-audit +nix develop +cargo build +``` + +### Additional Flake Commands + +```bash +# Show flake outputs +nix flake show + +# Check flake validity +nix flake check + +# Build the package directly +nix build + +# Run without installing +nix run + +# Update flake inputs +nix flake update +``` + +## Benefits of Flakes + +1. **Reproducibility:** Locked inputs ensure consistent builds +2. **Multi-output:** Both dev shell and package in one file +3. **Standard:** Follows modern Nix best practices +4. **Composability:** Can be used as input to other flakes +5. **Better UX:** `nix develop` is clearer than `nix-shell` + +## Updated Quick Start + +```bash +# 1. Enter dev environment +cd grasp-audit +nix develop + +# 2. Build +cargo build + +# 3. Test +cargo test --lib + +# 4. Run example +cargo run --example simple_audit +``` + +## Documentation Updates + +All documentation has been updated to use `nix develop` instead of `nix-shell`: + +- βœ… grasp-audit/README.md +- βœ… grasp-audit/QUICK_START.md +- βœ… NEXT_SESSION_QUICKSTART.md +- βœ… SMOKE_TEST_REPORT.md +- βœ… FILES_CREATED.md + +## Next Steps + +The flake is ready to use. Next session can: + +1. **Enter dev environment:** + ```bash + cd grasp-audit + nix develop + ``` + +2. **Build and test:** + ```bash + cargo build + cargo test --lib + ``` + +3. **Continue with integration tests** (once relay is set up) + +## Status + +- βœ… Flake created and validated +- βœ… Documentation updated +- βœ… Old shell.nix removed +- βœ… Git tracking enabled +- 🚧 Dev environment ready (first run will download dependencies) +- 🚧 Build pending (waiting for nix develop to complete) + +--- + +**Migration Complete:** shell.nix β†’ flake.nix βœ… -- cgit v1.2.3