-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
96 lines (91 loc) · 3.44 KB
/
Copy pathflake.nix
File metadata and controls
96 lines (91 loc) · 3.44 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
description = "open-rwa-vault devshell — Soroban (Rust + stellar-cli)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
};
outputs =
{ self, nixpkgs }:
let
# stellar-cli prebuilt tarball (nixpkgs has no package). Pinned to v27.0.0,
# same hashes as the sibling `stellar` repo flake.
cliVersion = "27.0.0";
cliAssets = {
x86_64-darwin = {
target = "x86_64-apple-darwin";
hash = "sha256-Em3lTANNL9LpAsYanodwS8OMIPkWsXJ+qnh7aYjwkpY=";
};
aarch64-darwin = {
target = "aarch64-apple-darwin";
hash = "sha256-cKJZ0QU0JZZWtj/nBzEW7DvaDOg4OcnHI2R1BhS+6uY=";
};
x86_64-linux = {
target = "x86_64-unknown-linux-gnu";
hash = "sha256-NXv3EvY1PCjNM8eUQCo8hyMXV6WzBebvFgQ2WvT91VY=";
};
aarch64-linux = {
target = "aarch64-unknown-linux-gnu";
hash = "sha256-o0GtzBUuGGXqYdbDMudbPYKx8vMhCBmPrJfFCHixcDQ=";
};
};
systems = builtins.attrNames cliAssets;
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system});
mkStellarCli =
system: pkgs:
let
asset = cliAssets.${system};
in
pkgs.stdenvNoCC.mkDerivation {
pname = "stellar-cli";
version = cliVersion;
src = pkgs.fetchurl {
url = "https://github.com/stellar/stellar-cli/releases/download/v${cliVersion}/stellar-cli-${cliVersion}-${asset.target}.tar.gz";
inherit (asset) hash;
};
sourceRoot = ".";
nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.autoPatchelfHook ];
buildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.stdenv.cc.cc.lib
pkgs.openssl
pkgs.zlib
];
installPhase = "runHook preInstall; install -Dm755 stellar $out/bin/stellar; runHook postInstall";
meta.mainProgram = "stellar";
};
in
{
packages = forAllSystems (
system: pkgs: {
stellar-cli = mkStellarCli system pkgs;
default = mkStellarCli system pkgs;
}
);
devShells = forAllSystems (
system: pkgs: {
default = pkgs.mkShell {
packages = [
# Soroban / Rust
pkgs.rustup # honors ./rust-toolchain.toml (stable + wasm32v1-none + rust-src)
(mkStellarCli system pkgs)
pkgs.wabt # wasm2wat / wasm-objdump
pkgs.twiggy # wasm size profiler
pkgs.cargo-nextest
pkgs.cargo-llvm-cov # line/region coverage (needs llvm-tools-preview)
pkgs.nodejs_22
# Formal methods
pkgs.tlaplus # tlc + pcal (TLA+ / PlusCal)
# Hooks
pkgs.prek # pre-commit runner (runs the cargo fmt hook)
];
shellHook = ''
rustup show >/dev/null 2>&1 || true
echo "open-rwa-vault devshell"
echo " stellar: $(stellar --version 2>/dev/null | head -1)"
echo " rust: $(rustc --version 2>/dev/null || echo '(run any cargo/rustc to trigger rustup)')"
echo " tla: $(tlc 2>&1 | head -1 | sed 's/^/ /' | xargs echo | cut -c1-60) (tlc + pcal)"
echo " loop: pcal spec/Token.tla -> tlc -config spec/Token.cfg spec/Token.tla"
'';
};
}
);
};
}