mirror of
https://gitlab.com/TECHNOFAB/soonix.git
synced 2026-02-02 07:15:06 +01:00
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:
parent
837ee45bed
commit
aef4bc1a26
1 changed files with 61 additions and 63 deletions
|
|
@ -4,7 +4,7 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) types mkOption concatMapStringsSep;
|
||||
inherit (lib) types mkOption concatMapStringsSep mapAttrsToList;
|
||||
soonix_lib = import ./. {inherit pkgs;};
|
||||
inherit (soonix_lib) engines buildAllFiles;
|
||||
in {
|
||||
|
|
@ -253,6 +253,7 @@ in {
|
|||
builtins.addErrorContext "[soonix] while generating shell hook"
|
||||
# sh
|
||||
''
|
||||
function _soonix() {
|
||||
CHECK_MODE=''${CHECK_MODE:-false}
|
||||
SKIP_GITIGNORE=''${SKIP_GITIGNORE:-false}
|
||||
|
||||
|
|
@ -313,10 +314,13 @@ in {
|
|||
if [[ $status -ne 0 ]]; then
|
||||
exit $status
|
||||
fi
|
||||
}
|
||||
_soonix
|
||||
unset _soonix
|
||||
'';
|
||||
|
||||
allFiles =
|
||||
lib.mapAttrsToList (name: hook: {
|
||||
mapAttrsToList (name: hook: {
|
||||
src = hook.generatedDerivation;
|
||||
path = hook.output;
|
||||
})
|
||||
|
|
@ -415,18 +419,12 @@ in {
|
|||
'') (builtins.attrNames hooks)}
|
||||
;;
|
||||
update)
|
||||
function _soonix() {
|
||||
${generateShellHook}
|
||||
}
|
||||
_soonix
|
||||
;;
|
||||
check)
|
||||
CHECK_MODE=true
|
||||
echo "Checking files..."
|
||||
function _soonix() {
|
||||
${generateShellHook}
|
||||
}
|
||||
_soonix
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue