From be91af39002d89ab74dd7e72a639f9651eb95f10 Mon Sep 17 00:00:00 2001 From: EdenQwQ Date: Tue, 25 Mar 2025 21:29:15 +0800 Subject: [PATCH] use wlroots-master from nixpkgs-wayland --- flake.lock | 119 +++++++++++++++++++++++++++++++++++++ flake.nix | 5 +- nix/default.nix | 5 +- nix/wlroots_0_19.nix | 138 ------------------------------------------- 4 files changed, 125 insertions(+), 142 deletions(-) delete mode 100644 nix/wlroots_0_19.nix diff --git a/flake.lock b/flake.lock index d3517642..56be444e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "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": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -36,6 +51,43 @@ "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": { "inputs": { "flake-parts": "flake-parts_2", @@ -100,14 +152,81 @@ "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": { "inputs": { "flake-parts": "flake-parts", "mmsg": "mmsg", "nixpkgs": "nixpkgs", + "nixpkgs-wayland": "nixpkgs-wayland", "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": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 6b52aed6..e0abf5cc 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,7 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; flake-parts.url = "github:hercules-ci/flake-parts"; treefmt-nix = { url = "github:numtide/treefmt-nix"; @@ -39,7 +40,9 @@ inherit (pkgs) callPackage ; - maomaowm = callPackage ./nix { }; + maomaowm = callPackage ./nix { + wlroots = inputs.nixpkgs-wayland.packages.${pkgs.system}.wlroots; + }; shellOverride = old: { nativeBuildInputs = old.nativeBuildInputs ++ [ ]; buildInputs = old.buildInputs ++ [ ]; diff --git a/nix/default.nix b/nix/default.nix index afe7eba0..6d9bdd67 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -15,11 +15,10 @@ enableXWayland ? true, meson, ninja, - callPackage, + wlroots, }: let pname = "maomaowm"; - wlroots_0_19 = callPackage ./wlroots_0_19.nix { }; in stdenv.mkDerivation { inherit pname; @@ -42,7 +41,7 @@ stdenv.mkDerivation { pixman wayland wayland-protocols - wlroots_0_19 + wlroots ] ++ lib.optionals enableXWayland [ libX11 diff --git a/nix/wlroots_0_19.nix b/nix/wlroots_0_19.nix deleted file mode 100644 index c12450e2..00000000 --- a/nix/wlroots_0_19.nix +++ /dev/null @@ -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}" - ) - ]; - }; -})