Skip to content

cannot build Haskell programs that depend on gtk+3 statically #50

Open
@cdepillabout

Description

@cdepillabout

I'm trying to build a Haskell executable (Termonad) statically that uses gi-gtk, which is built using haskell-gi and depends on gtk+3.

It appears to be failing when building systemd.

Termonad depdends on gi-gtk, which depends on gtk+3, which depends on at-spi2-atk, which depends on dbus, which depends on systemd.

I can include the output from the failed systemd build if it would help.

Alternatively, here is the derivation I am trying to build:

let
  survey = import ./survey { normalPkgs = import ./nixpkgs {}; };

  termonad-pkg =
    { mkDerivation, adjunctions, base, Cabal, cabal-doctest
    , classy-prelude, colour, constraints, containers, data-default
    , directory, distributive, doctest, dyre, filepath, focuslist
    , genvalidity-containers, genvalidity-hspec, gi-gdk, gi-gio
    , gi-glib, gi-gtk, gi-pango, gi-vte, gtk3, haskell-gi-base
    , hedgehog, inline-c, lens, libpcre2, mono-traversable
    , pretty-simple, QuickCheck, singletons, stdenv, tasty
    , tasty-hedgehog, tasty-hspec, template-haskell, text, vte_291
    , xml-conduit, xml-html-qq
    }:
    mkDerivation {
      pname = "termonad";
      version = "2.0.0.0";
      sha256 = "0rprqn5vcvhbqqg0grrmz0ijjpkrprza88la4mbdg6skb34fjsp0";
      isLibrary = true;
      isExecutable = true;
      enableSeparateDataOutput = true;
      setupHaskellDepends = [ base Cabal cabal-doctest ];
      libraryHaskellDepends = [
        adjunctions base classy-prelude colour constraints containers
        data-default directory distributive dyre filepath focuslist gi-gdk
        gi-gio gi-glib gi-gtk gi-pango gi-vte haskell-gi-base inline-c lens
        mono-traversable pretty-simple QuickCheck singletons text
        xml-conduit xml-html-qq
      ];
      libraryPkgconfigDepends = [ gtk3 libpcre2 vte_291 ];
      executableHaskellDepends = [ base ];
      testHaskellDepends = [
        base doctest genvalidity-containers genvalidity-hspec hedgehog lens
        QuickCheck tasty tasty-hedgehog tasty-hspec template-haskell
      ];
      homepage = "https://github.com/cdepillabout/termonad";
      description = "Terminal emulator configurable in Haskell";
      license = stdenv.lib.licenses.bsd3;
    };

  myHaskellPackages =
    survey.haskellPackages.override {
      overrides = self: super: {
        termonad = self.callPackage termonad-pkg {
          libpcre2 = survey.pkgs.pcre2;
          vte_291 = survey.pkgs.gnome3.vte;
        };

        gi-gtk = survey.pkgs.haskell.lib.unmarkBroken super.gi-gtk;

        gi-vte = survey.pkgs.haskell.lib.unmarkBroken super.gi-vte;
      };
    };
in

myHaskellPackages.termonad

Note the following:

  • termonad-pkg is generated using cabal2nix. The current version of termonad in nixpkgs would probably work too.
  • gi-gtk and gi-vte (Haskell dependencies of Termonad) are marked broken, probably because they don't compile with the latest version of GTK+3. I'm not worried about this, since this also occurs when building with dynamic linking. (I'm mostly concerned with getting GTK+3 built statically, so that I can work on creating static builds of Termonad).
  • I'm using the latest HEAD of static-haskell-nix, which is commit 761f34b.

It is possible this should just be an issue on the nixpkgs repo. If this is the case, I will move it there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions