Nix overlay to change FHS environment

Hello all

This is related to a previous question which i noticed that i did a pretty poor job explaining (and understanding now that i get a little bit more of nixos)

In lutris, I want to override the SDL2 library in use to build the FHS environment with one that has some patches (named SDL2_patched). Basically, in the multiPkgs argument in the buildFHSenv function, i have to replace pkgs.SDL2 with pkgs.SDL2_patched.

However I do not know how to start doing that overlay, as i’ve only worked with overlays that change the buildApplication (or buildPythonApplication) function, and I don’t know if it being in another file (fhsenv.nix instead of default.nix) would change anything.

Any ideas?
Thanks!

Untested, but this is the first thing I’d try:

lutris = super.lutris.override {
  buildFHSEnv = self.buildFHSEnv.override {
    callPackage =
      path: args: self.callPackage path (
        {
          pkgs = self // { SDL2 = SDL2_patched; };
        }
        // args
      );
  };
};
1 Like

It works, thanks a lot! I was already thinking on how to recreate the multiPkgs set without SDL and with SDL2, but overriding the pkgs set SDL2 lib is way easier.
Thanks again!

1 Like