From 3be32c4dac30fe428eefc007d565fd23fddaae40 Mon Sep 17 00:00:00 2001
From: Charles Hall <charles@computer.surgery>
Date: Tue, 4 Apr 2023 17:52:15 -0700
Subject: [PATCH] factor out shared things

---
 flake.nix | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/flake.nix b/flake.nix
index 6ed12dec..5e7d2061 100644
--- a/flake.nix
+++ b/flake.nix
@@ -41,6 +41,11 @@
       ROCKSDB_INCLUDE_DIR = "${pkgs.rocksdb_6_23}/include";
       ROCKSDB_LIB_DIR = "${pkgs.rocksdb_6_23}/lib";
 
+      # Shared between the package and the devShell
+      nativeBuildInputs = (with pkgs.rustPlatform; [
+        bindgenHook
+      ]);
+
       builder =
         ((crane.mkLib pkgs).overrideToolchain toolchain.toolchain).buildPackage;
     in
@@ -51,9 +56,7 @@
         # Use system RocksDB
         inherit ROCKSDB_INCLUDE_DIR ROCKSDB_LIB_DIR;
 
-        nativeBuildInputs = (with pkgs.rustPlatform; [
-          bindgenHook
-        ]);
+        inherit nativeBuildInputs;
       };
 
       devShells.default = pkgs.mkShell {
@@ -65,9 +68,7 @@
         inherit ROCKSDB_INCLUDE_DIR ROCKSDB_LIB_DIR;
 
         # Development tools
-        nativeBuildInputs = (with pkgs.rustPlatform; [
-          bindgenHook
-        ]) ++ (with toolchain; [
+        nativeBuildInputs = nativeBuildInputs ++ (with toolchain; [
           cargo
           clippy
           rust-src