Files
ngit-grasp/flake.nix
DanConwayDev 149a6af5eb fix: only run unit tests during Nix build, skip integration tests
Changed from selectively skipping test modules to running only --lib
tests (unit tests). This is cleaner and more maintainable.

Integration tests (tests/*.rs) require:
- git binary in PATH
- Ability to spawn subprocesses
- Network access for some tests
- TestRelay fixture (spawns ngit-grasp)

These requirements don't work in the Nix sandbox, so we run only
unit tests (--lib) during package build. Full integration test suite
runs in environments where git is available:
- Local dev (nix develop includes git)
- CI/CD (git installed)
- Manual testing (cargo test runs all tests)
2026-01-11 16:05:06 +00:00

65 lines
2.1 KiB
Nix

{
description = "ngit-grasp - A GRASP implementation in Rust";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
(flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" ];
};
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ rustToolchain pkg-config openssl git ];
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
shellHook = ''
echo "🚀 ngit-grasp development environment"
echo "Rust version: $(rustc --version)"
echo ""
echo "Quick commands:"
echo " cargo build - Build the project"
echo " cargo test - Run unit tests"
echo " cargo run - Run the relay"
echo ""
'';
};
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "ngit-grasp";
version = "0.1.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"nostr-0.44.1" =
"sha256-DwcWmwxNUQRR32E3hqbm7PNkGdK8LB3sGtH1Zfrkigk=";
};
};
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl ];
# Skip all integration tests during Nix build (require git in PATH)
# Integration tests run in dev environment and CI where git is available
doCheck = true;
cargoTestFlags =
[ "--lib" ]; # Only run unit tests, skip integration tests
};
})) // {
# NixOS module for deployment
nixosModules.default = import ./nix/module.nix;
nixosModules.ngit-grasp = self.nixosModules.default;
};
}