chore(module): wrap soonix script already in shell hook

makes it more flexible and should thus work everywhere (also in
pkgs.mkShell shellHook)
This commit is contained in:
technofab 2026-01-21 19:24:23 +01:00
parent 837ee45bed
commit aef4bc1a26
Signed by: technofab
SSH key fingerprint: SHA256:bV4h88OqS/AxjbPn66uUdvK9JsgIW4tv3vwJQ8tpMqQ

View file

@ -4,7 +4,7 @@
lib, lib,
... ...
}: let }: let
inherit (lib) types mkOption concatMapStringsSep; inherit (lib) types mkOption concatMapStringsSep mapAttrsToList;
soonix_lib = import ./. {inherit pkgs;}; soonix_lib = import ./. {inherit pkgs;};
inherit (soonix_lib) engines buildAllFiles; inherit (soonix_lib) engines buildAllFiles;
in { in {
@ -253,6 +253,7 @@ in {
builtins.addErrorContext "[soonix] while generating shell hook" builtins.addErrorContext "[soonix] while generating shell hook"
# sh # sh
'' ''
function _soonix() {
CHECK_MODE=''${CHECK_MODE:-false} CHECK_MODE=''${CHECK_MODE:-false}
SKIP_GITIGNORE=''${SKIP_GITIGNORE:-false} SKIP_GITIGNORE=''${SKIP_GITIGNORE:-false}
@ -313,10 +314,13 @@ in {
if [[ $status -ne 0 ]]; then if [[ $status -ne 0 ]]; then
exit $status exit $status
fi fi
}
_soonix
unset _soonix
''; '';
allFiles = allFiles =
lib.mapAttrsToList (name: hook: { mapAttrsToList (name: hook: {
src = hook.generatedDerivation; src = hook.generatedDerivation;
path = hook.output; path = hook.output;
}) })
@ -415,18 +419,12 @@ in {
'') (builtins.attrNames hooks)} '') (builtins.attrNames hooks)}
;; ;;
update) update)
function _soonix() {
${generateShellHook} ${generateShellHook}
}
_soonix
;; ;;
check) check)
CHECK_MODE=true CHECK_MODE=true
echo "Checking files..." echo "Checking files..."
function _soonix() {
${generateShellHook} ${generateShellHook}
}
_soonix
;; ;;
esac esac
''; '';