Skip to content

Commit 4a525b6

Browse files
committed
Refactor flake.nix to streamline package imports and improve environment configuration
1 parent 66a96c4 commit 4a525b6

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

flake.nix

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,36 @@
2222
system:
2323
let
2424
pkgs = import nixpkgs { inherit system; };
25-
inherit (pkgs) lib nixfmt-tree;
25+
inherit (pkgs)
26+
lib
27+
nixfmt-tree
28+
rustPlatform
29+
llvmPackages_18
30+
mkShell
31+
rust-analyzer
32+
cargo-watch
33+
;
2634
bpkgs = b.packages.${system};
2735
inherit (bpkgs) rizin;
2836

2937
env = {
3038
RIZIN_DIR = "${rizin}";
31-
LIBCLANG_PATH = "${pkgs.llvmPackages_18.libclang.lib}/lib";
39+
LIBCLANG_PATH = "${llvmPackages_18.libclang.lib}/lib";
3240
};
3341

34-
rizin-rs = pkgs.rustPlatform.buildRustPackage (
42+
rizin-rs = rustPlatform.buildRustPackage (
3543
env
3644
// rec {
3745
pname = "rizin-rs";
3846
version = "0.9.0";
3947
src = ./.;
4048

41-
cargoLock.lockFile = ./Cargo.lock;
42-
43-
cargoHash = "";
49+
cargoHash = "sha256-ELLaVzhO10+ZNQRud92Q/WF3vi8RGhycw3OKPMwhGGs=";
4450

51+
nativeBuildInputs = [ rustPlatform.bindgenHook ];
4552
buildInputs = [
4653
rizin
47-
pkgs.llvmPackages_18.libclang
54+
llvmPackages_18.libclang
4855
];
4956

5057
doCheck = false;
@@ -64,20 +71,20 @@
6471
};
6572

6673
devShells = {
67-
default = pkgs.mkShell (
74+
default = mkShell (
6875
env
6976
// {
7077
inputsFrom = [
7178
self.packages.${system}.default
7279
];
7380
packages = [
74-
pkgs.rust-analyzer
75-
pkgs.cargo-watch
81+
rust-analyzer
82+
cargo-watch
7683
];
7784
shellHook = ''
7885
echo "🦀 Rust dev shell ready. Try: cargo run"
7986
'';
80-
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
87+
RUST_SRC_PATH = "${rustPlatform.rustLibSrc}";
8188
}
8289
);
8390
};

0 commit comments

Comments
 (0)