Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
128 lines (121 loc) · 4.78 KB
/
Copy pathflake.nix
File metadata and controls
128 lines (121 loc) · 4.78 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{
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=";
};
};
# stellar-scaffold prebuilt tarball, same version CI installs (build.yml).
scaffoldVersion = "0.0.27";
scaffoldHashes = {
x86_64-darwin = "sha256-kzM5ikay1etB1bBLtCo8jNq7jZgJstl36OkUClc2jWY=";
aarch64-darwin = "sha256-un7QXXsfi82zb0w98fOZEbHxkTGlTlQtl3ZqINWb9ic=";
x86_64-linux = "sha256-8kcJ3lfjMVXv1yVHyShrUi1DYKN5veWvnutVGTlvEMw=";
aarch64-linux = "sha256-IACcbOz+tDZl4RHTIfXOqvD+a+vptTVbBMNrcOQh82E=";
};
systems = builtins.attrNames cliAssets;
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system});
mkPrebuilt =
pkgs:
{
pname,
version,
bin,
url,
hash,
}:
pkgs.stdenvNoCC.mkDerivation {
inherit pname version;
src = pkgs.fetchurl { inherit url 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 ${bin} $out/bin/${bin}; runHook postInstall";
meta.mainProgram = bin;
};
mkStellarCli =
system: pkgs:
mkPrebuilt pkgs {
pname = "stellar-cli";
version = cliVersion;
bin = "stellar";
url = "https://github.com/stellar/stellar-cli/releases/download/v${cliVersion}/stellar-cli-${cliVersion}-${cliAssets.${system}.target}.tar.gz";
inherit (cliAssets.${system}) hash;
};
mkStellarScaffold =
system: pkgs:
mkPrebuilt pkgs {
pname = "stellar-scaffold-cli";
version = scaffoldVersion;
bin = "stellar-scaffold";
url = "https://github.com/stellar-scaffold/cli/releases/download/stellar-scaffold-cli-v${scaffoldVersion}/stellar-scaffold-cli-v${scaffoldVersion}-${cliAssets.${system}.target}.tar.gz";
hash = scaffoldHashes.${system};
};
in
{
packages = forAllSystems (
system: pkgs: {
stellar-cli = mkStellarCli system pkgs;
stellar-scaffold = mkStellarScaffold 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)
(mkStellarScaffold 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.cargo-deny # licence, advisory and source checks (deny.toml)
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 " scaffold: $(stellar-scaffold --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"
'';
};
}
);
};
}