Subject: [bug#51924] [PATCH] gnu: Add postmarketos-tweaks.

From: phodina <[email-masked]>
Date: Wed, 17 Nov 2021 17:08:21 +0000

Hi,

here's patch for tool similar to gnome-tweaks just for mobile devices.

There is hardcoded location /etc/postmarket for polkit. Should this be substituted for different location in a similar manner as with udev which looks in out/lib/udev?

* gnu/packages/gnome.scm (postmarketos-tweaks): New variable.

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 28d4432334..2e32be4cd5 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -11357,6 +11357,64 @@ (define-public polari
     (home-page "https://wiki.gnome.org/Apps/Polari")
     (license license:gpl2+)))

+(define-public postmarketos-tweaks
+  (package
+    (name "postmarketos-tweaks")
+    (version "0.8.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/postmarketOS/postmarketos-tweaks")
+             (commit version)))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "09z3i288jnxvkbk2dphjc578ycp1vqzdmixi311fymvgwhfb3xjs"))))
+    (build-system meson-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-install-dir
+           (lambda* _
+             (substitute* "data/meson.build"
+               (("/etc/init.d") (string-append %output "/etc/init.d")))))
+         (add-after 'glib-or-gtk-wrap 'python-and-gi-wrap
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((bin (string-append (assoc-ref outputs "out") "/bin/"))
+                   (pylib (string-append (assoc-ref outputs "out")
+                                         "/lib/python"
+                                         ,(version-major+minor
+                                           (package-version python))
+                                         "/site-packages")))
+               (for-each
+                (lambda (program)
+                  (wrap-program (string-append bin program)
+                    `("PYTHONPATH" = (,(getenv "PYTHONPATH") ,pylib))
+                    `("GI_TYPELIB_PATH" = (,(getenv
+                                             "GI_TYPELIB_PATH")))))
+                (list "pmos-tweaks" "pmos-tweakd" "pk-tweaks-action"))
+               #t))))))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("gtk+:bin"
+                      ,gtk+ "bin")      ; for gtk-update-icon-cache
+                     ("glib:bin"
+                      ,glib "bin")      ; glib-compile-schemas, etc.
+                     ("desktop-file-utils"
+                      ,desktop-file-utils) ; for update-desktop-database
+                     ("cmake" ,cmake)))
+    (inputs `(("bash-minimal" ,bash-minimal)
+              ("gtk+" ,gtk+)
+              ("libhandy" ,libhandy)
+              ("python" ,python)
+              ("python-pygobject" ,python-pygobject)
+              ("python-pyyaml" ,python-pyyaml)))
+    (home-page "https://gitlab.com/postmarketOS/postmarketos-tweaks")
+    (synopsis "Extra settings on mobile platforms")
+    (description "Postmarket tweaks is an application for tweaking settings
+on desktop environments supported by postmarketOS.")
+    (license license:lgpl3)))
+
 (define-public gnome-boxes
   (package
     (name "gnome-boxes")
--
2.33.0