This commit is contained in:
atagen 2026-05-19 23:32:51 +10:00
parent da4bc139eb
commit 66cbf003f8
44 changed files with 7166 additions and 5426 deletions

View file

@ -10,7 +10,7 @@
#
# Usage:
# { pkgs, ... }: {
# imports = [ ./path/to/inshellah/nix/module.nix ];
# imports = [ ./path/to/inshellah-rs/nix/module.nix ];
# programs.inshellah.enable = true;
# }
@ -72,6 +72,26 @@ in
'';
};
timeoutMs = lib.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
example = 200;
description = ''
per-subprocess timeout in milliseconds. when null the binary's
compiled-in default is used (currently 200ms).
'';
};
workers = lib.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
example = 8;
description = ''
worker thread count for the parallel scrape pool. when null,
`std::thread::available_parallelism` is used.
'';
};
snippet = lib.mkOption {
type = lib.types.str;
readOnly = true;
@ -109,12 +129,14 @@ in
lib.concatStringsSep "\n" cfg.helpOnlyCommands
);
helpOnlyFlag = lib.optionalString (cfg.helpOnlyCommands != [ ]) " --help-only ${helpOnlyFile}";
timeoutFlag = lib.optionalString (cfg.timeoutMs != null) " --timeout-ms ${toString cfg.timeoutMs}";
workersFlag = lib.optionalString (cfg.workers != null) " --workers ${toString cfg.workers}";
in
''
mkdir -p ${destDir}
if [ -d "$out/bin" ] && [ -d "$out/share/man" ]; then
${inshellah} index "$out" --dir ${destDir}${ignoreFlag}${helpOnlyFlag} \
${inshellah} index "$out" --dir ${destDir}${ignoreFlag}${helpOnlyFlag}${timeoutFlag}${workersFlag} \
2>/dev/null || true
fi