| 26 Jun 2026 |
Grimmauld (any/all) | diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index 89d413931c1b..be5afd66ad05 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -928,6 +928,7 @@ let
cmakeFlags ? [ ],
mesonFlags ? [ ],
+ ompNumThreads ? 1,
meta ? { },
passthru ? { },
pos ? # position used in error messages and for meta.position
@@ -961,7 +962,11 @@ let
let
env' =
- if attrs ? meta.mainProgram then env // { NIX_MAIN_PROGRAM = attrs.meta.mainProgram; } else env;
+ env
+ // {
+ OMP_NUM_THREADS = ompNumThreads;
+ }
+ // lib.optionalAttrs (attrs ? meta.mainProgram) { NIX_MAIN_PROGRAM = attrs.meta.mainProgram; };
derivationArg = makeDerivationArgument (
removeAttrs attrs argumentAttrsToRemove
something like this maybe | 13:45:13 |
Grimmauld (any/all) | (+ docs ig) | 13:45:27 |
Grimmauld (any/all) | that seems to work, but i am also somewhat clueless about best practices around stdenv, not sure i should be the one doing that PR... | 13:46:15 |
emily | don't let llakala see | 13:46:24 |
emily | tbh I would prefer a slightly less blunt instrument if possible | 13:46:47 |
emily | at least unless we're going to set a bunch of other stuff in stdenv too | 13:46:55 |
emily | (if we do want to do this it should probably be in the Bash code though) | 13:47:06 |
Grimmauld (any/all) | We'd want to allow overriding it, right? | 13:47:22 |
emily | we have an mpiCheckPhaseHook | 13:47:23 |
emily | I guess stuff is just not using it? | 13:47:26 |
emily | yeah, so := it | 13:47:32 |
emily | what I think I'd prefer is a default preCheck hook that yells if it can tell you're about to do OpenMP stuff but don't have mpiCheckPhaseHook, or something | 13:48:01 |
emily | because it sets a bunch of other stuff too | 13:48:12 |
emily | admittedly "tell you're about to do OpenMP stuff" might be complicated | 13:48:34 |
dramforever | openmp and mpi are almost unrelated | 13:48:47 |
dramforever | might explain why | 13:48:59 |
emily | well | 13:49:06 |
emily | mpiCheckPhaseHook sets OMP_NUM_THREADS | 13:49:11 |
emily | so maybe I'm not the only one confused by this :P | 13:49:23 |
dramforever | might explain why stuff aren't using it i mean | 13:49:23 |
Grimmauld (any/all) | okay other idea | 13:49:41 |
emily | all of these things have to be depending on OpenMP already right? couldn't we just put a setup hook on OpenMP itself to set the var | 13:49:54 |
Grimmauld (any/all) | it might not depend directly. Biggest problem has been python things running via numpy/scipy | 13:50:51 |
emily | give those a setup hook then? :) | 13:51:12 |
Vladimír Čunát | The variable shouldn't hurt to have everywhere in builds (by default), no? | 13:51:33 |
hexa | and they do it via blas I think | 13:51:43 |
Vladimír Čunát | * The variable shouldn't hurt to have everywhere in builds (by default), no? Or possibly just in the check phases. | 13:52:29 |
emily | probably not, and I could see an argument for "we should just set every relevant environment variable for ~everything in stdenv". but that might be an annoying practice to follow in general, e.g. would turn various kinds of flag changes into world rebuilds. and then it doesn't scale if you also need to say, point something at a path or whatever (which mpiCheckPhaseHook also happens to do) | 13:53:02 |
Grimmauld (any/all) | add mpiCheckPhaseHook to blas propagatedBuildInputs ? | 13:53:08 |
emily | so feels like doing it closer to the problem makes sense by default | 13:53:25 |