Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocamlPackages.eio_main: Unable to build without ocamlPackages.uring on linux and cannot override. #373872

Closed
3 tasks done
0poss opened this issue Jan 14, 2025 · 3 comments
Closed
3 tasks done
Labels
0.kind: bug Something is broken

Comments

@0poss
Copy link

0poss commented Jan 14, 2025

Nixpkgs version

  • Stable (24.11)

Describe the bug

On a linux kernel with io_uring disabled, or even without io_uring at all (CONFIG_IO_URING=n), building ocamlPackages.eio_main fails because the checkPhase of ocamlPackages.uring naturally fails without io_uring.

However I cannot seem to figure out how to build ocamlPackages.eio_main even by override the package which seems to have no effect at all; since ocamlPackages.eio_main depends on ocamlPackages.eio_linux (which itself depends on ocamlPackages.uring when stdenv.hostPlatform.isLinux is true (see here), I have tried the following overlay:

                nixpkgs.overlays = [
                  (self: super: {
                    ocamlPackages = super.ocamlPackages // {
                      eio_main = builtins.trace "eio_main" (
                        super.ocamlPackages.eio_main.override (old: {
                          stdenv = old.stdenv // {
                            hostPlatform.isLinux = false;
                          };
                        })
                      );
                    };
                  })
                ];

However, this also results in the ocamlPackages.uring being built when running nix build nixpkgs#ocamlPackages.eio_main.

There should be a simple way to override the automatic dependency of ocamlPackages.eio_main to ocamlPackages.eio_linux.

Steps to reproduce

  1. Add the following to your NixOS configuration:
      boot.kernelPatches = [ {
        name = "kconfig-disable-io-uring";
        patch = null;
        extraConfig = ''
                IO_URING n
              '';
        } ];
  2. Rebuild your system.
  3. Run nix build nixpkgs#ocamlPackages.eio_main.

Expected behaviour

It should be trivial to override the behaviour of ocamlPackages.eio_main depending on ocamlPackages.eio_linux.

Screenshots

No response

Relevant log output

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.7.0, NixOS, 24.11 (Vicuna), 24.11.20250110.1dab772
  • multi-user?: no
  • sandbox: yes
  • version: nix-env (Nix) 2.24.11
  • nixpkgs: /nix/store/ynjyhwksmz6rxipx3r0h8gyj42lvd4ak-source

Notify maintainers

@toastal


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

@0poss 0poss added the 0.kind: bug Something is broken label Jan 14, 2025
@0poss
Copy link
Author

0poss commented Jan 14, 2025

I have also opened an issue which might provides additional details here in microvm.nix.

@0poss
Copy link
Author

0poss commented Jan 15, 2025

I solved this issue with the help of @erdnaxe. It seems to be a problem with all ocaml packages which results in needing to override the whole dependency chain of ocaml package for an overlay to apply. So for example, for building ocamlPackages.wayland without io_uring, you need to do something like

                nixpkgs.overlays = [
                  (self: super: {
                    ocamlPackages = super.ocamlPackages // {
                      eio = builtins.trace "eio" (
                        super.ocamlPackages.eio.override { inherit (self.ocamlPackages) buildDunePackage; }
                      );

                      eio_posix = builtins.trace "eio_posix" (
                        super.ocamlPackages.eio_posix.override { inherit (self.ocamlPackages) eio; }
                      );

                      eio_main = builtins.trace "eio_main" (
                        super.ocamlPackages.eio_main.override {
                          inherit (self.ocamlPackages) eio eio_posix eio_linux;
                          stdenv = super.stdenv // {
                            hostPlatform = super.stdenv.hostPlatform // {
                              isLinux = false;
                            };
                          };
                        }
                      );

                      wayland = builtins.trace "wayland" (
                        super.ocamlPackages.wayland.override { inherit (self.ocamlPackages) eio eio_main; }
                      );
                    };
                  })
                ];

Now that it is solved, it actually seems logical because of the line
ocamlPackage = super.ocamlPackages // { ... }, but at the same time it shouldn't be that complicated to override an ocaml package.

@toastal
Copy link
Contributor

toastal commented Jan 15, 2025

That kinda sucks. I wasn’t aware of the situation (I packaged Eio to eventually use it, but haven’t yet). BTW, it is more common to use final: prev: over self: super: in overlays as the other wording is confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants