upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/grasp-audit/flake.nix
blob: c7a80ef0ba8802fc307333f51d2869d0bcf09425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
  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 toolchain
            rust-bin.stable.latest.default
            
            # Build tools
            pkg-config
            
            # Development tools
            gitlint
          ];

          buildInputs = [
            # Required dependencies
            openssl
          ];
          
          shellHook = ''
            echo "🦀 GRASP Audit development environment loaded"
            echo ""
            echo "Available commands:"
            echo "  cargo build          - Build the project"
            echo "  cargo test           - Run unit tests"
            echo "  cargo test --ignored - Run integration tests (needs relay)"
            echo "  cargo run --example simple_audit - Run example"
            echo ""
            echo "Rust version: $(rustc --version)"
            echo "Cargo version: $(cargo --version)"
            echo ""
            echo "For RUST_SRC_PATH (rust-analyzer):"
            export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
          '';
        };
        
        # Create package for the CLI binary
        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; # Tests require a running Nostr relay
        };
      });
}