perSystem.scripts
Generate scripts from different shells from string snippets, files, or nushell modules.
Enabled scripts are added to packages.{system}
by name if scripts.addToPackages
is set.
Type: submodule
Default:
{ }
Example:
{
perSystem = { ... }: {
scripts = {
enable = true;
addToPackages = true; # default
defaultShell = "nu"; # default
scripts = {
my-test-script.text = "ls -l";
my-test-script-bash-test.shell = "bash";
my-test-script-bash-test.text = "ls -la";
my-test-script-env-has.inputs = [pkgs.afetch];
my-test-script-env-has.text = ''
def main [ var ] {
print $"Env ($var) present: (envHas $var)"
afetch
}
'';
};
};
};
}
Declared by:
perSystem.scripts.enable
Whether to enable enable scripts integration.
Type: boolean
Default:
true
Example:
true
Declared by:
perSystem.scripts.__enabledScripts
enabled scripts
Type: unspecified value (read only)
Default:
{ }
Declared by:
perSystem.scripts.__exportableScripts
enabled scripts, with some config removed, suitable for importing between scripts
Type: unspecified value (read only)
Default:
{ }
Declared by:
perSystem.scripts.addToPackages
Whether to enable adds all scripts to packages depending on module type
- flake:
packages.{system}
- nixos:
environment.systemPackages
- home:
home.packages
.
Type: boolean
Default:
true
Example:
true
Declared by:
perSystem.scripts.defaultLibDirs
optional script lib dir set for all nushell scripts
Type: null or path
Default:
null
Declared by:
perSystem.scripts.defaultShell
set default shell for all scripts
Type: string
Default:
"nu"
Declared by:
perSystem.scripts.pkgs
Nixpkgs used to generate script. Influences shell runtime.
Type: Nixpkgs package set
Default:
pkgs
Declared by:
perSystem.scripts.scripts
Generate scripts from different shells from string snippets, files, or nushell modules.
Enabled scripts are added to packages.{system}
by name if scripts.addToPackages
is set.
Type: attribute set of (submodule)
Default:
{ }
Example:
{
my-test-script.text = "ls -l";
my-test-script-bash-test.shell = "bash";
my-test-script-bash-test.text = "ls -la";
my-test-script-env-has.inputs = [pkgs.afetch];
my-test-script-env-has.text = ''
def main [ var ] {
print $"Env ($var) present: (envHas $var)"
afetch
}
'';
}
Declared by:
perSystem.scripts.scripts.<name>.enable
Whether to enable enable script, auto-matically adds script to packages.
Type: boolean
Default:
true
Example:
true
Declared by:
perSystem.scripts.scripts.<name>.package
package binary for running script
Type: package
Default:
""
Declared by:
perSystem.scripts.scripts.<name>.checkPhase
setting of writeShellApplication
, if null runs a default bash one
Type: null or string
Default:
""
Declared by:
perSystem.scripts.scripts.<name>.env
runtime env to provide to script
Type: null or (attribute set of string)
Default:
null
Example:
{
ENV_VAR = "variable";
}
Declared by:
perSystem.scripts.scripts.<name>.extraConfig
extra config to add to `writeShellApplication
Type: attribute set of raw value
Default:
{ }
Example:
with pkgs; [
caddy
gnused
]
Declared by:
perSystem.scripts.scripts.<name>.file
optionally set script file path, recommended for script files which only contain a single main
Type: path
Default:
builtins.toFile "‹name›.nu" config.text
Example:
./fill.nu
Declared by:
perSystem.scripts.scripts.<name>.inputs
runtime inputs to add to script
Type: list of package
Default:
[ ]
Example:
with pkgs; [
caddy
gnused
]
Declared by:
perSystem.scripts.scripts.<name>.name
script name, also used as name of binary
Type: string
Default:
"‹name›"
Declared by:
perSystem.scripts.scripts.<name>.nuLegacyModule
optional nu legacy module wrapper
Type: null or path
Default:
null
Example:
./my-helpers.nu
Declared by:
perSystem.scripts.scripts.<name>.nuLibDirs
sets NU_LIB_DIRS in nushell scripts
Type: null or path
Default:
null
Example:
./nu
Declared by:
perSystem.scripts.scripts.<name>.nuModule
optional nu module wrapper, very basic wrapper that exports a module to be called from cli
Type: null or path
Default:
null
Example:
./my-helpers.nu
Declared by:
perSystem.scripts.scripts.<name>.runtimeShell
runtime shell package.
Type: package
Declared by:
perSystem.scripts.scripts.<name>.shell
runtime shell of script
Type: string
Default:
"nu"
Example:
"bash"
Declared by:
perSystem.scripts.scripts.<name>.text
nushell script
Type: string
Default:
""
Declared by: