Skip to content

Commit 7a219b6

Browse files
committed
feat: foundry.nix.
1 parent 85485d6 commit 7a219b6

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

flake.nix

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
# celestia-app
2828
celestia-app = import ./celestia-app.nix { inherit pkgs; };
29+
30+
# foundry
31+
foundry = import ./foundry.nix { inherit pkgs; };
2932

3033
# Specific version of toolchain
3134
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
@@ -65,6 +68,7 @@
6568
testingDependencies = with pkgs; [
6669
celestia-node
6770
celestia-app
71+
foundry
6872
]
6973
++ buildDependencies;
7074

foundry.nix

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
description = "A flake for Foundry setup";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; // Adjust as per your requirements
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils, ... }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
config = {
15+
allowUnfree = true;
16+
};
17+
};
18+
in
19+
{
20+
packages.foundry = pkgs.stdenv.mkDerivation {
21+
pname = "foundry";
22+
version = "latest";
23+
24+
# Note: In a real Nix build, you wouldn't be able to fetch from the internet like this.
25+
# This script is for illustrative purposes and would be run post-build or would need to be adapted.
26+
buildCommand = ''
27+
mkdir -p $out/bin
28+
echo "#!${pkgs.stdenv.shell}" > $out/bin/install-foundry
29+
echo "curl -L https://foundry.paradigm.xyz | bash" >> $out/bin/install-foundry
30+
echo "foundryup" >> $out/bin/install-foundry
31+
chmod +x $out/bin/install-foundry
32+
'';
33+
34+
meta = with pkgs.lib; {
35+
description = "Setup script for Foundry, a smart contract development toolchain";
36+
homepage = "https://github.com/foundry-rs/foundry";
37+
license = licenses.mit;
38+
maintainers = with maintainers; [ maintainers.example ];
39+
};
40+
};
41+
42+
apps.foundry = flake-utils.lib.mkApp {
43+
drv = self.packages.${system}.foundry;
44+
};
45+
46+
defaultPackage = self.packages.${system}.foundry;
47+
});
48+
}

0 commit comments

Comments
 (0)