# eb-local.extend ::::{zig:module} eb-local.extend :file: src/extend.zig :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig Run EasyBuild through EESSI-extend with no Slurm job. EESSI-extend reads EESSI_USER_INSTALL, EESSI_PROJECT_INSTALL, EESSI_SITE_INSTALL and EESSI_CVMFS_INSTALL when it loads, and treats a present empty value as set (`os.getenv(name) ~= nil`). This allows at most one of those, then a shell sources the EESSI init, loads the module and execs eb. The module sets the hooks, the RPATH and EASYBUILD_UMASK; nothing here replaces them. :::: ## Types ::::{zig:type} eb-local.extend.Mode :signature: pub const Mode = enum :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L20 The install EESSI-extend makes, chosen by which install variable is set: `EESSI_USER_INSTALL`, `EESSI_PROJECT_INSTALL`, `EESSI_SITE_INSTALL` or `EESSI_CVMFS_INSTALL`. :::{zig:field} eb-local.extend.Mode.user :signature: user :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L20 ::: :::{zig:field} eb-local.extend.Mode.project :signature: project :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L20 ::: :::{zig:field} eb-local.extend.Mode.site :signature: site :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L20 ::: :::{zig:field} eb-local.extend.Mode.cvmfs :signature: cvmfs :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L20 ::: :::: ::::{zig:type} eb-local.extend.Selection :signature: pub const Selection = struct :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L24 What `select` chose: the install mode, and the umask the launcher runs with for it, the one EESSI-extend sets for that mode. :::{zig:field} eb-local.extend.Selection.mode :signature: mode: Mode :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L25 ::: :::{zig:field} eb-local.extend.Selection.umask :signature: umask: []const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L27 Process umask, as octal digits: 077, 002 or 022. ::: :::: ## Error sets ::::{zig:errorset} eb-local.extend.SelectError :signature: pub const SelectError = error{...} :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L32 `error.TooMany` when more than one install variable is set, a present empty one included; `tooMany` says which. :::{zig:error} eb-local.extend.SelectError.TooMany :signature: error.TooMany ::: :::: ## Functions :::{zig:function} eb-local.extend.variable :signature: pub fn variable(mode: Mode) []const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L50 The install variable that selects MODE. ::: :::{zig:function} eb-local.extend.engaged :signature: pub fn engaged(env: *const std.process.Environ.Map) bool :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L58 `EB_LOCAL_EESSI_EXTEND` is how a caller that can pass only one program (an eb-stack target's EasyBuild command) selects this launcher. Every argument is then eb's. Empty and `0` leave the ordinary commands alone. ::: :::{zig:function} eb-local.extend.select :signature: pub fn select(env: *const std.process.Environ.Map) SelectError!Selection :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L67 None of the four is a user install, and nothing is exported. On EESSI 2026.06 the module's help text says `$HOME/EESSI`, and the loaded module uses `$HOME/eessi` without requiring that directory to exist. Exporting the uppercase path would make the module demand a directory it does not use. ::: :::{zig:function} eb-local.extend.tooMany :signature: pub fn tooMany(a: Allocator, env: *const std.process.Environ.Map) Allocator.Error![]u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L84 Why `select` refused: each install variable that is set, with its value, and what EESSI-extend does with them. With a project and a user variable it loads and makes a private user install; with a site or a cvmfs one and another it refuses to load. One of them is usually left from an earlier session. ::: :::{zig:function} eb-local.extend.apply :signature: pub fn apply(env: *std.process.Environ.Map) void :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L135 Drop the launcher switch, so a build that itself runs eb-local does not enter this mode again. Install variables are left as the caller set them. ::: :::{zig:function} eb-local.extend.initPath :signature: pub fn initPath(a: Allocator, env: *const std.process.Environ.Map) Allocator.Error![]const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L141 The EESSI init the script sources, with the script's defaults for an unset or empty `EESSI_CVMFS_REPO` and `EESSI_VERSION`. ::: :::{zig:function} eb-local.extend.commandLine :signature: pub fn commandLine(a: Allocator, sel: Selection, eb_args: []const []const u8) Allocator.Error![]const []const u8 :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L299 The argument vector that runs eb through EESSI-extend for `sel`: a bash with no profile and no rc file running the launcher script, with the umask and the mode as its first arguments and `eb_args` after them. The caller owns the slice, not the strings in it. ::: ## Constants :::{zig:constant} eb-local.extend.cargo_linker :signature: pub const cargo_linker = @embedFile("cargo-linker.sh") :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L156 Lines that drop a host Cargo linker and point Cargo at `${CC:-gcc}` when `rustc -vV` prints a host. `script` includes this file, and `dev` prints the same bytes. ::: :::{zig:constant} eb-local.extend.script :signature: pub const script = script_before ++ cargo_linker ++ script_after :source: https://github.com/stackhands/eb-local/blob/629c1ef39cdece5bfa2145cc8e2e89ae7583d197/src/extend.zig#L293 `$1` is the umask, `$2` is the mode, and the rest are eb's arguments. EESSI's init is not safe under `nounset`. The compat-layer `ld` goes on `PATH` even when `rustc` is absent: a failing command substitution under `pipefail` would exit before the module loads. `WORKING_DIR` is the caller's: unset, the module's default is `/tmp/$USER`, one per user, where a shared default would leave every other user's build unable to write the first one's directories. Once the module has loaded, eb runs only if EASYBUILD_INSTALLPATH is in the tree the install variable selects and no EASYBUILD_INSTALLPATH_SOFTWARE or _MODULES moves part of the install elsewhere. The Cargo linker lines are `cargo_linker`. :::