buildFHSEnv: allow specifying executableName explicitly (#371770)

This commit is contained in:
Austin Horstman
2025-01-14 16:03:39 -06:00
committed by GitHub
2 changed files with 14 additions and 5 deletions
@@ -6,11 +6,13 @@ It uses Linux' namespaces feature to create temporary lightweight environments w
Accepted arguments are:
- `name`
The name of the environment, and the wrapper executable if `pname` is unset.
The name of the environment.
- `pname`
The pname of the environment and the wrapper executable.
The pname of the environment.
- `version`
The version of the environment.
- `executableName`
The name of the wrapper executable. Defaults to `pname` if set, or `name` otherwise.
- `targetPkgs`
Packages to be installed for the main host's architecture (i.e. x86_64 on x86_64 installations). Along with libraries binaries are also installed.
- `multiPkgs`
@@ -12,9 +12,13 @@
}:
{
pname ? throw "You must provide either `name` or `pname`",
version ? throw "You must provide either `name` or `version`",
name ? "${pname}-${version}",
runScript ? "bash",
nativeBuildInputs ? [ ],
extraInstallCommands ? "",
executableName ? args.pname or name,
meta ? { },
passthru ? { },
extraPreBwrapCmds ? "",
@@ -30,7 +34,12 @@
...
}@args:
assert (!args ? pname || !args ? version) -> (args ? name); # You must provide name if pname or version (preferred) is missing.
# NOTE:
# `pname` and `version` will throw if they were not provided.
# Use `name` instead of directly evaluating `pname` or `version`.
#
# If you need `pname` or `version` sepcifically, use `args` instead:
# e.g. `args.pname or ...`.
let
inherit (lib)
@@ -48,8 +57,6 @@ let
# explicit about which package set it's coming from.
inherit (pkgsHostTarget) pkgsi686Linux;
name = args.name or "${args.pname}-${args.version}";
executableName = args.pname or args.name;
# we don't know which have been supplied, and want to avoid defaulting missing attrs to null. Passed into runCommandLocal
nameAttrs = lib.filterAttrs (
key: value: