wiki: Add Packaging niri page
Browse files at this commit2261fcb63108b77ec6cdbe251f747505802b5917Parent: 279c8b63 changed files +83 -19
- wiki/Getting-Started.md +1 -19
- wiki/Packaging-niri.md +81 -0
- wiki/_Sidebar.md +1 -0
wiki/Getting-Started.mdmodified+1 -19
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | The easiest way to get niri is to install one of the distribution packages. |
| 2 | 2 | Here are some of them: [Fedora COPR](https://copr.fedorainfracloud.org/coprs/yalter/niri/) and [nightly COPR](https://copr.fedorainfracloud.org/coprs/yalter/niri-git/) (which I maintain myself), [NixOS Flake](https://github.com/sodiboo/niri-flake), and some more from repology below. |
| 3 | -See the [Building](#building) section if you'd like to compile niri yourself. | |
| 3 | +See the [Building](#building) section if you'd like to compile niri yourself and the [Packaging niri](./Packaging-niri.md) page if you want to package niri. | |
| 4 | 4 | |
| 5 | 5 | [](https://repology.org/project/niri/versions) |
| 6 | 6 | |
| @@ -160,24 +160,6 @@ If you're not on NixOS, you may need [NixGL](https://github.com/nix-community/ni | ||
| 160 | 160 | nix run --impure github:guibou/nixGL -- ./results/bin/niri |
| 161 | 161 | ``` |
| 162 | 162 | |
| 163 | -### Packaging | |
| 164 | - | |
| 165 | -The recommended way to package niri is so that it runs as a standalone desktop session. | |
| 166 | -To do that, put files into the correct directories according to this table. | |
| 167 | - | |
| 168 | -| File | Destination | | |
| 169 | -| ---- | ----------- | | |
| 170 | -| `target/release/niri` | `/usr/bin/` | | |
| 171 | -| `resources/niri-session` | `/usr/bin/` | | |
| 172 | -| `resources/niri.desktop` | `/usr/share/wayland-sessions/` | | |
| 173 | -| `resources/niri-portals.conf` | `/usr/share/xdg-desktop-portal/` | | |
| 174 | -| `resources/niri.service` (systemd) | `/usr/lib/systemd/user/` | | |
| 175 | -| `resources/niri-shutdown.target` (systemd) | `/usr/lib/systemd/user/` | | |
| 176 | -| `resources/dinit/niri` (dinit) | `/usr/lib/dinit.d/user/` | | |
| 177 | -| `resources/dinit/niri-shutdown` (dinit) | `/usr/lib/dinit.d/user/` | | |
| 178 | - | |
| 179 | -Doing this will make niri appear in GDM and other display managers. | |
| 180 | - | |
| 181 | 163 | ### Manual Installation |
| 182 | 164 | |
| 183 | 165 | If installing directly without a package, the recommended file destinations are slightly different. |
wiki/Packaging-niri.mdadded+81 -0
| @@ -0,0 +1,81 @@ | ||
| 1 | +### Overview | |
| 2 | + | |
| 3 | +When building niri, check `Cargo.toml` for a list of build features. | |
| 4 | +For example, you can replace systemd integration with dinit integration using `cargo build --release --no-default-features --features dinit,dbus,xdp-gnome-screencast`. | |
| 5 | +The defaults however should work fine for most distributions. | |
| 6 | + | |
| 7 | +> [!WARNING] | |
| 8 | +> Do NOT build with `--all-features`! | |
| 9 | +> | |
| 10 | +> Some features are meant only for development use. | |
| 11 | +> For example, one of the features enables collection of profiling data into a memory buffer that will grow indefinitely until you run out of memory. | |
| 12 | + | |
| 13 | +The `niri-visual-tests` sub-crate/binary is development-only and should not be packaged. | |
| 14 | + | |
| 15 | +The recommended way to package niri is so that it runs as a standalone desktop session. | |
| 16 | +To do that, put files into the correct directories according to this table. | |
| 17 | + | |
| 18 | +| File | Destination | | |
| 19 | +| ---- | ----------- | | |
| 20 | +| `target/release/niri` | `/usr/bin/` | | |
| 21 | +| `resources/niri-session` | `/usr/bin/` | | |
| 22 | +| `resources/niri.desktop` | `/usr/share/wayland-sessions/` | | |
| 23 | +| `resources/niri-portals.conf` | `/usr/share/xdg-desktop-portal/` | | |
| 24 | +| `resources/niri.service` (systemd) | `/usr/lib/systemd/user/` | | |
| 25 | +| `resources/niri-shutdown.target` (systemd) | `/usr/lib/systemd/user/` | | |
| 26 | +| `resources/dinit/niri` (dinit) | `/usr/lib/dinit.d/user/` | | |
| 27 | +| `resources/dinit/niri-shutdown` (dinit) | `/usr/lib/dinit.d/user/` | | |
| 28 | + | |
| 29 | +Doing this will make niri appear in GDM and other display managers. | |
| 30 | + | |
| 31 | +### Panics | |
| 32 | + | |
| 33 | +Good panic backtraces are required for diagnosing niri crashes. | |
| 34 | +Please use the `niri panic` command to test that your package produces good backtraces. | |
| 35 | + | |
| 36 | +``` | |
| 37 | +$ niri panic | |
| 38 | +thread 'main' panicked at /builddir/build/BUILD/rust-1.83.0-build/rustc-1.83.0-src/library/core/src/time.rs:1142:31: | |
| 39 | +overflow when subtracting durations | |
| 40 | +stack backtrace: | |
| 41 | + 0: rust_begin_unwind | |
| 42 | + at /builddir/build/BUILD/rust-1.83.0-build/rustc-1.83.0-src/library/std/src/panicking.rs:665:5 | |
| 43 | + 1: core::panicking::panic_fmt | |
| 44 | + at /builddir/build/BUILD/rust-1.83.0-build/rustc-1.83.0-src/library/core/src/panicking.rs:74:14 | |
| 45 | + 2: core::panicking::panic_display | |
| 46 | + at /builddir/build/BUILD/rust-1.83.0-build/rustc-1.83.0-src/library/core/src/panicking.rs:264:5 | |
| 47 | + 3: core::option::expect_failed | |
| 48 | + at /builddir/build/BUILD/rust-1.83.0-build/rustc-1.83.0-src/library/core/src/option.rs:2021:5 | |
| 49 | + 4: expect<core::time::Duration> | |
| 50 | + at /builddir/build/BUILD/rust-1.83.0-build/rustc-1.83.0-src/library/core/src/option.rs:933:21 | |
| 51 | + 5: sub | |
| 52 | + at /builddir/build/BUILD/rust-1.83.0-build/rustc-1.83.0-src/library/core/src/time.rs:1142:31 | |
| 53 | + 6: cause_panic | |
| 54 | + at /builddir/build/BUILD/niri-0.0.git.1699.279c8b6a-build/niri/src/utils/mod.rs:382:13 | |
| 55 | + 7: main | |
| 56 | + at /builddir/build/BUILD/niri-0.0.git.1699.279c8b6a-build/niri/src/main.rs:107:27 | |
| 57 | + 8: call_once<fn() -> core::result::Result<(), alloc::boxed::Box<dyn core::error::Error, alloc::alloc::Global>>, ()> | |
| 58 | + at /builddir/build/BUILD/rust-1.83.0-build/rustc-1.83.0-src/library/core/src/ops/function.rs:250:5 | |
| 59 | +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. | |
| 60 | +``` | |
| 61 | + | |
| 62 | +Important things to look for: | |
| 63 | + | |
| 64 | +- The panic message is there: "overflow when subtracting durations". | |
| 65 | +- The backtrace goes all the way up to `main` and includes `cause_panic`. | |
| 66 | +- The backtrace includes the file and line number for `cause_panic`: `at /.../src/utils/mod.rs:382:13` | |
| 67 | + | |
| 68 | +If possible, please ensure that your niri package on its own has good panics, i.e. *without* installing debuginfo or other packages. | |
| 69 | +The user likely won't have debuginfo installed when their compositor first crashes, and we really want to be able to diagnose and fix all crashes right away. | |
| 70 | + | |
| 71 | +### Rust dependencies | |
| 72 | + | |
| 73 | +Every niri release comes with a vendored dependencies archive from `cargo vendor`. | |
| 74 | +You can use it to build the corresponding niri release completely offline. | |
| 75 | + | |
| 76 | +If you don't want to use vendored dependencies, consider following the niri release's `Cargo.lock`. | |
| 77 | +It contains the exact dependency versions that I used when testing the release. | |
| 78 | + | |
| 79 | +If you need to change the versions of some dependencies, pay extra attention to `smithay` and `smithay-drm-extras` commit hash. | |
| 80 | +These crates don't currently have regular stable releases, so niri uses git snapshots. | |
| 81 | +Upstream frequently has breaking changes (API and behavior), so you're strongly advised to use the exact commit hash from the niri release's `Cargo.lock`. |
wiki/_Sidebar.mdmodified+1 -0
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | * [Application-Specific Issues](./Application-Issues.md) |
| 9 | 9 | * [Xwayland](./Xwayland.md) |
| 10 | 10 | * [Gestures](./Gestures.md) |
| 11 | +* [Packaging niri](./Packaging-niri.md) | |
| 11 | 12 | * [FAQ](./FAQ.md) |
| 12 | 13 | |
| 13 | 14 | ## Configuration |