Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Arguments:
- Example: `["bin/*", "lib/*.sh"]` to replace original package paths with wrapped package paths
- Desktop files are patched by default to update Exec= and Icon= paths
- `filesToExclude`: List of file paths (glob patterns) to exclude from the wrapped package (default: `[]`)
- `patchHook`: Shell script that runs after patchPhase to modify the wrapper package files
- `patchHook`: Shell script that runs after patchPhase to modify the wrapper package files (default: `""`)
- `wrapper`: Custom wrapper function (optional, overrides default exec wrapper)

The function:
Expand All @@ -171,9 +171,11 @@ Built-in options (always available):
- `flagSeparator`: Separator between flag name and value (default: `" "`)
- `args`: Command-line arguments list (auto-generated from `flags` if not provided)
- `env`: Environment variables
- `preHook`: Shell script executed before the command (default: `""`)
- `passthru`: Additional passthru attributes
- `filesToPatch`: List of file paths (glob patterns) to patch for self-references (default: `["share/applications/*.desktop"]`)
- `filesToExclude`: List of file paths (glob patterns) to exclude from the wrapped package (default: `[]`)
- `patchHook`: Shell script that runs after patchPhase to modify the wrapper package files (default `""`)
- `wrapper`: The resulting wrapped package (read-only, auto-generated from other options)
- `apply`: Function to extend the configuration with additional modules (read-only)

Expand Down
2 changes: 1 addition & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ let
- `aliases`: List of additional names to symlink to the wrapped executable (optional)
- `filesToPatch`: List of file paths (glob patterns) to patch for self-references (optional, defaults to ["share/applications/*.desktop"])
- `filesToExclude`: List of file paths (glob patterns) to exclude from the wrapped package (optional, defaults to [])
- `patchHook`: Shell script that runs after patchPhase to modify the wrapper package files
- `patchHook`: Shell script that runs after patchPhase to modify the wrapper package files (optional)
- `wrapper`: Custom wrapper function (optional, defaults to exec'ing the original binary with args)
- Called with { env, flags, args, envString, flagsString, exePath, preHook }

Expand Down
16 changes: 16 additions & 0 deletions lib/modules/wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@
Example: [ "bin/unwanted-tool" "share/applications/*.desktop" ]
'';
};
options.patchHook = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
Shell script that runs after patchPhase to modify the wrapper package files.
'';
};
options.preHook = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
Shell script to run before executing the command.
'';
};
options.exePath = lib.mkOption {
type = lib.types.path;
description = ''
Expand Down Expand Up @@ -123,6 +137,8 @@
env = config.env;
filesToPatch = config.filesToPatch;
filesToExclude = config.filesToExclude;
preHook = config.preHook;
patchHook = config.patchHook;
passthru = {
configuration = config;
}
Expand Down
Loading