From 4bb0c45d24d7702031f5f3d104bd03a140ed5d64 Mon Sep 17 00:00:00 2001 From: mib Date: Thu, 10 Oct 2024 15:32:10 +0200 Subject: [PATCH] allow overriding mkShell used --- lib.nix | 2 +- modules/top-level.nix | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib.nix b/lib.nix index 525940e..d390997 100644 --- a/lib.nix +++ b/lib.nix @@ -17,7 +17,7 @@ let } // config.flake; mkShell = config: pkgs: system: - pkgs.mkShell { + config.mkShell { packages = config.packages ++ [ config.formatter ]; LD_LIBRARY_PATH = makeLibraryPath config.libraries; inputsFrom = attrValues (config.flake.packages.${system} or { }); diff --git a/modules/top-level.nix b/modules/top-level.nix index 5f96c7c..e88ee96 100644 --- a/modules/top-level.nix +++ b/modules/top-level.nix @@ -69,6 +69,18 @@ in This is mainly for conch modules; shellHook should generally be used instead. ''; }; + + mkShell = mkOption { + # can't represent `f :: set -> drv` with option type system + type = with types; anything; + default = pkgs.mkShell; + example = [ "craneLib.devShell" ]; + description = mdDoc '' + A function compatible with `pkgs.mkShell`, to allow arbitrary extending of use-case. + + Specifically made for crane's `craneLib.devShell`. + ''; + }; }; config._module = {