From df789547acc0a9f5f3f4bf93a6e6a9cf9877d74b Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 25 Aug 2023 02:50:26 +0200 Subject: devshell: add prePrompt option --- example/flake.nix | 4 ++++ lib/mk-dev-shell.nix | 2 ++ 2 files changed, 6 insertions(+) diff --git a/example/flake.nix b/example/flake.nix index 86accf7..0479e01 100644 --- a/example/flake.nix +++ b/example/flake.nix @@ -37,6 +37,10 @@ DATABASE_URL = "postgresql:///${PGDATABASE}?host=${PGHOST}"; }; + prePrompt = '' + echo " to exit this development shell." + ''; + shell = null; }; } diff --git a/lib/mk-dev-shell.nix b/lib/mk-dev-shell.nix index fe2ac02..cc7d940 100644 --- a/lib/mk-dev-shell.nix +++ b/lib/mk-dev-shell.nix @@ -2,6 +2,7 @@ flake: { pkgs , tools ? [] , envVars ? {} +, prePrompt ? "" , shell ? null }: @@ -16,6 +17,7 @@ in pkgs.mkShell { ${shellLib.ifSomeAttrs envVars shellLib.printEnvVars} ${shellLib.ifSomeList tools shellLib.printBins} echo + ${prePrompt} ${if (shell != null) then shell else shellLib.startUserShell} exit $? -- cgit v1.2.3