Skip to content

Commit 4f525b4

Browse files
committed
Add nix dev shell
1 parent 3e41d2c commit 4f525b4

File tree

2 files changed

+190
-0
lines changed

2 files changed

+190
-0
lines changed

flake.lock

Lines changed: 99 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
description = "rust-bitcoinkernel";
3+
4+
inputs = {
5+
nixpkgs.url = "nixpkgs/nixos-25.05";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
fenix = {
8+
url = "github:nix-community/fenix";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
};
12+
13+
outputs = { self, nixpkgs, flake-utils, fenix }:
14+
flake-utils.lib.eachDefaultSystem (system:
15+
let
16+
pkgs = import nixpkgs {
17+
inherit system;
18+
};
19+
20+
rustVersion = "1.71.0";
21+
rustToolchain = fenix.packages.${system}.fromToolchainName {
22+
name = rustVersion;
23+
sha256 = "sha256-ks0nMEGGXKrHnfv4Fku+vhQ7gx76ruv6Ij4fKZR3l78=";
24+
};
25+
rustBuildToolchain = fenix.packages.${system}.combine [
26+
rustToolchain.rustc
27+
rustToolchain.cargo
28+
rustToolchain.rust-src
29+
rustToolchain.rust-std
30+
];
31+
32+
rustToolchainNightly = fenix.packages.${system}.fromToolchainName {
33+
name = "nightly";
34+
sha256 = "sha256-x+EWymRPcdfpK3I1N+Rr3RE0ld/KmNPEJGDnyxFyByE=";
35+
};
36+
rustBuildToolchainNightly = fenix.packages.${system}.combine [
37+
rustToolchainNightly.rustc
38+
rustToolchainNightly.cargo
39+
rustToolchainNightly.rust-src
40+
rustToolchainNightly.llvm-tools
41+
rustToolchainNightly.rust-std
42+
];
43+
rustPlatformNightly = pkgs.makeRustPlatform {
44+
cargo = rustBuildToolchainNightly;
45+
rustc = rustBuildToolchainNightly;
46+
};
47+
rustfilt = rustPlatformNightly.buildRustPackage rec {
48+
pname = "rustfilt";
49+
version = "0.2.1";
50+
src = pkgs.fetchFromGitHub {
51+
owner = "luser";
52+
repo = "rustfilt";
53+
rev = version;
54+
hash = "sha256-zb1tkeWmeMq7aM8hWssS/UpvGzGbfsaVYCOKBnAKwiQ=";
55+
};
56+
cargoLock.lockFile = "${src}/Cargo.lock";
57+
};
58+
in {
59+
devShells.default = pkgs.mkShell {
60+
packages = [
61+
rustBuildToolchain
62+
63+
pkgs.cmake
64+
pkgs.boost.dev
65+
pkgs.cargo-fuzz
66+
];
67+
68+
LIBCLANG_PATH = "${pkgs.llvmPackages.clang-unwrapped.lib}/lib/";
69+
};
70+
71+
devShells.nightly = pkgs.mkShell {
72+
packages = [
73+
rustBuildToolchainNightly
74+
75+
pkgs.cmake
76+
pkgs.boost.dev
77+
pkgs.cargo-fuzz
78+
79+
pkgs.libllvm
80+
pkgs.cargo-llvm-cov
81+
rustfilt
82+
];
83+
84+
LIBCLANG_PATH = "${pkgs.llvmPackages.clang-unwrapped.lib}/lib/";
85+
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
86+
pkgs.gcc.cc.lib
87+
];
88+
};
89+
}
90+
);
91+
}

0 commit comments

Comments
 (0)