diff --git a/crates/weft-servo-shell/src/main.rs b/crates/weft-servo-shell/src/main.rs index d659cb1..88a997c 100644 --- a/crates/weft-servo-shell/src/main.rs +++ b/crates/weft-servo-shell/src/main.rs @@ -37,12 +37,17 @@ fn run() -> anyhow::Result<()> { embed_servo(&wayland_display, &html_path, ws_port) } +/// Where the weft-servo-shell package installs the system UI page; +/// `infra/systemd/servo-shell.service` relies on it. +const PACKAGED_SYSTEM_UI: &str = + "/packages/system/weft-servo-shell/active/share/weft/shell/system-ui.html"; + fn system_ui_html_path() -> anyhow::Result { if let Ok(p) = std::env::var("WEFT_SYSTEM_UI_HTML") { return Ok(PathBuf::from(p)); } - let packaged = PathBuf::from("/packages/system/servo-shell/active/share/weft/system-ui.html"); + let packaged = PathBuf::from(PACKAGED_SYSTEM_UI); if packaged.exists() { return Ok(packaged); } diff --git a/docs/building.md b/docs/building.md index fca337a..9a4a6d6 100644 --- a/docs/building.md +++ b/docs/building.md @@ -139,7 +139,13 @@ Run with QEMU: bash infra/vm/run.sh ``` -See `infra/nixos/weft-packages.nix` for the package derivations. Its `outputHashes` hold one hash per git source in `Cargo.lock` (the Servo and Stylo forks); every package vendors them, so they must match the pinned revisions for any Nix package to build. The Nix shell packages do not yet enable `servo-embed`. +See `infra/nixos/weft-packages.nix` for the package derivations. Its `outputHashes` hold one hash per git source in `Cargo.lock` (the Servo and Stylo forks); every package vendors them, so they must match the pinned revisions for any Nix package to build. + +The VM's user session starts `weft-compositor`, `weft-servo-shell` with the system UI page its package installs, and `weft-appd` with the runtime, app shell, file portal and mount helper packages. The image is not yet bootable to a working desktop: + +- the Servo source hash in `outputHashes` is still a placeholder, so no package builds until a Nix build reports it; +- the shell packages do not enable `servo-embed`, so `weft-servo-shell` and `weft-app-shell` exit at startup; +- the shell's service names the compositor's socket `wayland-1`, the first name the compositor tries, rather than learning it. ## CI diff --git a/infra/nixos/configuration.nix b/infra/nixos/configuration.nix index 5a6a3bb..17a66c2 100644 --- a/infra/nixos/configuration.nix +++ b/infra/nixos/configuration.nix @@ -96,6 +96,7 @@ wantedBy = [ "graphical-session.target" ]; environment = { WAYLAND_DISPLAY = "wayland-1"; + WEFT_SYSTEM_UI_HTML = "${pkgs.weft.weft-servo-shell}/share/weft/shell/system-ui.html"; }; serviceConfig = { Type = "simple"; @@ -109,6 +110,7 @@ description = "WEFT Application Daemon"; requires = [ "weft-compositor.service" ]; after = [ "weft-compositor.service" "weft-servo-shell.service" ]; + wantedBy = [ "graphical-session.target" ]; serviceConfig = { Type = "notify"; ExecStart = "${pkgs.weft.weft-appd}/bin/weft-appd"; @@ -116,6 +118,7 @@ RestartSec = "1s"; Environment = [ "WEFT_RUNTIME_BIN=${pkgs.weft.weft-runtime}/bin/weft-runtime" + "WEFT_APP_SHELL_BIN=${pkgs.weft.weft-app-shell}/bin/weft-app-shell" "WEFT_FILE_PORTAL_BIN=${pkgs.weft.weft-file-portal}/bin/weft-file-portal" "WEFT_MOUNT_HELPER=${pkgs.weft.weft-mount-helper}/bin/weft-mount-helper" ]; diff --git a/infra/nixos/weft-packages.nix b/infra/nixos/weft-packages.nix index f3a7ffc..7a86106 100644 --- a/infra/nixos/weft-packages.nix +++ b/infra/nixos/weft-packages.nix @@ -26,8 +26,8 @@ let nativeBuildInputs = with pkgs; [ pkg-config ]; }; - mkWeftPkg = { pname, extraBuildInputs ? [], extraNativeBuildInputs ? [], cargoFlags ? [], extraEnv ? {}, preBuild ? "" }: rustPlatform.buildRustPackage (commonArgs // { - inherit pname preBuild; + mkWeftPkg = { pname, extraBuildInputs ? [], extraNativeBuildInputs ? [], cargoFlags ? [], extraEnv ? {}, preBuild ? "", postInstall ? "" }: rustPlatform.buildRustPackage (commonArgs // { + inherit pname preBuild postInstall; cargoBuildFlags = [ "--package" pname ] ++ cargoFlags; cargoTestFlags = [ "--package" pname ]; buildInputs = extraBuildInputs; @@ -50,6 +50,10 @@ in { weft-servo-shell = mkWeftPkg { pname = "weft-servo-shell"; + # The system UI page, at the path the shell's units name. + postInstall = '' + install -Dm644 infra/shell/system-ui.html $out/share/weft/shell/system-ui.html + ''; }; weft-app-shell = mkWeftPkg { diff --git a/infra/systemd/servo-shell.service b/infra/systemd/servo-shell.service index e44cf9d..e87141e 100644 --- a/infra/systemd/servo-shell.service +++ b/infra/systemd/servo-shell.service @@ -8,8 +8,9 @@ After=weft-compositor.service Type=simple PassEnvironment=WAYLAND_DISPLAY XDG_RUNTIME_DIR DISPLAY Environment=WEFT_APPD_WS_PORT=7410 -ExecStart=/packages/system/weft-servo-shell/active/bin/weft-servo-shell \ - /packages/system/weft-servo-shell/active/share/weft/shell/system-ui.html +# The page is the package's share/weft/shell/system-ui.html; set +# WEFT_SYSTEM_UI_HTML to use another. +ExecStart=/packages/system/weft-servo-shell/active/bin/weft-servo-shell Restart=on-failure RestartSec=2