From a9550e61fc5d04de1d86be826996eb2b1515628f Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Sun, 14 Jan 2024 12:19:20 +0100 Subject: [PATCH] Improve nix development shell --- flake.nix | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index c518629..86e9cd8 100644 --- a/flake.nix +++ b/flake.nix @@ -10,18 +10,32 @@ let pkgs = import nixpkgs { inherit system; }; naersk-lib = pkgs.callPackage naersk { }; - in { + + # Needed at compile time (on build system) + nativeBuildInputs = with pkgs; [ + gtk4 + cairo + glib + pkg-config + poppler + wrapGAppsHook + ]; + # Needed at runtime (on run system) + buildInputs = with pkgs; [ ]; + in rec { defaultPackage = naersk-lib.buildPackage { src = ./.; - nativeBuildInputs = with pkgs; [ - gtk4 - cairo - glib - pkg-config - poppler - wrapGAppsHook - ]; + inherit buildInputs; + inherit nativeBuildInputs; }; + devShell = with pkgs; + mkShell { + buildInputs = + [ cargo rustc rustfmt pre-commit rustPackages.clippy ]; + # Without inheriting nativeBuildinputs, cargo build will fail but that is good since we want to use only nix build + # inherit nativeBuildInputs; + RUST_SRC_PATH = rustPlatform.rustLibSrc; + }; }); }