upleb.uk

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

summaryrefslogtreecommitdiff
path: root/grasp-audit
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 06:36:04 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 06:36:04 +0000
commit31ed54dab458cb3c0a6472f3e508ccdc7a9b4d79 (patch)
tree59c4a3058236a14ac639f018b13b405a9fa50d84 /grasp-audit
parent001ca45e385c05b0eaa36d9879e051853aaff107 (diff)
moved to flakes
Diffstat (limited to 'grasp-audit')
-rw-r--r--grasp-audit/QUICK_START.md4
-rw-r--r--grasp-audit/README.md3
-rw-r--r--grasp-audit/flake.lock96
-rw-r--r--grasp-audit/flake.nix66
-rw-r--r--grasp-audit/shell.nix38
5 files changed, 167 insertions, 40 deletions
diff --git a/grasp-audit/QUICK_START.md b/grasp-audit/QUICK_START.md
index 47e848e..d4ee494 100644
--- a/grasp-audit/QUICK_START.md
+++ b/grasp-audit/QUICK_START.md
@@ -11,7 +11,7 @@
11```bash 11```bash
12# Enter development shell 12# Enter development shell
13cd grasp-audit 13cd grasp-audit
14nix-shell 14nix develop
15 15
16# Build the project 16# Build the project
17cargo build 17cargo build
@@ -135,7 +135,7 @@ async fn main() -> Result<()> {
135 135
136**Solution (NixOS):** 136**Solution (NixOS):**
137```bash 137```bash
138nix-shell # Use the provided shell.nix 138nix develop # Use the provided flake.nix
139``` 139```
140 140
141**Solution (Other Linux):** 141**Solution (Other Linux):**
diff --git a/grasp-audit/README.md b/grasp-audit/README.md
index 558e201..b49ad11 100644
--- a/grasp-audit/README.md
+++ b/grasp-audit/README.md
@@ -124,6 +124,9 @@ cargo run --example simple_audit
124## Testing 124## Testing
125 125
126```bash 126```bash
127# Enter dev environment (NixOS)
128nix develop
129
127# Run unit tests 130# Run unit tests
128cargo test 131cargo test
129 132
diff --git a/grasp-audit/flake.lock b/grasp-audit/flake.lock
new file mode 100644
index 0000000..d014800
--- /dev/null
+++ b/grasp-audit/flake.lock
@@ -0,0 +1,96 @@
1{
2 "nodes": {
3 "flake-utils": {
4 "inputs": {
5 "systems": "systems"
6 },
7 "locked": {
8 "lastModified": 1731533236,
9 "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
10 "owner": "numtide",
11 "repo": "flake-utils",
12 "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
13 "type": "github"
14 },
15 "original": {
16 "owner": "numtide",
17 "repo": "flake-utils",
18 "type": "github"
19 }
20 },
21 "nixpkgs": {
22 "locked": {
23 "lastModified": 1762111121,
24 "narHash": "sha256-4vhDuZ7OZaZmKKrnDpxLZZpGIJvAeMtK6FKLJYUtAdw=",
25 "owner": "NixOS",
26 "repo": "nixpkgs",
27 "rev": "b3d51a0365f6695e7dd5cdf3e180604530ed33b4",
28 "type": "github"
29 },
30 "original": {
31 "owner": "NixOS",
32 "ref": "nixos-unstable",
33 "repo": "nixpkgs",
34 "type": "github"
35 }
36 },
37 "nixpkgs_2": {
38 "locked": {
39 "lastModified": 1744536153,
40 "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
41 "owner": "NixOS",
42 "repo": "nixpkgs",
43 "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
44 "type": "github"
45 },
46 "original": {
47 "owner": "NixOS",
48 "ref": "nixpkgs-unstable",
49 "repo": "nixpkgs",
50 "type": "github"
51 }
52 },
53 "root": {
54 "inputs": {
55 "flake-utils": "flake-utils",
56 "nixpkgs": "nixpkgs",
57 "rust-overlay": "rust-overlay"
58 }
59 },
60 "rust-overlay": {
61 "inputs": {
62 "nixpkgs": "nixpkgs_2"
63 },
64 "locked": {
65 "lastModified": 1762223900,
66 "narHash": "sha256-caxpESVH71mdrdihYvQZ9rTZPZqW0GyEG9un7MgpyRM=",
67 "owner": "oxalica",
68 "repo": "rust-overlay",
69 "rev": "cfe1598d69a42a5edb204770e71b8df77efef2c3",
70 "type": "github"
71 },
72 "original": {
73 "owner": "oxalica",
74 "repo": "rust-overlay",
75 "type": "github"
76 }
77 },
78 "systems": {
79 "locked": {
80 "lastModified": 1681028828,
81 "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
82 "owner": "nix-systems",
83 "repo": "default",
84 "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
85 "type": "github"
86 },
87 "original": {
88 "owner": "nix-systems",
89 "repo": "default",
90 "type": "github"
91 }
92 }
93 },
94 "root": "root",
95 "version": 7
96}
diff --git a/grasp-audit/flake.nix b/grasp-audit/flake.nix
new file mode 100644
index 0000000..c7a80ef
--- /dev/null
+++ b/grasp-audit/flake.nix
@@ -0,0 +1,66 @@
1{
2 inputs = {
3 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4 rust-overlay.url = "github:oxalica/rust-overlay";
5 flake-utils.url = "github:numtide/flake-utils";
6 };
7
8 outputs = { nixpkgs, rust-overlay, flake-utils, ... }:
9 flake-utils.lib.eachDefaultSystem (system:
10 let
11 overlays = [ (import rust-overlay) ];
12 pkgs = import nixpkgs { inherit system overlays; };
13 manifest = pkgs.lib.importTOML ./Cargo.toml;
14 in with pkgs; {
15 devShells.default = mkShell {
16 nativeBuildInputs = [
17 # Rust toolchain
18 rust-bin.stable.latest.default
19
20 # Build tools
21 pkg-config
22
23 # Development tools
24 gitlint
25 ];
26
27 buildInputs = [
28 # Required dependencies
29 openssl
30 ];
31
32 shellHook = ''
33 echo "🦀 GRASP Audit development environment loaded"
34 echo ""
35 echo "Available commands:"
36 echo " cargo build - Build the project"
37 echo " cargo test - Run unit tests"
38 echo " cargo test --ignored - Run integration tests (needs relay)"
39 echo " cargo run --example simple_audit - Run example"
40 echo ""
41 echo "Rust version: $(rustc --version)"
42 echo "Cargo version: $(cargo --version)"
43 echo ""
44 echo "For RUST_SRC_PATH (rust-analyzer):"
45 export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
46 '';
47 };
48
49 # Create package for the CLI binary
50 packages.default = pkgs.rustPlatform.buildRustPackage {
51 pname = manifest.package.name;
52 version = manifest.package.version;
53 src = ./.;
54 cargoLock = {
55 lockFile = ./Cargo.lock;
56 };
57 buildInputs = [
58 openssl
59 ];
60 nativeBuildInputs = [
61 pkg-config
62 ];
63 doCheck = false; # Tests require a running Nostr relay
64 };
65 });
66}
diff --git a/grasp-audit/shell.nix b/grasp-audit/shell.nix
deleted file mode 100644
index 54bb3b8..0000000
--- a/grasp-audit/shell.nix
+++ /dev/null
@@ -1,38 +0,0 @@
1{ pkgs ? import <nixpkgs> {} }:
2
3pkgs.mkShell {
4 buildInputs = with pkgs; [
5 # Rust toolchain
6 rustc
7 cargo
8 rustfmt
9 clippy
10
11 # Build dependencies
12 gcc
13 pkg-config
14
15 # Libraries
16 openssl
17
18 # Development tools
19 git
20 ];
21
22 # Environment variables
23 RUST_BACKTRACE = "1";
24 RUST_LOG = "info";
25
26 shellHook = ''
27 echo "🦀 Rust development environment loaded"
28 echo ""
29 echo "Available commands:"
30 echo " cargo build - Build the project"
31 echo " cargo test - Run unit tests"
32 echo " cargo test --ignored - Run integration tests (needs relay)"
33 echo " cargo run --example simple_audit - Run example"
34 echo ""
35 echo "Rust version: $(rustc --version)"
36 echo "Cargo version: $(cargo --version)"
37 '';
38}