hercules-ci / arion

Run docker-compose with help from Nix/NixOS
Apache License 2.0
622 stars 48 forks source link

error 'The option `environment.stub-ld` does not exist' when trying to set this (used in e.g. SrvOS) #249

Closed KiaraGrouwstra closed 2 months ago

KiaraGrouwstra commented 2 months ago

hey there, i was trying to use arion to test a NixOS configuration for a server setup that had included SrvOS's server module. however, this seemed to run into issues like the following (minimum repro):

adding

  environment.stub-ld.enable = false;

to a simple arion setup triggers:

error: The option environment.stub-ld does not exist.

setting such an option seems to work okay for me in a regular (non-Arion-run) NixOS setup.

i'm not so much saying this might not be part of intended behavior in Arion, but not understanding things well, i'm hoping to learn how to better deal with clashes like this. now, given such a setting stemmed from their module, it is harder for me to just remove this single configuration. i can of course try and add overrides myself, and i'm hoping that might help work around this. however, even if i could use lib.mkForce, even if i try and use a separate setting such as environment.stub-ld = {};, this would similarly trigger the mentioned error, leaving me unsure as to how to proceed.

similarly, their common module "${inputs.srvos}/nixos/common/default.nix" triggers an error The option environment.ldso32 does not exist.

would you perhaps have any advice on how to deal with theseq?

also, thanks for making arion! ☺️🙏

roberth commented 2 months ago

Hi Kiara,

I guess SrvOS is just ahead of 23.11, which didn't have that option. If SrvOS is interested in supporting multiple NixOS versions, they could add conditionals like

environment = {
  # ...
} // lib.optionalAttrs (options?environment.stub-ld) {
  stub-ld = # ...
};

That said, I wouldn't recommend this particular code, because 23.11 is going end-of-life, and I'd much favor solutions that work towards refactoring into sets of modules that provide the right behavior for their use cases rather than loading everything and then disabling stuff that's not right. More concretely, I think NixOS should be refactored into a set of core modules, and desktop modules, so that it's possible to load the right set with evalModules from nixos/lib rather than the traditional (desktop-oriented) entrypoints. In such a design, stub-ld isn't even loaded.

I'll close this because it's not really an arion issue, but feel free to reply.