This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
flake.nix
140 lines (120 loc) Β· 4.75 KB
/
flake.nix
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
129
130
131
132
133
134
135
136
137
138
139
140
{
nixConfig = {
extra-substituters = [ "https://hydra.nixos.org" "https://nix-community.cachix.org" "https://pontem.cachix.org" ];
extra-trusted-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"pontem.cachix.org-1:IZOAswhIJQZin8qtaacVg1sdUmGSBbxeve+My8lcC2A="
];
};
inputs = {
fenix.url = github:nix-community/fenix;
utils.url = github:numtide/flake-utils;
move-tools.url = github:pontem-network/move-tools;
nixpkgs.follows = "move-tools/nixpkgs";
# nixpkgs.url = "/home/cab/data/cab/nixpkgs";
fenix.follows = "move-tools/fenix";
};
outputs = flake-args@{ self, nixpkgs, utils, fenix, move-tools, ... }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
fenixArch = fenix.packages.${system};
rustTargets = fenixArch.targets;
llvmPackagesR = pkgs.llvmPackages_12;
dove = move-tools.defaultPackage."${system}";
devToolchainV = {
channel = "nightly";
# date = "2021-09-13";
# sha256 = "sha256:1f7anbyrcv4w44k2rb6939bvsq1k82bks5q1mm5fzx92k8m9518c";
date = "2021-10-24";
sha256 = "sha256-OrzhSF+XO0pfzpfVT8EpPHeGwEmIB7va+lEeWtTjOAs=";
};
# Some strange wasm errors occur if not built with this old toolchain
buildToolchainV = {
channel = "nightly";
date = "2021-10-25";
sha256 = "sha256-vRBxIPRyCcLvh6egPKShMTmxVD1E0obq71iCM0aOWzs=";
};
buildComponents = [ "cargo" "llvm-tools-preview" "rust-std" "rustc" "rustc-dev" ];
devComponents = buildComponents ++ [ "clippy-preview" "rustfmt-preview" "rust-src" "rls-preview" ];
devToolchain = let
t = fenixArch.toolchainOf devToolchainV;
in fenixArch.combine [
(t.withComponents devComponents)
(rustTargets.wasm32-unknown-unknown.toolchainOf devToolchainV).toolchain
];
inherit (
let
buildToolchain = fenixArch.combine [
((fenixArch.toolchainOf buildToolchainV).withComponents buildComponents)
(rustTargets.wasm32-unknown-unknown.toolchainOf buildToolchainV).toolchain
];
tch = {
cargo = buildToolchain;
rustc = buildToolchain;
};
in
{
rustPlatform = pkgs.makeRustPlatform tch;
}
) naersk-lib rustPlatform;
in {
devShell =
with pkgs; mkShell {
buildInputs = [
protobuf openssl pre-commit pkgconfig
cargo-expand
llvmPackagesR.clang
dove
devToolchain
] ++ (pkgs.lib.optionals stdenv.isDarwin [
libiconv darwin.apple_sdk.frameworks.Security
]);
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
LLVM_CONFIG_PATH="${llvmPackagesR.llvm}/bin/llvm-config";
LIBCLANG_PATH="${llvmPackagesR.libclang.lib}/lib";
RUST_SRC_PATH = "${devToolchain}/lib/rustlib/src/rust/library/";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
};
# altPackage = with pkgs; rustPlatform.buildRustPackage {
# pname = "pontem-node";
# version = "0.0.1";
# src = ./.;
# cargoLock = {
# lockFile = ./Cargo.lock;
# outputHashes = {
# "bcs-0.1.1" = nixpkgs.lib.fakeSha256;
# "beefy-gadget-4.0.0-dev" = nixpkgs.lib.fakeSha256;
# "bp-header-chain-0.1.0" = nixpkgs.lib.fakeSha256;
# "cumulus-client-cli-0.1.0" = nixpkgs.lib.fakeSha256;
# };
# };
# targets = [ "pontem-node" ];
# buildInputs = [
# protobuf openssl pre-commit pkgconfig
# llvmPackagesR.clang
# dove
# ];
# PROTOC = "${protobuf}/bin/protoc";
# LLVM_CONFIG_PATH="${llvmPackagesR.llvm}/bin/llvm-config";
# LIBCLANG_PATH="${llvmPackagesR.libclang.lib}/lib";
# ROCKSDB_LIB_DIR = "${rocksdb}/lib";
# };
# defaultPackage = with pkgs; naersk-lib.buildPackage {
# name = "pontem-node";
# src = ./.;
# targets = [ "pontem-node" ];
# buildInputs = [
# protobuf openssl pre-commit pkgconfig
# llvmPackagesR.clang
# dove
# ];
# PROTOC = "${protobuf}/bin/protoc";
# LLVM_CONFIG_PATH="${llvmPackagesR.llvm}/bin/llvm-config";
# LIBCLANG_PATH="${llvmPackagesR.libclang.lib}/lib";
# ROCKSDB_LIB_DIR = "${rocksdb}/lib";
# };
});
}