2026-10-11 08:44:16 +00:00
|
|
|
{ pkgs, lib, rust193, ... }:
|
2026-03-12 14:41:33 +00:00
|
|
|
|
|
|
|
|
let
|
2026-03-12 20:28:14 +00:00
|
|
|
rustPlatform = pkgs.makeRustPlatform {
|
|
|
|
|
cargo = rust193;
|
|
|
|
|
rustc = rust193;
|
|
|
|
|
};
|
|
|
|
|
|
2026-10-11 08:44:16 +00:00
|
|
|
# The workspace without build outputs, so a local `target/` never enters
|
|
|
|
|
# the store.
|
|
|
|
|
src = lib.cleanSourceWith {
|
|
|
|
|
src = lib.cleanSource ../..;
|
|
|
|
|
filter = path: _type:
|
|
|
|
|
let rel = lib.removePrefix (toString ../.. + "/") (toString path);
|
|
|
|
|
in !(lib.hasPrefix "target" rel || lib.hasSuffix "-result" rel);
|
|
|
|
|
};
|
2026-03-12 14:41:33 +00:00
|
|
|
|
|
|
|
|
cargoLock = {
|
|
|
|
|
lockFile = ../../Cargo.lock;
|
build: select compiling Servo and Stylo fork revisions
Both Servo hosts tracked the marcoallegretti/servo `servo-weft` branch,
which the lockfile resolved to 8e7dc40. That revision's servo-layout does
not compile (E0308 and E0716 in build_backdrop_filter). WEFT also resolved
upstream Stylo dca3934, where backdrop-filter is gated behind
layout.unimplemented, because the Servo fork's own [patch] for Stylo does
not apply to dependents.
Pin Servo by revision to f0bb1aa (8e7dc40 plus the build fix) and add a
root [patch."https://github.com/servo/stylo"] selecting the
marcoallegretti/stylo fork at f1ba496 for all eight Stylo crates Servo
uses. Cargo.lock changes only the 66 source lines of those packages.
Record both pins, their reachable branches, purpose and removal
conditions in SERVO_PIN.md, and restate its limitations against executed
evidence. Update the Nix outputHashes: the Stylo hash is recomputed for
f1ba496 with the method that reproduces the previous dca3934 value; the
Servo hash is not yet known for f0bb1aa and is left as lib.fakeHash, so
Nix builds report the expected value instead of using a stale one.
Validation:
- cargo metadata --locked: ok; no servo/stylo sources remain in the lock
- cargo check -p weft-servo-shell --features servo-embed --locked:
all of Servo, including servo-layout, compiles; the remaining errors are
in the shell's own embedder code
- cargo fmt --check; portable workspace tests: 78 passed
- Nix fetchgit could not run here (archive downloads and the sandbox's
TLS to the proxy fail), so the Servo hash remains unverified
2026-10-09 00:13:08 +00:00
|
|
|
# One hash per git source in Cargo.lock: the Servo fork and the Stylo fork
|
2026-10-11 08:44:16 +00:00
|
|
|
# (keyed by its `selectors` crate). Recompute them whenever a revision
|
|
|
|
|
# changes; a build with a stale hash reports the right one.
|
2026-03-12 14:41:33 +00:00
|
|
|
outputHashes = {
|
2026-10-11 08:44:16 +00:00
|
|
|
"servo-0.0.1" = "sha256-L5XlHf5GOoPtyitRsbb+keXSkTMSJWmYCrWCHzGFI5M=";
|
build: select compiling Servo and Stylo fork revisions
Both Servo hosts tracked the marcoallegretti/servo `servo-weft` branch,
which the lockfile resolved to 8e7dc40. That revision's servo-layout does
not compile (E0308 and E0716 in build_backdrop_filter). WEFT also resolved
upstream Stylo dca3934, where backdrop-filter is gated behind
layout.unimplemented, because the Servo fork's own [patch] for Stylo does
not apply to dependents.
Pin Servo by revision to f0bb1aa (8e7dc40 plus the build fix) and add a
root [patch."https://github.com/servo/stylo"] selecting the
marcoallegretti/stylo fork at f1ba496 for all eight Stylo crates Servo
uses. Cargo.lock changes only the 66 source lines of those packages.
Record both pins, their reachable branches, purpose and removal
conditions in SERVO_PIN.md, and restate its limitations against executed
evidence. Update the Nix outputHashes: the Stylo hash is recomputed for
f1ba496 with the method that reproduces the previous dca3934 value; the
Servo hash is not yet known for f0bb1aa and is left as lib.fakeHash, so
Nix builds report the expected value instead of using a stale one.
Validation:
- cargo metadata --locked: ok; no servo/stylo sources remain in the lock
- cargo check -p weft-servo-shell --features servo-embed --locked:
all of Servo, including servo-layout, compiles; the remaining errors are
in the shell's own embedder code
- cargo fmt --check; portable workspace tests: 78 passed
- Nix fetchgit could not run here (archive downloads and the sandbox's
TLS to the proxy fail), so the Servo hash remains unverified
2026-10-09 00:13:08 +00:00
|
|
|
"selectors-0.36.0" = "13y6pa19j4w2zsxfhv6mrl03wsa0frazlsssbqkzpwci8k9gzl4i";
|
2026-03-12 14:41:33 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2026-10-11 08:44:16 +00:00
|
|
|
# SpiderMonkey, prebuilt by the mozjs project for the mozjs_sys version in
|
|
|
|
|
# Cargo.lock. The build has no network, and compiling SpiderMonkey from
|
|
|
|
|
# source would add hours and gigabytes to every build.
|
|
|
|
|
mozjsArchive = pkgs.fetchurl {
|
|
|
|
|
url = "https://github.com/servo/mozjs/releases/download/mozjs-sys-v0.140.8-0/libmozjs-x86_64-unknown-linux-gnu.tar.gz";
|
|
|
|
|
hash = "sha256-wEDh2VCawPLc7AOlaitkT5yN9pv16oX7UoeHMg+4Aeg=";
|
2026-03-12 14:41:33 +00:00
|
|
|
};
|
|
|
|
|
|
2026-10-11 08:44:16 +00:00
|
|
|
# Libraries Servo and winit open at run time rather than link against.
|
|
|
|
|
runtimeLibs = with pkgs; [ libGL wayland libxkbcommon vulkan-loader ];
|
|
|
|
|
|
|
|
|
|
packages = [
|
|
|
|
|
"weft-compositor"
|
|
|
|
|
"weft-servo-shell"
|
|
|
|
|
"weft-app-shell"
|
|
|
|
|
"weft-appd"
|
|
|
|
|
"weft-runtime"
|
|
|
|
|
"weft-pack"
|
|
|
|
|
"weft-file-portal"
|
|
|
|
|
"weft-mount-helper"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
features = [
|
|
|
|
|
"weft-servo-shell/servo-embed"
|
|
|
|
|
"weft-app-shell/servo-embed"
|
|
|
|
|
"weft-runtime/wasmtime-runtime"
|
|
|
|
|
"weft-runtime/net-fetch"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Every binary comes from one cargo build, so the dependencies the
|
|
|
|
|
# programs share, Servo above all, compile once.
|
|
|
|
|
workspace = rustPlatform.buildRustPackage {
|
|
|
|
|
pname = "weft";
|
|
|
|
|
version = "0.0.1-alpha.0";
|
|
|
|
|
inherit src cargoLock;
|
|
|
|
|
|
|
|
|
|
cargoBuildFlags = lib.concatMap (p: [ "--package" p ]) packages
|
|
|
|
|
++ [ "--features" (lib.concatStringsSep "," features) ];
|
2026-03-12 20:07:39 +00:00
|
|
|
doCheck = false;
|
2026-03-12 14:41:33 +00:00
|
|
|
|
2026-10-11 08:44:16 +00:00
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
|
pkg-config
|
|
|
|
|
wayland-scanner
|
|
|
|
|
cmake
|
|
|
|
|
python3
|
|
|
|
|
perl
|
|
|
|
|
m4
|
|
|
|
|
rustPlatform.bindgenHook
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
|
libdrm mesa libgbm wayland libxkbcommon seatd udev dbus libGL
|
|
|
|
|
libdisplay-info libinput
|
|
|
|
|
openssl cryptsetup
|
|
|
|
|
fontconfig freetype libunwind
|
2026-03-12 14:41:33 +00:00
|
|
|
];
|
2026-10-11 08:44:16 +00:00
|
|
|
|
|
|
|
|
env = {
|
|
|
|
|
MOZJS_ARCHIVE = "${mozjsArchive}";
|
2026-03-12 21:15:28 +00:00
|
|
|
RUSTFLAGS = "-L${pkgs.libgbm}/lib -L${pkgs.libinput}/lib";
|
2026-10-11 08:44:16 +00:00
|
|
|
# The helper runs setuid and takes no program from its caller's PATH.
|
|
|
|
|
WEFT_VERITYSETUP = "${pkgs.cryptsetup}/bin/veritysetup";
|
2026-03-12 21:09:38 +00:00
|
|
|
};
|
2026-03-12 14:41:33 +00:00
|
|
|
|
2026-10-11 08:44:16 +00:00
|
|
|
# The system UI page and the UI kit both shells inject, at the paths the
|
|
|
|
|
# session's units name.
|
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
|
|
|
postInstall = ''
|
|
|
|
|
install -Dm644 infra/shell/system-ui.html $out/share/weft/shell/system-ui.html
|
2026-10-11 08:44:16 +00:00
|
|
|
install -Dm644 infra/shell/weft-ui-kit.js $out/share/weft/system/weft-ui-kit.js
|
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
|
|
|
'';
|
2026-03-12 14:41:33 +00:00
|
|
|
|
2026-10-11 08:44:16 +00:00
|
|
|
postFixup = ''
|
|
|
|
|
for bin in weft-servo-shell weft-app-shell weft-compositor; do
|
|
|
|
|
patchelf --add-rpath ${lib.makeLibraryPath runtimeLibs} $out/bin/$bin
|
|
|
|
|
done
|
|
|
|
|
'';
|
2026-03-12 14:41:33 +00:00
|
|
|
};
|
|
|
|
|
|
2026-10-11 08:44:16 +00:00
|
|
|
in
|
|
|
|
|
# Each program keeps its own attribute for the units that name it.
|
|
|
|
|
lib.genAttrs packages (_: workspace) // { weft = workspace; }
|