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

Marked as broken on nixpkgs #185

Open
Cajunvoodoo opened this issue Sep 1, 2023 · 7 comments
Open

Marked as broken on nixpkgs #185

Cajunvoodoo opened this issue Sep 1, 2023 · 7 comments
Labels
help wanted Extra attention is needed packaging

Comments

@Cajunvoodoo
Copy link

Currently, dear-imgui.hs is marked as broken on nixpkgs. Temporarily allowing broken packages gives the following error:

@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
configureFlags: --verbose --prefix=/nix/store/r0z0xjm7p1cdsz1am22rswl97y6fg5vq-dear-imgui-2.1.3 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --with-gcc=gcc --package-db=/build/tmp.qo7rfeAam4/packa>Using Parsec parser
Configuring dear-imgui-2.1.3...

Setup: Encountered missing or private dependencies:
megaparsec >=9.0 && <9.3

Ignoring dependency bounds with haskell-flake produces a different error:

error: builder for '/nix/store/5mr7mfnacvzynjizdr3xqkq488mk7ayh-source-dear-imgui-sdist.tar.gz.drv' failed with exit code 1;
       last 8 log lines:
       > unpacking source archive /nix/store/gfanl0krmlsgv2ij5x3nfslh2dfk1c7c-source-dear-imgui
       > source root is source-dear-imgui
       > Config file path source is default config file.
       > Config file not found: /build/source-dear-imgui/.config/cabal/config
       > Writing default configuration to /build/source-dear-imgui/.config/cabal/config
       > Error: cabal: sdist of dear-imgui-2.1.3: filepath wildcard 'imgui/*.h' does
       > not match any files.
       >
       For full logs, run 'nix log /nix/store/5mr7mfnacvzynjizdr3xqkq488mk7ayh-source-dear-imgui-sdist.tar.gz.drv'.
error: 1 dependencies of derivation '/nix/store/pjll751gmfh225wxiadrd94b90s7zc9q-dear-imgui-2.1.3.drv' failed to build

I am using pkgs.haskell.packages.ghc92 (ghc 9.2.8) for my project.

@dpwiz dpwiz added help wanted Extra attention is needed packaging labels Sep 2, 2023
@Cajunvoodoo
Copy link
Author

It appears the first issue (dependency bounds) is simply nixpkgs not having the required version, not a big deal.

The second issue, however, appears to be due to the imgui submodule. In the flake input, the following worked:

dear-imgui = {
  type = "git";
  submodules = true; # requires `type = "git"`
  flake = false;
  url = "https://github.com/haskell-game/dear-imgui.hs";
};

By default it appears flakes do not pull the submodules, which is why cabal could not find imgui/*.h. I do not know if this problem can be solved in a convenient way on the dear-imgui side, but it probably ought to be noted somewhere for inclusion in flakes. Is there any better place than the readme?

@Cajunvoodoo
Copy link
Author

After looking into it further, it appears there is no general way to include submodules on self with flakes yet. All of the proposed solutions are either under debate, dropped, or are in development.

I guess this means the documentation should probably be updated to include this info for nix users.

The only other solution is cutting the submodule, but that seems like a lot more work. I don't see this package being freed of its "broken" status any other way.

@TristanCacqueray
Copy link
Contributor

@Cajunvoodoo does it work when using pkgs.fetchFromGitHub ?

@Cajunvoodoo
Copy link
Author

I'm not sure how that would work in the flake inputs field. I looked up the documentation and it says it uses fetchgit when fetchSubmodules=true;. Regardless, using fetchFromGitHub over whatever normal flakes do would only impact the user side of the library, not the broken status on nixpkgs.

I spent the last 4 hours or so working on both a fork of nixpkgs and of dear-imgui.hs to little avail. The closest I have gotten is from modifying nixpkgs, but the biggest issue is now finding all of the system dependencies. The following produces better results, but errors:

# in nixpkgs, configuration-common.nix
dear-imgui = overrideCabal (drv: {
  src = pkgs.fetchFromGitHub {
    owner = "haskell-game";
    repo = "dear-imgui.hs";
    sha256 = "";
    fetchSubmodules = true;
  };
   libraryPkgconfigDepends = with pkgs; [
    pkg-config
    gcc
    SDL2
    # ...
    ];
}

but it errors with "gcc: fatal error execv: Argument list too long." Looking into it, it appears this is still an open issue NixOS/nixpkgs#41340.

Modifying dear-imgui.hs alongside it and pointing the above configuration to my fork resulted in similar errors. I can't think of a way to get around this, as adding packages to either will result in compilation failure. Why this occurs only for the nixpkgs version I have the faintest of clues. Hopefully someone with better nix-fu than me can provide some insight.

@spacekitteh
Copy link

Did you ever figure this out?

@Cajunvoodoo
Copy link
Author

Not in nixpkgs, no, but I recall a while back finding some workaround. You may want to look at this override to get a working version of dear-imgui.hs. Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed packaging
Projects
None yet
Development

No branches or pull requests

4 participants