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

mir: init at 2.11.0 #207534

Closed
wants to merge 2 commits into from
Closed

mir: init at 2.11.0 #207534

wants to merge 2 commits into from

Conversation

onny
Copy link
Contributor

@onny onny commented Dec 24, 2022

Description of changes

Packaging Canonicals display server Mir https://github.com/MirServer/mir

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

pkgs/servers/mir/default.nix Show resolved Hide resolved
pkgs/servers/mir/default.nix Outdated Show resolved Hide resolved
@AndersonTorres
Copy link
Member

Somewhat related:

#99090

@SuperSandro2000
Copy link
Member

This PR rebuilds a lot of packages which means we must target staging. Please follow the contributing guide to not potentially ping a lot of people.

Copy link
Contributor

@OPNA2608 OPNA2608 left a comment

Choose a reason for hiding this comment

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

Thanks for looking into continuing the Lomiri stuff 😄! Some feedback on the Mir packaging here:

It's not of a high priority but there may be some docs that could be built:

-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) (Required is at least version "1.8.0")

Some more patching seems to be needed:

[ 27%] Generating drm-formats
grep: /var/empty/include/libdrm/drm_fourcc.h: No such file or directory
[ 28%] Generating drm-formats-big-endian
grep: /var/empty/include/libdrm/drm_fourcc.h: No such file or directory

I think these paths here need to be patched to go somewhere into libdrm: https://github.com/MirServer/mir/blob/2a130a264fb68188ea6ea699744e32ab7b25432c/src/platform/graphics/CMakeLists.txt#L51-L95. Trying to run the demos errors on some DRM stuff for me, might be related to this.

-- Installing: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/graphics-gbm-kms.so.20
-- Set runtime path of "/nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/graphics-gbm-kms.so.20" to ""
-- Installing: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/server-x11.so.20
-- Installing: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/graphics-eglstream-kms.so.20
-- Installing: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/graphics-wayland.so.20
-- Installing: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/input-evdev.so.8
[2022-12-25 23:06:34.802902] <information> mircommon: Loading modules from: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0//nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform
[2022-12-25 23:06:34.803228] <information> mircommon: Loading module: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0//nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/graphics-gbm-kms.so.20
[2022-12-25 23:06:34.803422] <information> mircommon: Loading module: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0//nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/server-x11.so.20
[2022-12-25 23:06:34.803509] <information> mircommon: Loading module: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0//nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/graphics-eglstream-kms.so.20
[2022-12-25 23:06:34.803581] <information> mircommon: Loading module: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0//nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/graphics-wayland.so.20
[2022-12-25 23:06:34.803644] <information> mircommon: Loading module: /nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0//nix/store/rq0nihx42jqc7sc7dw4gm99y0h15ak40-mir-2.10.0/lib/mir/server-platform/input-evdev.so.8

Not sure where this needs to be patched but /nix/store/.../nix/store/...-y paths look like something's broken.

@onny onny changed the base branch from master to staging December 26, 2022 14:10
@onny
Copy link
Contributor Author

onny commented Dec 26, 2022

Thank you so far for reviewing and helping with this PR :)

@OPNA2608 I fixed the issues you mentioned, thank you for noticing!

@onny onny requested a review from OPNA2608 December 26, 2022 15:49
@OPNA2608
Copy link
Contributor

I don't have any knowledge about Mir so I can't judge if everything works & is configured correctly, but it seems like a demo atop your current display server with your preferred terminal emulator can be started with the following (replace kitty with whatever terminal you wish to use ofc, YMMV):

miral-app -kiosk -terminal kitty

FWIW it seems to launch:

SimpleScreenRecorder-2022-12-27_00.17.10.mp4

@onny
Copy link
Contributor Author

onny commented Dec 27, 2022

Thank you so much for the feedback :) Added the requested changes

Copy link
Contributor

@OPNA2608 OPNA2608 left a comment

Choose a reason for hiding this comment

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

The order of commits should be fixed: First eglexternalplatform, then mir.

Starting to run out of suggestions for things that could be improved, I promise! 😄

Some notes on all the Mir stuff, after toying around with it abit more:


The miral-app script wants inotify-tools so it can nicely wait for things to appear in the background. I don't know if this script matters to how Lomiri will be launched, might make sense to patch it in:

↪ /nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app -kiosk -terminal kitty
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
/nix/store/wa9fkqzb10zfxlymg11z115mfb058fyk-mir-2.10.0/bin/miral-app: line 87: inotifywait: command not found
[2022-12-28 15:44:24.815614] <information> mirserver: Starting

The miral-terminal script is supposed to check for a range of different terminal emulators and launch one as the terminal inside Mir, on my system it can find none.

for terminal in gnome-terminal.real gnome-terminal weston-terminal qterminal lxterminal x-terminal-emulator xdg-terminal

I use none of the named terminals there. x-terminal-emulator is Debianism for their alternatives system where you would register your preferred terminal emulator. xdg-terminal… I don't know what that is.
xterm doesn't launch reliably. In kiosk mode it can't find a DISPLAY, likely because it doesn't use Xwayland there. Not sure how this should be handled. For now, miral-app -terminal <terminal> lets you override miral-terminal with whatever you wish to use instead.


(Mir? miral-shell?) seems to need a full path to Xwayland, else it won't launch. Looks like the default for this is set here. Don't know if we should ultimately just hardcode an Xwayland into there or work around this via some more configurable way (if there is one):

Mir fatal error: Cannot execute Xwayland: --xwayland-path /usr/bin/Xwayland
Aborted (core dumped)

It also expects Ubuntu's cursor themes to be present:

[2022-12-28 16:49:41.945210] < -warning- > miral: Failed to load cursor theme: default
[2022-12-28 16:49:41.945302] < -warning- > miral: Failed to load cursor theme: DMZ-White
ERROR: /build/source/src/miral/cursor_theme.cpp(74): Throw in function miral::CursorTheme::operator()(mir::Server&) const::<lambda()>
Dynamic exception type: boost::wrapexcept<std::runtime_error>
std::exception::what: Failed to load cursor theme: default:DMZ-White

AFAICT we actually have them packaged under vanilla-dmz? Or at least we're using the correct source there, but instead of installing them as DMZ-White and DMZ-Black they're called Vanilla-DMZ and Vanilla-DMZ-AA respectively… Not sure if there's a reason for that.

As a test I've tried to symlink them to the names they should have, adding them to XCURSOR_PATH in a nix-shell and using --xwayland-path. This seems to make Mir much happier and miral-shell usable (via miral-app wrapper due to the miral-terminal stuff):

SimpleScreenRecorder-2022-12-28_16.56.51.mp4

On a tty as well:

image

And on aarch64-linux hardware:

image

pkgs/servers/mir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/mir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/mir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/mir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/mir/default.nix Outdated Show resolved Hide resolved

stdenv.mkDerivation rec {
pname = "mir";
version = "2.10.0";
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC QtMir used to be stuck on Mir 1.x back when I attempted this because 2.x removed some APIs that were required by the integration. Do you know if this been resolved since then? If you run into problems later down the line with QtMir / Lomiri, you may also have to additionally / instead package Mir 1.8.2 (or a later 1.x entry if one ends up being released) if that's not the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh you're right, good point canonical/mir#1744

I guess we'll have to add Mir 1.X with qtmir in a separate PR. Since Mir can be used outside of qtmir, we would start here with package the most recent version

pkgs/servers/mir/default.nix Outdated Show resolved Hide resolved
pkgs/servers/mir/default.nix Show resolved Hide resolved
pkgs/development/libraries/eglexternalplatform/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/eglexternalplatform/default.nix Outdated Show resolved Hide resolved
@OPNA2608
Copy link
Contributor

OPNA2608 commented Jan 6, 2023

#207534 (comment) about the nativeBuildInputs and buildInputs stuff aside, the commit order is still wrong. The mir commit depends on eglexternalplatform before the eglexternalplatform commit moved it out of egl-wayland.

Those are the only nitpick I can think of, LGTM otherwise. I got wlcs packaged on master and Mir's tests working in a branch (which address the Xwayland point from earlier out of necessity), can PR that once this lands.

phossil added a commit to phossil/nixfiles that referenced this pull request Jan 14, 2023
[NixOS/nixpkgs | mir: init at 2.10.0](NixOS/nixpkgs#207534)
Comment on lines +53 to +58
# Fix error broken path found in pc file ("//")
for f in $(find . -name '*.pc.in') ; do
substituteInPlace $f \
--replace "/@CMAKE_INSTALL_LIBDIR@" "@CMAKE_INSTALL_LIBDIR@" \
--replace "/@CMAKE_INSTALL_INCLUDEDIR@" "@CMAKE_INSTALL_INCLUDEDIR@"
done
Copy link
Contributor

Choose a reason for hiding this comment

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

While trying to build something that depends on Mir we noticed that the paths are still broken, just not broken enough for the pkg-config check to notice:

prefix=/nix/store/yr3jc3213w1y3f1kc7ppa1a5yx0xng4y-mir-2.10.0
libdir=${prefix}/nix/store/yr3jc3213w1y3f1kc7ppa1a5yx0xng4y-mir-2.10.0/lib
includedir=/nix/store/vzy7w5yqi6y5z5qjpiyq1yfpjpxkzk6i-mir-2.10.0-dev/nix/store/vzy7w5yqi6y5z5qjpiyq1yfpjpxkzk6i-mir-2.10.0-dev/include/miral

I think for our purposes, replacing all ${prefix}/@CMAKE_INSTALL_<dir>@ with @CMAKE_INSTALL_FULL_<dir>@ etc might be fine:

prefix=/nix/store/q4921w10hjmpk28dkk1c4y1c5fy33fcy-mir-2.10.0
libdir=/nix/store/q4921w10hjmpk28dkk1c4y1c5fy33fcy-mir-2.10.0/lib
includedir=/nix/store/ird024yncpxv3rlz42grx8i4g3s891s4-mir-2.10.0-dev/include/miral

The more proper fix being something like jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files being done upstream.

Copy link
Member

Choose a reason for hiding this comment

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

being done upstream.

Should we @-mark them?

Copy link
Contributor

Choose a reason for hiding this comment

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

I PR'd the same fix to their wlcs project recently (first with FULL, now with jtojnar's snippet), guess I could do the same for Mir & link it here for fetchpatching.

Copy link
Contributor

Choose a reason for hiding this comment

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

canonical/mir#2786, should be cherry-pickable onto 2.11.0.

@OPNA2608
Copy link
Contributor

New release about a week ago: v2.11.0

@onny onny changed the title mir: init at 2.10.0 mir: init at 2.11.0 Jan 15, 2023
@onny
Copy link
Contributor Author

onny commented Jan 15, 2023

New release about a week ago: v2.11.0

Thanks for the note, updated it to the latest version and changed the commit order. For the other issues, I'll have to look more into it.
Feel free to push into this PR or continue it separately :)

@phossil
Copy link
Contributor

phossil commented Jan 16, 2023

Mir provides a wayland session file that can be added with passthru.providedSessions = [ "mir-shell" ];.

20230115_212127

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.

5 participants