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

Fix gi vte haskell pkg #44529

Merged
merged 0 commits into from Aug 27, 2018

Conversation

cdepillabout
Copy link
Member

@cdepillabout cdepillabout commented Aug 6, 2018

Motivation for this change

The gi-vte Haskell package does not compile in master:

https://hydra.nixos.org/job/nixpkgs/haskell-updates/haskellPackages.gi-vte.x86_64-linux

gi-vte depends on the gi-gtk Haskell package, as well as the VTE system library. The gi-gtk Haskell packge depends on the GTK system library. Currently, gi-gtk is being compiled against the GTK system library from Gnome 3. However, gi-vte is being compiled against the VTE system library from Gnome 2.

This PR does the following three things:

  1. Change the gi-vte package to depend the VTE system library from Gnome 3 in hackage-packages.nix.

  2. Add a dependency on the GTK system library for gi-vte. I'm not sure exactly why this is necessary, but gi-vte wouldn't build without it.

  3. Remove the gi-vte package from dont-distribute-packages in configuration-hackage2nix.yaml.

Eventually, I'd like to add a new Haskell package to nixpkgs that depends on gi-vte, so I would like gi-vte to be compiling in master. I'd like to get this in before the 18.09 release.

However, I think the hackage-packages.nix file (and maybe even the configuration-hackge2nix.yaml) is being auto-generated, so please let me know if there is some other file I should actually be editing. Also, for my future reference, is there an explanation somewhere of how the Haskell-related nixpkg files work? Like, which files I should edit and send PRs to?

Pinging the nixpkgs Haskell maintainers: @peti @ryantm @basvandijk (please let me know if it is not appropriate to do this)

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip" (there are currently no packages that depend on gi-vte)
  • Tested execution of all binary files (usually in ./result/bin/) (there are no binary files produced by gi-vte)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't edit hackage-packages.nix. See the comment at the top of the file.

@cdepillabout
Copy link
Member Author

Hi @peti, thanks for taking a look at this PR.

I did see the note at the top of hackage-packages.nix, but I didn't see any instructions on how to change the contents of the hackage-packages.nix file. I'm guessing that I need to edit some other file that is used to generate the hackage-packages.nix. I need to make sure the gi-vte package uses the vte system library from Gnome 3.

However, I couldn't figure out which file I actually need to edit. Could you point me in the right direction? Or even link me to some documentation that explains the process of editing the Haskell stuff?

@peti
Copy link
Member

peti commented Aug 6, 2018

All Haskell-related config files reside in https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/haskell-modules.

@cdepillabout cdepillabout force-pushed the fix-gi-vte-haskell-pkg branch 2 times, most recently from f6188a8 to 6071876 Compare August 6, 2018 13:20
@cdepillabout
Copy link
Member Author

@peti, after looking around the files under /pkgs/development/haskell-modules, it looks like what I actually want to do is update the settings for the gi-vte package in pkgs/development/haskell-modules/configuration-nix.nix.

That is just what I've done in the most recent commit. Could you take a look over this and let me know if it looks alright?

@@ -150,6 +150,7 @@ self: super: builtins.intersectAttrs super {

# Add necessary reference to gtk3 package
gi-dbusmenugtk3 = addPkgconfigDepend super.gi-dbusmenugtk3 pkgs.gtk3;
gi-vte = addPkgconfigDepend (super.gi-vte.override { vte = pkgs.gnome3.vte; }) pkgs.gnome3.gtk;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you pass the gnome3 version of vte as an argument, then the call to addPkgconfigDepend is redundant because vte already is listed as a dependency. So the inner override should be enough here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peti thanks for taking another look at this.

If all I do is the inner override of the version of vte (and not the outter addPkgconfigDepend of gtk) then gi-vte gets an error while building:

$ NIX_PATH=".." nix-shell -p "haskellPackages.ghcWithPackages (pkgs: [pkgs.gi-vte])"
these derivations will be built:
  /nix/store/637qv7q7qxpx8l3abx1xbkpk799sg8j7-gi-vte-2.91.17.drv
  /nix/store/anvs1065djl8f5r60vzbzmy3hgbyhymh-ghc-8.4.3-with-packages.drv
building '/nix/store/637qv7q7qxpx8l3abx1xbkpk799sg8j7-gi-vte-2.91.17.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/yc8an71h8cah8w6fw0xykjxl68a8j1h7-ghc-8.4.3.
ignoring (possibly broken) abi-depends field for packages
ignoring (possibly broken) abi-depends field for packages
unpacking sources
unpacking source archive /nix/store/hhikx5nciaprryaym4c47ckydzcvd5m5-gi-vte-2.91.17.tar.gz
source root is gi-vte-2.91.17
setting SOURCE_DATE_EPOCH to timestamp 1515607667 of file gi-vte-2.91.17/Vte.overrides
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/tmp/nix-build-gi-vte-2.91.17.drv-0/setup-package.conf.d -j1 -threaded
[1 of 1] Compiling Main             ( Setup.hs, /tmp/nix-build-gi-vte-2.91.17.drv-0/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/pxwjhxi161hjksgygfqks0z2qr7xava7-gi-vte-2.91.17 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --with-gcc=gcc --package-db=/tmp/nix-build-gi-vte-2.91.17.drv-0/package.conf.d --ghc-option=-j1 --disable-split-objs --enable-library-profiling --profiling-detail=all-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --enable-library-vanilla --enable-library-for-ghci --ghc-option=-split-sections --extra-lib-dirs=/nix/store/3cnh0n698w18l5g933wrx22zvkhcj8ik-ncurses-6.1/lib --extra-lib-dirs=/nix/store/bi9nx8f8kl8apgd544hkx2dsvlvr4zix-gmp-6.1.2/lib --extra-include-dirs=/nix/store/5qizrlg2lvg5y2k9z2y0gjbmndndg6cv-vte-0.52.2/include --extra-lib-dirs=/nix/store/5qizrlg2lvg5y2k9z2y0gjbmndndg6cv-vte-0.52.2/lib --extra-include-dirs=/nix/store/vardkjd0j4ibxs6zkiwywb9zs85jf5ya-gnutls-3.6.2-dev/include --extra-lib-dirs=/nix/store/vardkjd0j4ibxs6zkiwywb9zs85jf5ya-gnutls-3.6.2-dev/lib --extra-include-dirs=/nix/store/jv6ldbzn0mk7hskxkirnbjlpkfig25iv-nettle-3.4-dev/include --extra-lib-dirs=/nix/store/jv6ldbzn0mk7hskxkirnbjlpkfig25iv-nettle-3.4-dev/lib --extra-include-dirs=/nix/store/hfb8mwwdacrdr25y1d1hila5f678x0a7-gmp-6.1.2-dev/include --extra-lib-dirs=/nix/store/bi9nx8f8kl8apgd544hkx2dsvlvr4zix-gmp-6.1.2/lib --extra-lib-dirs=/nix/store/vpq1l5g3m3zqa20ssmhsay68jn0ny8l1-nettle-3.4/lib --extra-lib-dirs=/nix/store/vjkc4y6vp3g76bx6b7vsy69nfayy0m05-gnutls-3.6.2/lib --extra-include-dirs=/nix/store/h7aiis2rjnvxmw0fy98jqrb3z6vwgrzh-pcre2-10.31-dev/include --extra-lib-dirs=/nix/store/h7aiis2rjnvxmw0fy98jqrb3z6vwgrzh-pcre2-10.31-dev/lib --extra-lib-dirs=/nix/store/k4mnyqb8209qqv1ipcfjk9zdbp8bjxpr-pcre2-10.31/lib --extra-include-dirs=/nix/store/9a86wy64xwvq8lhgh5ib46f9gzja9lgi-gobject-introspection-1.56.0-dev/include --extra-lib-dirs=/nix/store/9a86wy64xwvq8lhgh5ib46f9gzja9lgi-gobject-introspection-1.56.0-dev/lib --extra-include-dirs=/nix/store/jx5j4h8szw002ijmlzxl91hglfh08hc1-libffi-3.2.1-dev/include --extra-lib-dirs=/nix/store/jx5j4h8szw002ijmlzxl91hglfh08hc1-libffi-3.2.1-dev/lib --extra-lib-dirs=/nix/store/rlg88dc96j16bycaislwxnki4cyknax9-libffi-3.2.1/lib --extra-include-dirs=/nix/store/l1v16k68v3njjw281fbfk20zxsb52q35-glib-2.56.0-dev/include --extra-lib-dirs=/nix/store/l1v16k68v3njjw281fbfk20zxsb52q35-glib-2.56.0-dev/lib --extra-include-dirs=/nix/store/ggdq1si53c6qb0b67lgx145xkndfy4zy-zlib-1.2.11-dev/include --extra-lib-dirs=/nix/store/ggdq1si53c6qb0b67lgx145xkndfy4zy-zlib-1.2.11-dev/lib --extra-lib-dirs=/nix/store/vm7czzwvpwlsd9hkva2y3pr343vbc4zr-zlib-1.2.11/lib --extra-include-dirs=/nix/store/6rbpcw573mmfjnl3r6gyx9c891yvssnv-gettext-0.19.8.1/include --extra-lib-dirs=/nix/store/6rbpcw573mmfjnl3r6gyx9c891yvssnv-gettext-0.19.8.1/lib --extra-include-dirs=/nix/store/6w9snwl61ppkabn5d30bb6bi03sandf8-glibc-iconv-2.27/include --extra-lib-dirs=/nix/store/ycpkd4jxpy913v6fxf4b5mmy9bz81vsy-glib-2.56.0/lib --extra-lib-dirs=/nix/store/iyzhv8i7q8jfp13mb2ii4012zplihf9y-gobject-introspection-1.56.0/lib
Using Parsec parser
Did not find a GI repository for Gdk-3.0 in ["/nix/store/yc8an71h8cah8w6fw0xykjxl68a8j1h7-ghc-8.4.3/share/gir-1.0","/nix/store/3cnh0n698w18l5g933wrx22zvkhcj8ik-ncurses-6.1/share/gir-1.0","/nix/store/yc8an71h8cah8w6fw0xykjxl68a8j1h7-ghc-8.4.3/share/gir-1.0","/nix/store/5pb4a6hv8lc2vfr44ab4mhbljd500csw-pkg-config-0.29.2/share/gir-1.0","/nix/store/9a86wy64xwvq8lhgh5ib46f9gzja9lgi-gobject-introspection-1.56.0-dev/share/gir-1.0","/nix/store/l1v16k68v3njjw281fbfk20zxsb52q35-glib-2.56.0-dev/share/gir-1.0","/nix/store/vm7czzwvpwlsd9hkva2y3pr343vbc4zr-zlib-1.2.11/share/gir-1.0","/nix/store/6rbpcw573mmfjnl3r6gyx9c891yvssnv-gettext-0.19.8.1/share/gir-1.0","/nix/store/ycpkd4jxpy913v6fxf4b5mmy9bz81vsy-glib-2.56.0/share/gir-1.0","/nix/store/iyzhv8i7q8jfp13mb2ii4012zplihf9y-gobject-introspection-1.56.0/share/gir-1.0",
...

Maybe what I should actually do is is send a PR to the gi-vte package to make sure it says it is also dependent on gtk?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtojnar I'm not super familiar with how cabal2nix works internally, but I'm wondering if that wouldn't actually solve the problem.

It looks like cabal2nix correctly figures out that the vte-2.91 library should be pulled in as gnome2.vte. The problem is that it should actually be gnome3.vte.

Looking around the cabal2nix code base, it appears that where I actually want to change is the resolveInNixpkgs function:

https://github.com/NixOS/cabal2nix/blob/332046536e5175165924046e381d16cf0d8cf551/src/Distribution/Nixpkgs/Haskell/FromCabal.hs#L137-L141

I think I should add a line here with a special case for vte:

| i == "vte"                       = binding # (i, path # ["pkgs","gnome3","vte"])

How does this sound?

@cdepillabout
Copy link
Member Author

cdepillabout commented Aug 9, 2018

I discussed this with the maintainer of gi-vte:

haskell-gi/haskell-gi#183

He suggested that it is actually incorrect that depending on vte does not make the GTK development files visible in the environment. Other Gnome packages appear to work like this (for example, gtk-sourceview), and their corresponding gi-* haskell packages compile correctly (for example, gi-gtksource).

I went digging to figure out the difference between the vte package an gtk-sourceview. It turns out that gtk-sourceview adds gtk to its propagatedBuildInputs, while vte does not. I sent a PR fixing this.

In order to get gi-vte compiling correctly with Nix, the following three things need to be done:

  1. Merge in the PR that adds gtk to the propagatedBuildInputs of vte:

    add gtk3 as propagatedBuildInput to vte #44803

  2. Fix up cabal2nix as discussed above. (I haven't yet sent a PR to do this. I created a PR for this: Add override for the vte system library cabal2nix#368)

  3. Merge in this PR. This PR removes gi-vte from dont-distribute-packages in configuration-hackage2nix.yaml.

    (Originally this PR also changed pkgs/development/haskell-modules/configuration-nix.nix to add some special overrides for gi-vte, but with the two other changes above, this should not be needed.)

cdepillabout added a commit to cdepillabout/cabal2nix that referenced this pull request Aug 9, 2018
Add an override to the vte system library to instead use `gnome3.vte`.
This is similar to how gtk and gtksourceview work.

This was suggested in
NixOS/nixpkgs#44529 (comment).
@cdepillabout
Copy link
Member Author

cdepillabout commented Aug 9, 2018

I just sent a PR to fix cabal2nix: NixOS/cabal2nix#368.

@cdepillabout
Copy link
Member Author

Here is an update:

  1. The PR that adds gtk to the propagatedBuildInputs of vte has been merged in: add gtk3 as propagatedBuildInput to vte #44803

  2. The PR to cabal2nix is still waiting to be merged: Add override for the vte system library cabal2nix#368

  3. This PR is still waiting to be merged in.

@peti
Copy link
Member

peti commented Aug 17, 2018

@jtojnar wrote:

Would not it be better to add vte-2.91 to https://github.com/NixOS/cabal2nix/blob/master/src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs?

That would be a good solution in principle, but unfortunately that name lookup returns a simple identifier (like vte), not a binding (like vte = gnome3.vte). Therefore, we cannot map to gnome3.vte at this place. It would be nice if we could, but alas that's not how the code currently works.

@cdepillabout
Copy link
Member Author

cdepillabout commented Aug 26, 2018

Here is the updated status:

  1. The PR that adds gtk to the propagatedBuildInputs of vte has been merged in: add gtk3 as propagatedBuildInput to vte #44803

  2. The PR to cabal2nix has been merged in: Add override for the vte system library cabal2nix#368

  3. This PR is still waiting to be merged in. It removes gi-vte from the dont-build section of pkgs/development/haskell-modules/configuration-hackage2nix.yaml. Ideally termonad would also be removed from this section.

    I'm not sure of the timing that this PR should be merged in. I think it would probably be best if it was merged in after hackage2nix was run with Add override for the vte system library cabal2nix#368. Hopefully that happens in the next few days, so I can get gi-vte and termonad working before 18.09 is cut.

@basvandijk
Copy link
Member

I'm not sure of the timing that this PR should be merged in. I think it would probably be best if it was merged in after hackage2nix was run with NixOS/cabal2nix#368.

I think it's best to base this PR on the haskell-updates branch. Then it will be merged to master the next time hackage2nix runs.

(In case you don't know how to change the base of this PR: press on the "edit" button besides the PR title and use the "base" combobox)

@cdepillabout cdepillabout changed the base branch from master to haskell-updates August 27, 2018 00:35
@cdepillabout
Copy link
Member Author

Thanks for the advice @basvandijk. I've changed this PR to be based on the haskell-updates branch. Hopefully this will now get merged next time hackage2nix gets run.

@basvandijk
Copy link
Member

Great. Could you also rename your commit according to CONTRIBUTING.md? Something like:

gi-vte: remove from dont-distribute-packages

@cdepillabout
Copy link
Member Author

@basvandijk No problem. I made the recommended change in commit 76943f7.

Sorry for not following the recommendation in CONTRIBUTING.md from the beginning!

@basvandijk basvandijk merged this pull request into NixOS:haskell-updates Aug 27, 2018
@basvandijk
Copy link
Member

Thank you!

@cdepillabout cdepillabout deleted the fix-gi-vte-haskell-pkg branch August 27, 2018 07:49
Profpatsch pushed a commit to Profpatsch/cabal2nix that referenced this pull request Mar 7, 2022
Add an override to the vte system library to instead use `gnome3.vte`.
This is similar to how gtk and gtksourceview work.

This was suggested in
NixOS/nixpkgs#44529 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants