Subject: [PATCH] gnu: Add sway.
From: Rutger Helling <[email-masked]>
To: [email-masked]
Date: Thu, 27 Dec 2018 16:05:03 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hey Guix,

these patches add Sway.

Note that with
(screen-locker-service sway "swaylock")
we should now have a native Wayland screen locker.

Supposedly this can be done without making the swaylock binary SUID,
but I've been unable to figure out how.
From 0ea8db95fe1714ec4b27aafc418513757ab93dd0 Mon Sep 17 00:00:00 2001
From: Rutger Helling <[email-masked]>
Date: Thu, 27 Dec 2018 15:43:41 +0100
Subject: [PATCH 1/2] gnu: Add wlroots.

* gnu/packages/wm.scm (wlroots): New variable.
---
 gnu/packages/wm.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index a761bce23..b9500f8db 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -42,6 +42,7 @@
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
+  #:use-module (guix build-system meson)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
   #:use-module (gnu packages haskell)
@@ -77,6 +78,8 @@
   #:use-module (gnu packages linux)
   #:use-module (gnu packages suckless)
   #:use-module (gnu packages mpd)
+  #:use-module (gnu packages gl)
+  #:use-module (gnu packages video)
   #:use-module (guix download)
   #:use-module (guix git-download))
 
@@ -1094,3 +1097,49 @@ its size
 customizable status bars for their desktop environment.  It has built-in
 functionality to display information about the most commonly used services.")
     (license license:expat)))
+
+(define-public wlroots
+  (package
+   (name "wlroots")
+   (version "0.2")
+   (source
+    (origin
+     (method git-fetch)
+     (uri (git-reference
+           (url "https://github.com/swaywm/wlroots.git")
+           (commit version)))
+     (file-name (git-file-name name version))
+     (sha256
+      (base32 "0gfxawjlb736xl90zfv3n6zzf5n1cacgzflqi1zq1wn7wd3j6ppv"))))
+   (build-system meson-build-system)
+   (arguments
+    `(#:configure-flags '("-Dlogind-provider=elogind")
+      #:phases
+      (modify-phases %standard-phases
+        (add-before 'configure 'hardcode-paths
+          (lambda* (#:key inputs #:allow-other-keys)
+            (substitute* "xwayland/xwayland.c"
+                         (("Xwayland") (string-append (assoc-ref inputs
+                                       "xorg-server-xwayland")
+                                       "/bin/Xwayland")))
+            #t)))))
+   (native-inputs `(("elogind" ,elogind)
+                    ("eudev" ,eudev)
+                    ("ffmpeg" ,ffmpeg)
+                    ;("libcap" ,libcap) ; FIXME: Breaks DRM backend.
+                    ("libinput" ,libinput)
+                    ("libpng" ,libpng)
+                    ("libxkbcommon" ,libxkbcommon)
+                    ("mesa" ,mesa)
+                    ("pixman" ,pixman)
+                    ("pkg-config" ,pkg-config)
+                    ("wayland" ,wayland)
+                    ("wayland-protocols" ,wayland-protocols)
+                    ("xorg-server-xwayland" ,xorg-server-xwayland)))
+   (home-page "https://github.com/swaywm/wlroots")
+   (synopsis "Pluggable, composable, unopinionated modules for building a
+Wayland compositor")
+   (description "wlroots is a set of pluggable, composable, unopinionated
+modules for building a Wayland compositor.")
+   ; MIT license
+   (license license:expat)))
-- 
2.20.1

From ac73b2a037fb73547b5e14f5b90e1cc8383b8bad Mon Sep 17 00:00:00 2001
From: Rutger Helling <[email-masked]>
Date: Thu, 27 Dec 2018 15:49:54 +0100
Subject: [PATCH 2/2] gnu: Add sway.

* gnu/packages/wm.scm (sway): New variable.
---
 gnu/packages/wm.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index b9500f8db..0bced1bc9 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -80,6 +80,9 @@
   #:use-module (gnu packages mpd)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages man)
+  #:use-module (gnu packages version-control)
   #:use-module (guix download)
   #:use-module (guix git-download))
 
@@ -1143,3 +1146,39 @@ Wayland compositor")
 modules for building a Wayland compositor.")
    ; MIT license
    (license license:expat)))
+
+(define-public sway
+  (package
+   (name "sway")
+   (version "1.0-beta.2")
+   (source
+    (origin
+     (method git-fetch)
+     (uri (git-reference
+           (url "https://github.com/swaywm/sway.git")
+           (commit version)))
+     (file-name (git-file-name name version))
+     (sha256
+      (base32 "0f9rniwizbc3vzxdy6rc47749p6gczfbgfdy4r458134rbl551hw"))))
+   (build-system meson-build-system)
+   (native-inputs `(("cairo" ,cairo)
+                    ("elogind" ,elogind)
+                    ("gdk-pixbuf" ,gdk-pixbuf)
+                    ("git" ,git)
+                    ("json-c" ,json-c)
+                    ("libcap" ,libcap)
+                    ("libinput" ,libinput)
+                    ("libxkbcommon" ,libxkbcommon)
+                    ("linux-pam" ,linux-pam)
+                    ("mesa" ,mesa)
+                    ("pango" ,pango)
+                    ("pkg-config" ,pkg-config)
+                    ("scdoc" ,scdoc)
+                    ("wayland" ,wayland)
+                    ("wayland-protocols" ,wayland-protocols)
+                    ("wlroots" ,wlroots)))
+   (home-page "https://github.com/swaywm/sway")
+   (synopsis "Wayland compositor compatible with i3")
+   (description "Sway is a i3-compatible Wayland compositor.")
+   ; MIT license
+   (license license:expat)))
2.20.1