Skip to content

Commit 0c9cf29

Browse files
committed
fix: try fhuser.
1 parent 1ba02cc commit 0c9cf29

File tree

2 files changed

+63
-54
lines changed

2 files changed

+63
-54
lines changed

celestia-node.nix

+62-53
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,67 @@
11
{ pkgs }:
22

3-
pkgs.stdenv.mkDerivation rec {
4-
name = "celestia-node";
5-
version = "v0.13.2"; # Update to the desired version
6-
commit_hash = "c1b41b0973e9d140b7651295e879d27ad47f42c4";
7-
8-
src = builtins.fetchGit {
9-
url = "https://github.com/celestiaorg/celestia-node.git";
10-
ref = version;
11-
rev = commit_hash;
3+
let
4+
celestiaBuild = pkgs.buildFHSUserEnv {
5+
name = "celestia-node-env";
6+
targetPkgs = pkgs: (with pkgs; [
7+
git
8+
go
9+
gnumake
10+
gcc
11+
protobuf
12+
clang
13+
llvm
14+
openssl
15+
rustc
16+
cargo
17+
coreutils
18+
# Add any other dependencies or libraries needed
19+
]);
20+
21+
runScript = "bash";
22+
profile = ''
23+
export HOME=${pkgs.stdenv.buildPackages.coreutils}/bin
24+
export GOPATH="$HOME/go"
25+
export GOCACHE="$HOME/go-cache"
26+
mkdir -p $GOPATH $GOCACHE
27+
'';
28+
29+
multiBuild = true; # This option is crucial for executing multiple build commands
30+
31+
buildInputs = [
32+
pkgs.makeWrapper
33+
];
34+
35+
builder = ''
36+
source $stdenv/setup
37+
38+
wrapProgram $out/bin/bash \
39+
--set HOME $HOME \
40+
--set GOPATH $GOPATH \
41+
--set GOCACHE $GOCACHE
42+
43+
echo "Running the Celestia Node build environment..."
44+
$out/bin/bash -c ''
45+
source ${profile}
46+
47+
cd ${celestia-src}
48+
patchShebangs .
49+
50+
make build && make install
51+
make cel-key && make install-key
52+
53+
mkdir -p $out/bin
54+
cp $GOPATH/bin/celestia $out/bin
55+
cp $GOPATH/bin/cel-key $out/bin
56+
''
57+
'';
1258
};
1359

14-
nativeBuildInputs = with pkgs; [
15-
git
16-
go
17-
gnumake
18-
gcc
19-
protobuf
20-
clang
21-
llvm
22-
openssl
23-
rustc
24-
cargo
25-
coreutils
26-
];
27-
28-
preBuild = ''
29-
export HOME=$TMPDIR
30-
export GOPATH="$TMPDIR/go"
31-
export GOCACHE="$TMPDIR/go-cache"
32-
mkdir -p $GOPATH $GOCACHE
33-
patchShebangs .
34-
'';
35-
36-
buildPhase = ''
37-
export HOME=$TMPDIR
38-
export GOPATH="$TMPDIR/go"
39-
export GOCACHE="$TMPDIR/go-cache"
40-
mkdir -p $GOPATH $GOCACHE
41-
make build && make install
42-
make cel-key && make install-key
43-
'';
44-
45-
installPhase = ''
46-
mkdir -p $out/bin
47-
cp $GOPATH/bin/celestia $out/bin
48-
cp $GOPATH/bin/cel-key $out/bin
49-
'';
50-
51-
52-
meta = with pkgs.lib; {
53-
description = "Celestia Node";
54-
homepage = "https://github.com/celestiaorg/celestia-node";
55-
license = licenses.mit;
56-
maintainers = with maintainers; [ ]; # Add maintainers here
60+
celestia-src = pkgs.fetchFromGitHub {
61+
owner = "celestiaorg";
62+
repo = "celestia-node";
63+
rev = "c1b41b0973e9d140b7651295e879d27ad47f42c4";
64+
sha256 = "0x123..."; # You need to replace this with the correct hash
5765
};
58-
}
66+
in
67+
celestiaBuild

flake.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
frameworks = pkgs.darwin.apple_sdk.frameworks;
2323

24-
# Include avalanche network runner and avalanchego
24+
# celesita-node
2525
celestia-node = import ./celestia-node.nix { inherit pkgs; };
2626

2727
# Specific version of toolchain

0 commit comments

Comments
 (0)