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
package GNOME Builder #44217
package GNOME Builder #44217
Conversation
c593094
to
126f205
Compare
Since @jtojnar cherry-picked the other version of jsonrpc-glib and template-glib onto master today, I've rebased this PR dropping my commits that packaged those libraries. I had to make a minor fix to my gnome-builder packaging as a result but this version works just as well for me too. |
Sounds good.
What do you mean?
I am all for it if upstream accepts it.
I like to make everything explicit in patches because they make it easier to track changes but I agree that there are downsides. Instead of patch, we could also use something like
We could make the binpath overridable and have a |
sha256 = "0ibb74jlyrl5f6rj1b74196zfg2qaf870lxgi76qzpkgwq0iya05"; | ||
}; | ||
|
||
buildInputs = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependencies used for build should go to nativeBuildInputs
.
]; | ||
|
||
prePatch = '' | ||
sed -i 's@/usr/bin/env python3@${python3}/bin/python3@g' build-aux/meson/post_install.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have patchShebangs
function for this, see #33270
meta = with stdenv.lib; { | ||
description = "An IDE for writing GNOME-based software"; | ||
homepage = https://wiki.gnome.org/Apps/Builder; | ||
license = licenses.gpl3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preFixup = '' | ||
buildPythonPath "$out $pythonPath" | ||
gappsWrapperArgs+=( | ||
--prefix PATH : "$program_PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what $program_PATH
is for, should not fixing shebangs be enough?
meta = with stdenv.lib; { | ||
description = "An IDE for writing GNOME-based software"; | ||
homepage = https://wiki.gnome.org/Apps/Builder; | ||
license = licenses.gpl3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add maintainers = gnome3.maintainers
mesonFlags = [ | ||
"-Dpython_libprefix=${python3.libPrefix}" | ||
"-Dwith_clang=false" | ||
"-Dwith_flatpak=false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is not flatpak enabled?
''; | ||
|
||
patches = [ | ||
./python-libprefix.patch | ||
./flatpak-deps.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you send this upstream and add a comment with a link here?
d961006
to
7bd3ca4
Compare
I've just submitted some patches upstream toward this effort, and we'll see what the maintainers think: https://gitlab.gnome.org/GNOME/gnome-builder/merge_requests/86 I've pushed an additional commit to this PR that I think addresses all your review comments, although I'm still not sure how to tell whether a dependency is only needed at build-time or also at run-time, so I might still have the buildInputs and nativeBuildInputs split incorrectly. Anyway, feel free to squash the branch if you want. I'd disabled flatpak because it didn't build (and I'll point out that #33270 also disabled flatpak) but it turns out a minor patch fixes that, so it's enabled now. I've added that to my upstream merge request too. The problem I observed with the environment getting cleared is that when I have a project open in Builder, clicking the "Build" button fails because it can't find programs like pkg-config. But opening a terminal inside Builder and running the same build command succeeds. So I think Builder sets up the environment differently for build commands that it runs. And in fact there's a I've been talking with Christian Hergert about some of the issues I've been having, and regarding the build environment problem, he suggests:
I think that may be something I can tackle... |
pythonPath = with python3Packages; requiredPythonModules [ pygobject3 ]; | ||
|
||
preFixup = '' | ||
buildPythonPath "$out $pythonPath" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what the difference between buildPythonPath
and python.withPackages
is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#33270 used with python3.pkgs; makePythonPath
instead of my combination of with python3Packages; requiredPythonModules
and the buildPythonPath
shell function. My way is probably worse but I had thought I needed the $program_PATH
that it built for me.
There is one tricky thing though that might force keeping this approach, I guess? We need the Python import path to include $out/lib/python*/site-packages
, not just the site-packages directories from other Python packages, so that the gi/overrides modules that gnome-builder installs are available when it runs.
I'm not sure if there's any way to include the current derivation's $out in its own PYTHONPATH except by passing "$out"
to buildPythonPath
...?
# We want to find the subdirectory to install our override into: | ||
+python_libprefix = get_option('python_libprefix') | ||
+if python_libprefix != '' | ||
+ pygobject_override_dir = join_paths(get_option('libdir'), python_libprefix, 'site_packages', 'gi', 'overrides') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
site_packages
should contain dash, not underscore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um. That's true. Why did this work...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, it did not for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I guess the only plugin that actually needed gi/overrides/Ide.py
was the jedi_plugin
, and I ignored the error message from that because everything else was working fine. But getting the path correct fixes that error.
desktop-file-utils | ||
]; | ||
|
||
buildInputs = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are missing hicolor-icon-theme
, see #43926
|
||
appstream-glib | ||
desktop-file-utils | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike #33270, this package does not make docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't investigated what these were for, I just saw they were optional but not found so I added them. Looks like they aren't about documentation, they're just there to validate that various static files are correctly formatted. You're right, we don't need them at package-build time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that gtk-doc and the docbook deps were missing. appstream-glib is used during build for checking the generated flle: https://gitlab.gnome.org/GNOME/gnome-builder/blob/23e2dc8347d00c2d0d909809b9c965c84ba08752/data/meson.build#L28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. But appstream-glib and desktop-file-utils are only used in tests, and with doCheck
unspecified, we aren't actually running the tests, are we? I mean, maybe we should be, but the other PR didn't either. I'm going to try a build with doCheck = true
...
Hmm, turns out desktop-file-utils is actually required by build-aux/meson/post_install.py
as well, so I definitely can't remove that.
Anyway, I'm turning on the documentation building too. I didn't think it was particularly important since it's only documentation for gnome-builder's plugin API, but I guess that's worth having.
Should we have multiple outputs for this package? I can see value in some combination of 'lib', 'dev', and 'devdoc'...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, maybe we should be, but the other PR didn't either.
Yes, if there are tests, we should try to enable them.
I didn't think it was particularly important since it's only documentation for gnome-builder's plugin API, but I guess that's worth having.
Yup, offline docs are useful for devhelp (if we figure out why it does not work).
Should we have multiple outputs for this package? I can see value in some combination of 'lib', 'dev', and 'devdoc'...
out
and doc
/devdoc
make sense for apps. lib
and dev
only if the package contains a library that is expected to be a dependency of other packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validating the appstream files requires connecting to the internet (?!) so that test will definitely fail under Nix, and we probably just shouldn't install appstream-glib
. Several other tests fail with this message:
00:06:10.0290 ide-application[ 26893]: WARNING: Cannot enable Python 3 plugins: Typelib file for namespace 'Vte', version '2.91' not found
(I know that says it's only a warning, but it's the only output reported from the failing tests.)
I'm confused because gnome3.vte is already in buildInputs
, and according to the test suite's dump of the environment for failing tests, GI_TYPELIB_PATH
lists several other packages that are in buildInputs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validating the appstream files requires connecting to the internet
Weird, it really should not. We have plenty of other apps that validate appstream files without any issues.
I'm confused because gnome3.vte is already in
buildInputs
, and according to the test suite's dump of the environment for failing tests,GI_TYPELIB_PATH
lists several other packages that are inbuildInputs
.
Maybe it is some env clean-up again. Could you push the changes, I would like to take a look.
I also tried turning on the tests, but they don't work and I don't understand why not.
Hooray, my upstream merge request has been rebased and merged onto master! I think that was early enough to get in before the 3.30 release freeze, so hopefully those patches will be in the next stable release. But I don't actually understand the GNOME release cycle... 😅 The patches in this branch are now exactly the patches that are on master upstream, which I hope will make them easy to evaluate when upgrading. I'm never quite sure when GitHub sends notifications, either. Did it tell you that I pushed my changes so far when you asked for them an hour ago, or should I have written a comment saying so...? |
Hah, it looks like neither this package nor #33270 actually managed to get the gtk-doc output into |
Also the documentation totally didn't build correctly because it tried to get the Docbook DTDs from the internet since neither of us had pulled in And then once I fixed that, there was a locale problem in the Meson driver for gtkdoc. Blech. But I can read the generated HTML documentation now, which is nice because the online copy is several major releases old. |
@@ -73,6 +73,8 @@ in stdenv.mkDerivation { | |||
webkitgtk | |||
]; | |||
|
|||
outputDevdoc = "out"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just use devdoc output his is optional.
Simple build fixes are unaffected by the freezes: https://wiki.gnome.org/ReleasePlanning/Freezes
I would use
I am not sure either, this time I received a notification but sometimes I do not. The difference seems to be that other projects use |
These patches were merged to master so we can fetch them from the GNOME GitLab instance now.
Okay, as suggested I used |
@@ -0,0 +1,29 @@ | |||
From 6d2edb1635465dc226bc7e05fd33c9ee456e2430 Mon Sep 17 00:00:00 2001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These patches can be removed.
done | ||
''; | ||
|
||
#doCheck = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment why this is disabled.
|
||
mesonFlags = [ | ||
"-Dpython_libprefix=${python3.libPrefix}" | ||
"-Dwith_clang=false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment why this is disabled.
I tried running it with Also, since we have decided to use it with |
Do you think the comment explaining why it doesn't work without a nix-shell should go in |
Some people prefer it there, as it it visible on the package list on the website. Other people grep nixpkgs repo and comment on the top is more convenient for them. There is not any preferrence as fair as I know. |
We could put the whole |
Including a comment about the need for additional runtime dependencies.
Okay, I've pushed a |
I find having |
Do you mean having meta at the top of the file is non standard? Although I think there's actually a good argument for doing that, I wasn't seriously suggesting it. I left meta at the bottom as is normal elsewhere. |
Yep, that was I meant. I have seen it in an expression or two but it is highly irregular and consistency is probably more important. |
license = licenses.gpl3Plus; | ||
maintainers = gnome3.maintainers; | ||
platforms = platforms.linux; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove the trailing space here?
Also, do you have any idea how to fix the jedi thing? |
Okay that took a lot of effort to track down, but the jedi thing is that nixpkgs has too new of a version of jedi for this version of gnome-builder. It should be fixed when gnome-builder 3.30 is released, as far as I can tell. Also, that version of gnome-builder will print the actual exception in addition to the "jedi not found" message, which would have made troubleshooting this a whole lot easier. We could just disable building the jedi plugin with a comment that it can be re-enabled in 3.30, if you like? (I also fixed the whitespace, thanks for pointing that out.) |
Thanks so much for merging this, @jtojnar! By the way, I just discovered a one-line kludge that allows me to actually compile things with Builder, so long as my environment was set up correctly before I launched Builder:
I'm pretty sure they'll never take this patch upstream. I'm not even sure it's a good idea in Nix. But at least it highlights precisely where I've been having trouble. I'll still see if I can implement Christian Hergert's suggestion, of writing a plugin that allows a project to set its own environment, whether that's via nix-shell or direnv or whatever. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-install-gnome-sdk-dev-dependencies/5599/2 |
Motivation for this change
This is my second try, replacing #44187, after @jtojnar pointed out there was a prior attempt in #33270 and that my previous attempt broke a bunch of other packages.
After very carefully reading 1dba3c0, #37381, and the commit history for
pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch
, I finally figured out that I just needed to patchsrc/libide/meson.build
to replacepkglibdir
withpkglibdir_abs
instead of messing around with changes to thegobjectIntrospection
package. So this PR is based against master instead of staging, since it only introduces new packages.This build works okay for me except that Builder seems to carefully clear the environment before running build steps, which is a behavior that I think needs to be patched somehow. I'm not sure how yet.
I think this PR is better in some ways than #33270; it's possible some hybrid of the two would be best. In particular, I'm more fond of my approach of passing the Nix value
python3.libPrefix
(which currently evaluates to "python3.6") in as a Meson config option rather than substitutingpython3.sitePackages
into a patch. One advantage is that I think my patch could be accepted upstream, possibly with whitespace changes. Also it doesn't run a Python command whose result it then ignores.#33270 also patched all the plugins to use hard-coded paths, which is a very invasive patch, and difficult to verify that it's correct. I see what problem that exists to solve, but I'm wondering if there's an easier way... If that's the best we can do, it's probably not hard to apply that patch to my branch too.
My suspicion is, though, that upstream Builder should do a better job of handling per-project environment variables, possibly by supporting tools like https://direnv.net/ (or nix-shell directly). Then if you want to use a particular plugin with a particular project, you'd include that plugin's dependencies in your project's environment. That should help keep the closure for Builder be not quite so huge...
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)