Package Details: environment-modules 5.6.1-6

Git Clone URL: https://aur.archlinux.org/environment-modules.git (read-only, click to copy)
Package Base: environment-modules
Description: Provides for an easy dynamic modification of a user's environment via modulefile.
Upstream URL: https://envmodules.io/
Licenses: GPL-2.0-or-later
Conflicts: lmod
Replaces: env-modules
Submitter: hcartiaux
Maintainer: hcartiaux (ChrisTX, snafu)
Last Packager: ChrisTX
Votes: 15
Popularity: 0.172068
First Submitted: 2026-06-29 01:01 (UTC)
Last Updated: 2026-07-06 23:47 (UTC)

Latest Comments

1 2 3 4 Next › Last »

ChrisTX commented on 2026-07-06 23:56 (UTC) (edited on 2026-07-07 22:57 (UTC) by ChrisTX)

@hcartiaux Sorry for the indent changes, I unintentionally had my editor on format-on-save and it reformatted it with shfmt, which I hadn't noticed. I disabled that now to avoid running into this in the future.

As for sed: I would agree if this was for building an application, but here it's a bunch of tests, that are all broken the same way. If sed was to fail patching something, that test will just error later on. With a patch approach you'll potentially have to update the patch more often if lines around the patch location change.

As for dnsdomainname, that shouldn't be an issue. Upstream only uses this for statistics and doesn't make use of it being a NIS domain or whatever. The correct choice would be hostname -y, as that shows the YP/NIS domain. I'm not entirely sure the choice of a DNS name is replaceable there. Maybe we should raise this with upstream what they think and to eye a change maybe for a future release? See edit below

While I was looking through their code, I did notice a few things though:

  1. Upstream uses xorg-xrdb to provide the module files command x-resource. To my understanding its optional, so I've made it an opts and make depends as it's used in some tests. Unlike the domain name thing, they call xrdb a lot, like here

  2. They use lsb_release here and then reuse the results. I've added that to the depends.

  3. They have an optional dependency on mogui, the environment-modules GUI. It's being tested for here and changes some shell integration and some tests behaviour. But as you can see, this hasn't been updated in two years and there's no AUR package or anything for it either. Alas, I didn't add it, but this could (should?) be an opt depends.

Edit: It is actually possible to make sed fail on no substitution, but it means using rather ugly commands. Namely the q command allows exiting with a specific code (although this is a GNU extension):

sed -nE 's/(auto_execok )domainname/\1hostname/ ; p ; t loop ; $!d ; x ; /^$/!{q 0} ; q 1 ; :loop ; x' -i testsuite/modules.70-maint/220-config.exp [...]

This would work, but I'm not sure if that's any less maintenance because this is obviously awful to read...

Edit #2: I made an upstream bug report about this whole matter.

Also, I probably didn't explain too well what I my concern about dnsdomainname is, or at least I believe so. Effectively, the main usage for the information of domainname(1) in modules is not module state, but rather the modulefile command uname. It does return this information in its field parameter to whatever modulefile calls it. And that's the crux - it's very difficult to estimate what modulefiles would do with it, but if they use it, they will almost certainly assume it to be a NIS domain name, because that's what it's defined as in the documentation and that's what upstream does.

If you set your hostname to anything containing a . you will have a dnsdomainname automatically nowadays. I have dedicated servers at cloud providers with their FQDN as hostname but that aren't part of any domain; no NIS, AD, FreeIPA. But if it's not (none), modulefiles might believe those machines to be joined in an NIS domain when it isn't.

I don't think it's a good idea for us to change the behaviour here - after some contemplation I would swap to hostname -y. As I've explained in the upstream bug report, the issue overall stems from any distro (Fedora, Debians, Nix, SuSE) but Arch using debian-hostname rather than GNU inetutils to provide hostname(1) and friends. But on either package, hostname -y works and uses getdomainname(2) under the hood, so the behaviour is identical.

Maybe it's worth a consideration for Arch though to package debian-hostname. Inetutils has its own problems and 99% of people only install it for hostname(1) anyway. It also has no dependencies whatsoever and is absolutely minimalistic.

Edit #3: I uploaded MoGui to AUR if you want to take a look. But MoGui is a pretty basic and trivial GUI, I'd just leave it as is, or maybe make it a virtual dependency.

hcartiaux commented on 2026-07-06 09:43 (UTC) (edited on 2026-07-06 10:36 (UTC) by hcartiaux)

@ChrisTX, reviewing right now.

Few remarks:

  • separate your commit, do not mix cosmetic changes (indent) with other things, it's hard to read the diff.
  • we should not use sed, it fails silently, it's preferable to generate a patch.
  • we could use the command dnsdomainname from inetutils instead of hostname -d, but the output seems to be different when the domain name is not set, so I will leave it as it is now.

Edit: OK for me, thanks a lot for your work @ChrisTX @snafu :)

ChrisTX commented on 2026-07-01 03:59 (UTC) (edited on 2026-07-01 03:59 (UTC) by ChrisTX)

I added inetutils to the depends() array (that's what provides hostname) and had a quick look at why the tests were failing. It turns out, it was just the same domainname thing. Instead of deleting them I just added two lines of sed that do the domainname -> hostname -d adjustment for the test as well. This way we can run the full QUICKTEST suite without deleting any tests.

hcartiaux commented on 2026-06-29 01:14 (UTC)

New version pushed as environment-modules.

  • I've not added yp-tools to the depends array, I've created a patch instead. Tests are passing, some of them are disabled with QUICKTEST=1 so not totally surprising.

  • I've not added powershell to the checkdepends array (because it's in AUR and I don't intend to move powershell to extra)

  • there's apparently a problem with the shell initialization in bash for the ml() function, I have to debug this.

  • for the broken symlinks, my mistake :)

  • let's keep the configuration and paths in sync with other distros, as users are probably coming from HPC centers using RHEL or Debian derivatives.

When you're ok, I can merge env-modules into environment-modules. My onboarding as a new package maintainer is not yet completed, so it will probably stay in AUR for a few more weeks.

ChrisTX commented on 2026-06-23 19:01 (UTC)

@snafu

+1 for renaming it.

I just put it in the location upstream used, and Ubuntu and Fedora seem to use the same location. But somewhere under /usr/share is fine.

Regarding the breakage, there's typos in the PKGBUILD causing it. The variable _moduledir is defined, but it later references moduledir without a leading underscore. This causes the breakage I've seen. I've just removed those variables, which fixed the issue.

Also, zsh will work as-is like this. The idea is that any shell should load upstream's profile.sh - this can be done by just putting it in /etc/profile.d. zsh and other shells will load that. See also the upstream documentation on this. Either way, I can confirm that with my fixes it works out-of-the-box in zsh, bash, etc.

snafu commented on 2026-06-23 18:47 (UTC)

@ChrisTX great effort! And great to hear that it will migrate to extra.

Just one minor thought, maybe when migrating the package should be renamed to environment-modules for reasons of consistency or sed -i -e 's/environment-modules/envmodules/g' PKGBUILD (which might be even more consistent with http://envmodules.io, but does not match the other major distro's)

And maybe regarding point 5. also /usr/share/environment-modules/init, would be less confusion from my point of view.

Regarding point 2, the symlinks are not broken in the last version I have installed. But since zsh does not provide something a mechanism like BASH_ENV (which is set by envmodules), i found no other way to make module function available. Nevertheless removing the noise postinstall is fine.

ChrisTX commented on 2026-06-23 12:47 (UTC) (edited on 2026-06-23 12:47 (UTC) by ChrisTX)

@hcartiaux Oh nice, I didn't know this was planned. In that case, I got some remarks that might help then:

  1. Please note that the yp-tools solution is probably not what you want to go with then. They indeed hardcode the usage of domainname(1), but it's used here in init.tcl and in tests only, e.g. here or here. The tests should just be skipped with a warning, and in init.tcl this could be patched to call hostname -d (from inetutils) or you could make a dummy package that provides a /usr/bin/domainname, which in turn just calls hostname -d.

  2. As for the makedepends(): It will use whatever is available in terms of commands automatically. Alas, you could remove powershell (which is only in AUR atm) from it and it would just cause the tests for powershell to get skipped. I however sort of had to add it as it would for people installing from AUR otherwise make a difference for the tests whether powershell is available or not. ( PS. alternatively, I just last month significantly reworked and cleaned up the powershell PKGBUILD as well. 😅 )

hcartiaux commented on 2026-06-23 08:54 (UTC) (edited on 2026-06-23 08:55 (UTC) by hcartiaux)

@ChrisTX thanks a lot for your work here. I'll take the time to review your changes this week and will update env-modules. Eventually, I'll migrate the package to extra.

ChrisTX commented on 2026-06-22 19:45 (UTC) (edited on 2026-06-22 19:46 (UTC) by ChrisTX)

This has a few issues:

  1. The tests need zsh, dash, bash, etc. installed to run consistently. All of the shells need to go in makedepends() since otherwise the tests will silently skip or fail. This includes R, CMake, Perl and PowerShell since the package has integrations for those.

  2. The variables in the PKGBUILD are messed up, so it created broken symlinks in / instead of what it's supposed to do.

  3. You can't use optdepends() for makedepends(). This breaks automatic building in chroot etc. Sphinx and Nagelfar are also not declared as optional by upstream and should be present.

  4. Check shouldn't be commented out, see here. This can be skipped with --nocheck. However, upstream recommends using QUICKTEST=1 (see here). Using that makes the tests pass quickly.

  5. The init path should be /usr/share/module/init, this is the right path on Arch, and also what upstream uses. They don't belong in /etc.

  6. The module should already with its symlink to /etc/profile.d be loaded for all shells. The reason it doesn't is point 2. Thus the .install can be removed, as the info is obsolete.

  7. Every major distro (Fedora, Debian, Ubuntu, ...) that ships this puts the configuration files under /etc/environment-modules.

  8. vi is a hard dependency, and so is having domainname, see e.g. here in their documentation. The latter can only be provided by yp-tools. Without these, certain parts of environment modules break.

  9. Quite a bunch of optional, newer features are left disabled.

Taking all of this together, I got the following patch for the PKGBUILD: https://gist.github.com/ChrisTX/b8651ce3dcf1d8841f5e5f432abfca82

I should add that this kinda sucks, especially the dependency on yp-tools, but unfortunately environment modules assumes domainname(1) to be available and will cause errors if it isn't. The same goes for the amount of dependencies for the tests.

hcartiaux commented on 2025-11-07 09:21 (UTC)

I've updated the PKGBUILD here: https://gist.github.com/hcartiaux/0f32c3d1d05f8d15a77267b0146583e1