WEFT_OS/infra/nixos/weft-packages.nix
Marco Allegretti 5db3d1ddce
fix(nixos): start weft-appd and give the session its shell page and app shell
The reference session could not show the system UI or open an app, even
with every package built:

- weft-servo-shell ignores command-line arguments, yet
  infra/systemd/servo-shell.service passed it the page path, and the
  binary's packaged fallback named a path no package provides. The
  Nix package did not install the page and its NixOS service did not
  name it either, so the shell exited at startup.
- The NixOS weft-appd user service was wanted by nothing, so it never
  started, and it had no WEFT_APP_SHELL_BIN, so every launch would stop
  before its UI host started.

The weft-servo-shell package now installs the page as
share/weft/shell/system-ui.html, the binary falls back to that path in
the package's active revision, the systemd unit drops the ignored
argument, and the NixOS service sets WEFT_SYSTEM_UI_HTML to the package's
copy. weft-appd is wanted by the graphical session and is given the app
shell. docs/building.md lists what still keeps the image from a working
desktop: the Servo source hash, servo-embed in the shell packages and the
fixed Wayland socket name.
2026-10-09 20:26:05 +00:00

86 lines
2.4 KiB
Nix

{ pkgs, rust193, ... }:
let
rustPlatform = pkgs.makeRustPlatform {
cargo = rust193;
rustc = rust193;
};
src = ../..;
cargoLock = {
lockFile = ../../Cargo.lock;
# One hash per git source in Cargo.lock: the Servo fork and the Stylo fork
# (keyed by its `selectors` crate). Every package vendors both, so both must
# match the pinned revisions. Recompute them whenever a revision changes.
# The Servo hash is not yet known for e5d9a51; a Nix build reports it.
outputHashes = {
"servo-0.0.1" = pkgs.lib.fakeHash;
"selectors-0.36.0" = "13y6pa19j4w2zsxfhv6mrl03wsa0frazlsssbqkzpwci8k9gzl4i";
};
};
commonArgs = {
inherit src cargoLock;
version = "0.1.0";
nativeBuildInputs = with pkgs; [ pkg-config ];
};
mkWeftPkg = { pname, extraBuildInputs ? [], extraNativeBuildInputs ? [], cargoFlags ? [], extraEnv ? {}, preBuild ? "", postInstall ? "" }: rustPlatform.buildRustPackage (commonArgs // {
inherit pname preBuild postInstall;
cargoBuildFlags = [ "--package" pname ] ++ cargoFlags;
cargoTestFlags = [ "--package" pname ];
buildInputs = extraBuildInputs;
nativeBuildInputs = commonArgs.nativeBuildInputs ++ extraNativeBuildInputs;
env = extraEnv;
doCheck = false;
});
in {
weft-compositor = mkWeftPkg {
pname = "weft-compositor";
extraBuildInputs = with pkgs; [
libdrm mesa libgbm wayland libxkbcommon seatd udev dbus libGL libdisplay-info libinput
];
extraNativeBuildInputs = with pkgs; [ wayland-scanner ];
extraEnv = {
RUSTFLAGS = "-L${pkgs.libgbm}/lib -L${pkgs.libinput}/lib";
};
};
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 {
pname = "weft-app-shell";
};
weft-appd = mkWeftPkg {
pname = "weft-appd";
extraBuildInputs = with pkgs; [ openssl ];
};
weft-runtime = mkWeftPkg {
pname = "weft-runtime";
extraBuildInputs = with pkgs; [ openssl ];
cargoFlags = [ "--features" "wasmtime-runtime,net-fetch" ];
};
weft-pack = mkWeftPkg {
pname = "weft-pack";
};
weft-file-portal = mkWeftPkg {
pname = "weft-file-portal";
};
weft-mount-helper = mkWeftPkg {
pname = "weft-mount-helper";
extraBuildInputs = with pkgs; [ cryptsetup ];
};
}