use wlroots-master from nixpkgs-wayland

This commit is contained in:
EdenQwQ 2025-03-25 21:29:15 +08:00 committed by DreamMaoMao
parent e000a236f6
commit 20176cead6
4 changed files with 125 additions and 142 deletions

119
flake.lock generated
View file

@ -1,5 +1,20 @@
{ {
"nodes": { "nodes": {
"flake-compat": {
"locked": {
"lastModified": 1717312683,
"narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
@ -36,6 +51,43 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"lib-aggregate": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs-lib": "nixpkgs-lib_3"
},
"locked": {
"lastModified": 1742732002,
"narHash": "sha256-fznNOUwLtsnaFHIeHfmj1QxOhjiohM2oiGj/54IO+AI=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "00480968bd30f3f43bcd520046bb647833bf2cf2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "lib-aggregate",
"type": "github"
}
},
"mmsg": { "mmsg": {
"inputs": { "inputs": {
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
@ -100,14 +152,81 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-lib_3": {
"locked": {
"lastModified": 1742692082,
"narHash": "sha256-s3XOULQj7BVO7myY5V4Sob0tRZ7nRpwEOIzXg/MkD/Q=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "a09310bc940f245e51b1ffea68731244ca38f2bd",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-wayland": {
"inputs": {
"flake-compat": "flake-compat",
"lib-aggregate": "lib-aggregate",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1742870145,
"narHash": "sha256-ik+6+EorpRPqEVazsJhjyP9z7N83Tkq0F/Ky7GKHEso=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "b2bfc4d198ca1ff4e9278c0e984f74a6a086b2ee",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1742669843,
"narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1e5b653dff12029333a6546c11e108ede13052eb",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"mmsg": "mmsg", "mmsg": "mmsg",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-wayland": "nixpkgs-wayland",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
} }
}, },
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View file

@ -1,6 +1,7 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix = { treefmt-nix = {
url = "github:numtide/treefmt-nix"; url = "github:numtide/treefmt-nix";
@ -39,7 +40,9 @@
inherit (pkgs) inherit (pkgs)
callPackage callPackage
; ;
maomaowm = callPackage ./nix { }; maomaowm = callPackage ./nix {
wlroots = inputs.nixpkgs-wayland.packages.${pkgs.system}.wlroots;
};
shellOverride = old: { shellOverride = old: {
nativeBuildInputs = old.nativeBuildInputs ++ [ ]; nativeBuildInputs = old.nativeBuildInputs ++ [ ];
buildInputs = old.buildInputs ++ [ ]; buildInputs = old.buildInputs ++ [ ];

View file

@ -15,11 +15,10 @@
enableXWayland ? true, enableXWayland ? true,
meson, meson,
ninja, ninja,
callPackage, wlroots,
}: }:
let let
pname = "maomaowm"; pname = "maomaowm";
wlroots_0_19 = callPackage ./wlroots_0_19.nix { };
in in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit pname; inherit pname;
@ -42,7 +41,7 @@ stdenv.mkDerivation {
pixman pixman
wayland wayland
wayland-protocols wayland-protocols
wlroots_0_19 wlroots
] ]
++ lib.optionals enableXWayland [ ++ lib.optionals enableXWayland [
libX11 libX11

View file

@ -1,138 +0,0 @@
{
lib,
stdenv,
fetchFromGitLab,
meson,
ninja,
pkg-config,
wayland-scanner,
libGL,
wayland,
wayland-protocols,
libinput,
libxkbcommon,
pixman,
libcap,
libgbm,
xorg,
libpng,
ffmpeg,
hwdata,
seatd,
vulkan-loader,
glslang,
libliftoff,
libdisplay-info,
lcms2,
nixosTests,
testers,
cmake,
enableXWayland ? true,
xwayland ? null,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "wlroots";
version = "master";
inherit enableXWayland;
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "wlroots";
repo = "wlroots";
rev = "99da6ccc87c2439b19c9298df6b72b29bbab89bb";
hash = "sha256-mIRUDyZYLrrxTfGq+vlLvgx3wwCbX4ogHESavCZr3TU=";
};
# $out for the library and $examples for the example programs (in examples):
outputs = [
"out"
"examples"
];
strictDeps = true;
depsBuildBuild = [
pkg-config
];
nativeBuildInputs = [
meson
ninja
pkg-config
cmake
wayland-scanner
glslang
hwdata
];
buildInputs = [
ffmpeg
libliftoff
libdisplay-info
libGL
libcap
libinput
libpng
libxkbcommon
libgbm
pixman
seatd
vulkan-loader
wayland
wayland-protocols
xorg.libX11
xorg.xcbutilerrors
xorg.xcbutilimage
xorg.xcbutilrenderutil
xorg.xcbutilwm
lcms2
] ++ lib.optional finalAttrs.enableXWayland xwayland;
mesonFlags = lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled";
postFixup = ''
# Install ALL example programs to $examples:
# screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle
# screenshot output-layout multi-pointer rotation tablet touch pointer
# simple
mkdir -p $examples/bin
cd ./examples
for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do
cp "$binary" "$examples/bin/wlroots-$binary"
done
'';
# Test via TinyWL (the "minimum viable product" Wayland compositor based on wlroots):
passthru.tests = {
tinywl = nixosTests.tinywl;
pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
meta = {
description = "Modular Wayland compositor library";
longDescription = ''
Pluggable, composable, unopinionated modules for building a Wayland
compositor; or about 50,000 lines of code you were going to write anyway.
'';
inherit (finalAttrs.src.meta) homepage;
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
primeos
synthetica
rewine
];
pkgConfigModules = [
(
if lib.versionOlder finalAttrs.version "0.18" then
"wlroots"
else
"wlroots-${lib.versions.majorMinor finalAttrs.version}"
)
];
};
})