Skip to content

Commit c727b33

Browse files
committed
nix: Add parameter for wlroots-version.
Add definition for [email protected] as it was dropped upstream.
1 parent 6e473a8 commit c727b33

File tree

5 files changed

+86
-4
lines changed

5 files changed

+86
-4
lines changed

default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
(import ./pin.nix).ocamlPackages.wlroots
1+
{ wlroots-version ? "0.12" }:
2+
(import ./pin.nix { inherit wlroots-version; }).ocamlPackages.wlroots

opam2nix-shell.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
let pkgs = import ./pin.nix; in { resolve = pkgs.opam2nix-resolve; }
1+
let pkgs = import ./pin.nix { }; in { resolve = pkgs.opam2nix-resolve; }

pin.nix

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{ wlroots-version ? "0.12" }:
12
let
23
nix-rev = "3ab8ce12c2db31268f579c11727d9c63cfee2eee"; # 2021-08-15
34
nix-src = builtins.fetchTarball {
@@ -7,6 +8,9 @@ let
78
in import nix-src {
89
overlays = [
910
(_: super: { ocamlPackages = super.ocaml-ng.ocamlPackages_4_08; })
11+
(_: super: {
12+
wlroots_0_13 = super.callPackage (import ./wlroots-13.nix) { };
13+
})
1014
(self: super:
1115
let
1216
opam2nix = import (super.fetchFromGitHub {
@@ -51,7 +55,16 @@ in import nix-src {
5155
pkgs.pixman
5256
pkgs.wayland-protocols
5357
pkgs.wayland
54-
pkgs.wlroots_0_12
58+
(if wlroots-version == "0.12" then
59+
pkgs.wlroots_0_12
60+
else if wlroots-version == "0.13" then
61+
pkgs.wlroots_0_13
62+
else if wlroots-version == "0.14" then
63+
pkgs.wlroots
64+
else
65+
throw ''
66+
wlroots-version must be one of 0.12, 0.13 or 0.14. Got ${wlroots-version}
67+
'')
5568
];
5669
});
5770
};

shell.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{ wlroots-version ? "0.12" }:
2-
let pkgs = import ./pin.nix;
2+
let pkgs = import ./pin.nix { inherit wlroots-version; };
33
in pkgs.mkShell {
44
name = "wlroots-ocaml-shell";
55
inputsFrom = [ pkgs.ocamlPackages.wlroots ];

wlroots-13.nix

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, wayland-scanner, libGL
2+
, wayland, wayland-protocols, libinput, libxkbcommon, pixman, xcbutilwm, libX11
3+
, libcap, xcbutilimage, xcbutilerrors, mesa, libpng, ffmpeg, libuuid
4+
, xcbutilrenderutil, xwayland }:
5+
6+
stdenv.mkDerivation rec {
7+
pname = "wlroots";
8+
version = "0.13.0";
9+
10+
src = fetchFromGitHub {
11+
owner = "swaywm";
12+
repo = "wlroots";
13+
rev = version;
14+
sha256 = "01plhbnsp5yg18arz0v8fr0pr9l4w4pdzwkg9px486qdvb3s1vgy";
15+
};
16+
17+
# $out for the library and $examples for the example programs (in examples):
18+
outputs = [ "out" "examples" ];
19+
20+
nativeBuildInputs = [ meson ninja pkg-config wayland-scanner ];
21+
22+
buildInputs = [
23+
libGL
24+
wayland
25+
wayland-protocols
26+
libinput
27+
libxkbcommon
28+
pixman
29+
xcbutilwm
30+
libX11
31+
libcap
32+
xcbutilimage
33+
xcbutilerrors
34+
mesa
35+
libpng
36+
ffmpeg
37+
libuuid
38+
xcbutilrenderutil
39+
xwayland
40+
];
41+
42+
mesonFlags = [ "-Dlogind-provider=systemd" "-Dlibseat=disabled" ];
43+
44+
postFixup = ''
45+
# Install ALL example programs to $examples:
46+
# screencopy dmabuf-capture input-inhibitor layer-shell idle-inhibit idle
47+
# screenshot output-layout multi-pointer rotation tablet touch pointer
48+
# simple
49+
mkdir -p $examples/bin
50+
cd ./examples
51+
for binary in $(find . -executable -type f -printf '%P\n' | grep -vE '\.so'); do
52+
cp "$binary" "$examples/bin/wlroots-$binary"
53+
done
54+
'';
55+
56+
meta = with lib; {
57+
description = "A modular Wayland compositor library";
58+
longDescription = ''
59+
Pluggable, composable, unopinionated modules for building a Wayland
60+
compositor; or about 50,000 lines of code you were going to write anyway.
61+
'';
62+
inherit (src.meta) homepage;
63+
changelog = "https://github.com/swaywm/wlroots/releases/tag/${version}";
64+
license = licenses.mit;
65+
platforms = platforms.linux;
66+
maintainers = with maintainers; [ ];
67+
};
68+
}

0 commit comments

Comments
 (0)