From aceffb4e5032db83727e4d41a543127d28894de2 Mon Sep 17 00:00:00 2001 From: xeals Date: Sat, 23 Jan 2021 14:14:56 +1100 Subject: [PATCH] cardboard: init at 20210120 --- .../0001-use-system-dependencies.patch | 62 ++++++++++++++++ .../window-managers/cardboard/default.nix | 71 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 135 insertions(+) create mode 100644 pkgs/applications/window-managers/cardboard/0001-use-system-dependencies.patch create mode 100644 pkgs/applications/window-managers/cardboard/default.nix diff --git a/pkgs/applications/window-managers/cardboard/0001-use-system-dependencies.patch b/pkgs/applications/window-managers/cardboard/0001-use-system-dependencies.patch new file mode 100644 index 0000000..f60acf7 --- /dev/null +++ b/pkgs/applications/window-managers/cardboard/0001-use-system-dependencies.patch @@ -0,0 +1,62 @@ +diff --git a/cardboard/meson.build b/cardboard/meson.build +index b236f71..a90f230 100644 +--- a/cardboard/meson.build ++++ b/cardboard/meson.build +@@ -4,24 +4,15 @@ xkbcommon = dependency('xkbcommon') + xcb = dependency('xcb', required: get_option('xwayland')) + + wlroots_version = '>=0.10.0' +-wlroots_proj = subproject( ++wlroots = dependency( + 'wlroots', +- default_options: ['examples=false'], + required: true, + version: wlroots_version, + ) + +-wlroots = wlroots_proj.get_variable('wlroots') +-wlroots_conf = wlroots_proj.get_variable('conf_data') +-wlroots_has_xwayland = wlroots_conf.get('WLR_HAS_XWAYLAND') == 1 ++have_xwayland = xcb.found() + +-if get_option('xwayland').enabled() and not wlroots_has_xwayland +- error('Cannot enable Xwayland support in cardboard: wlroots has been built without Xwayland support') +-endif +-have_xwayland = xcb.found() and wlroots_has_xwayland +- +-expected_proj = subproject('expected', required: true) +-expected = expected_proj.get_variable('expected_dep') ++expected = dependency('tl-expected', required: true, method: 'cmake', modules: ['tl::expected']) + + conf_data = configuration_data() + conf_data.set10('HAVE_XWAYLAND', have_xwayland) +diff --git a/cutter/meson.build b/cutter/meson.build +index f1260a4..1485f37 100644 +--- a/cutter/meson.build ++++ b/cutter/meson.build +@@ -1,6 +1,5 @@ + # SPDX-License-Identifier: GPL-3.0-only +-expected_proj = subproject('expected', required: true) +-expected = expected_proj.get_variable('expected_dep') ++expected = dependency('tl-expected', required: true, method: 'cmake', modules: ['tl::expected']) + + executable( + 'cutter', +diff --git a/libcardboard/meson.build b/libcardboard/meson.build +index 89698fe..3ac8115 100644 +--- a/libcardboard/meson.build ++++ b/libcardboard/meson.build +@@ -1,11 +1,9 @@ + # SPDX-License-Identifier: GPL-3.0-only + libcardboard_inc = include_directories('include') + +-expected_proj = subproject('expected', required: true) +-expected = expected_proj.get_variable('expected_dep') ++expected = dependency('tl-expected', required: true, method: 'cmake', modules: ['tl::expected']) + +-cereal_proj = subproject('cereal', required: true) +-cereal = cereal_proj.get_variable('cereal_dep') ++cereal = dependency('cereal', required: true, method: 'cmake') + + sources = files( + 'src/command_protocol.cpp', diff --git a/pkgs/applications/window-managers/cardboard/default.nix b/pkgs/applications/window-managers/cardboard/default.nix new file mode 100644 index 0000000..bbc0eff --- /dev/null +++ b/pkgs/applications/window-managers/cardboard/default.nix @@ -0,0 +1,71 @@ +{ stdenv +, fetchFromGitLab +, fetchzip + +, cereal +, cmake +, git +, libGL +, libX11 +, libinput +, libxkbcommon +, mesa +, meson +, ninja +, pixman +, pkg-config +, tl-expected +, wayland +, wayland-protocols +, wlroots +, xwayland +}: + +stdenv.mkDerivation rec { + pname = "cardboard"; + version = "20210120"; + + src = fetchFromGitLab { + owner = "cardboardwm"; + repo = "cardboard"; + rev = "7b15613e6e1222a6a83d69a2e5da2810dfb45522"; + sha256 = "sha256-uL7zG2Q2tnGicWBeXgNjWK/drz2bbmbb5Z69sClYmhA="; + }; + + patches = [ + ./0001-use-system-dependencies.patch + ]; + + # CMake likes to own the configurePhase, but we only need it for dependency + # discovery. Remove it. + configurePhase = "mesonConfigurePhase"; + + nativeBuildInputs = [ + cmake + meson + ninja + pkg-config + ]; + + buildInputs = [ + cereal + libGL + libX11 + libinput + libxkbcommon + pixman + tl-expected + wayland + wayland-protocols + wlroots + ]; + + passthru.providedSessions = [ "cardboard" ]; + + meta = { + description = "Scrollable tiling Wayland compositor designed with laptops in mind"; + homepage = "https://gitlab.com/cardboardwm/cardboard"; + license = stdenv.lib.licenses.gpl3; + platforms = wlroots.meta.platforms; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6656c85..fe19250 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -43,6 +43,8 @@ rec { amdgpu-fan = pkgs.callPackage ../tools/misc/amdgpu-fan { }; + cardboard = pkgs.callPackage ../applications/window-managers/cardboard { }; + goModules = pkgs.recurseIntoAttrs rec { qt = pkgs.libsForQt512.callPackage ../development/go-modules/qt { }; };