nh2 / nh2/static-haskell-nix

cannot build Haskell programs that depend on gtk+3 statically

Open
#50 18 comments 0 reactions 0 assignees View on GitHub
Dominant language
Nix
Stars
401
Forks
36
PR merge metrics
No merged PRs in 30d

Description

I'm trying to build a Haskell executable ([Termonad](https://github.com/cdepillabout/termonad)) statically that uses [gi-gtk](http://hackage.haskell.org/package/gi-gtk), which is built using [haskell-gi](https://github.com/haskell-gi/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:

```nix
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 761f34bb4b09dd5838f82782c5e56ebfac4039fb.

---------------------------------------------------------------------------

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.