~abcdw/rde-devel

rde: Add feature-android. v1 PROPOSED

Hi,

This patch series adds a feature for Android-related tooling, mainly
concerned with ADB and F-Droid.  It currently depends on these patches
<https://issues.guix.gnu.org/62201> and
<https://issues.guix.gnu.org/62199> being merged upstream.

conses (2):
  home: services: Add home-fdroidcl-service-type.
  rde: Add feature-android.

 src/rde/features/android.scm      | 80 +++++++++++++++++++++++++++++++
 src/rde/home/services/android.scm | 64 +++++++++++++++++++++++++
 2 files changed, 144 insertions(+)
 create mode 100644 src/rde/features/android.scm
 create mode 100644 src/rde/home/services/android.scm

-- 
2.39.1



-- 
Best regards,
conses
LGTM.
Next
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~abcdw/rde-devel/patches/39738/mbox | git am -3
Learn more about email & git

[PATCH 1/2] home: services: Add home-fdroidcl-service-type. Export this patch

---
 src/rde/home/services/android.scm | 64 +++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 src/rde/home/services/android.scm

diff --git a/src/rde/home/services/android.scm b/src/rde/home/services/android.scm
new file mode 100644
index 00000000..c7c66012
--- /dev/null
+++ b/src/rde/home/services/android.scm
@@ -0,0 +1,64 @@
;;; rde --- Reproducible development environment.
;;;
;;; Copyright © 2023 conses <contact@conses.eu>
;;; This file is part of rde.
;;;
;;; rde is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; rde is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with rde.  If not, see <http://www.gnu.org/licenses/>.

(define-module (rde home services android)
  #:use-module (gnu home services)
  #:use-module (gnu packages android)
  #:use-module (gnu services configuration)
  #:use-module (guix gexp)
  #:use-module (rde serializers json)
  #:export (home-fdroidcl-configuration
            home-fdroidcl-service-type))

(define-configuration/no-serialization home-fdroidcl-configuration
  (fdroidcl
   (file-like fdroidcl)
   "The @code{fdroidcl} package to use.")
  (config
   (json-config '())
   "@code{fdroidcl} configuration.  You can provide an array of custom F-Droid
repositories like this:

@lisp
'((repos . #(((id . \"fdroid\")
              (url . \"https://f-droid.org/repo\"))
             ((id . \"fdroid-archive\")
              (url . \"https://f-droid.org/archive\")
              (enabled . #f)))))
@end lisp"))

(define (add-fdroidcl-configuration-file config)
  `(("fdroidcl/config.json"
     ,(apply mixed-text-file "config.json"
             (serialize-json-config
              (home-fdroidcl-configuration-config config))))))

(define (add-fdroidcl-package config)
  (list (home-fdroidcl-configuration-fdroidcl config)))

(define home-fdroidcl-service-type
  (service-type
   (name 'fdroidcl)
   (extensions
    (list (service-extension home-profile-service-type
                             add-fdroidcl-package)
          (service-extension home-xdg-configuration-files-service-type
                             add-fdroidcl-configuration-file)))
   (default-value (home-fdroidcl-configuration))
   (description "Configure the @code{fdroidcl} F-Droid desktop client to
invoke F-Droid operations on connected Android devices via @code{adb}.")))
-- 
2.39.1



-- 
Best regards,
conses

[PATCH 2/2] rde: Add feature-android. Export this patch

---
 src/rde/features/android.scm | 80 ++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 src/rde/features/android.scm

diff --git a/src/rde/features/android.scm b/src/rde/features/android.scm
new file mode 100644
index 00000000..bd2fa5b7
--- /dev/null
+++ b/src/rde/features/android.scm
@@ -0,0 +1,80 @@
;;; rde --- Reproducible development environment.
;;;
;;; Copyright © 2023 conses <contact@conses.eu>
;;; This file is part of rde.
;;;
;;; rde is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; rde is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with rde.  If not, see <http://www.gnu.org/licenses/>.

(define-module (rde features android)
  #:use-module (rde features)
  #:use-module (rde features emacs)
  #:use-module (rde home services android)
  #:use-module (rde serializers json)
  #:use-module (gnu services)
  #:use-module (gnu home services)
  #:use-module (gnu packages android)
  #:use-module (gnu packages check)
  #:use-module (gnu packages emacs-xyz)
  #:use-module (guix gexp)
  #:export (feature-android))

(define* (feature-android
          #:key
          (fdroidcl fdroidcl)
          (emacs-fdroid emacs-fdroid)
          (extra-fdroid-repositories '())
          (fdroid-key "f"))
  "Set up Android-related tooling."
  (ensure-pred file-like? fdroidcl)
  (ensure-pred file-like? emacs-fdroid)
  (ensure-pred json-config? extra-fdroid-repositories)
  (ensure-pred string? fdroid-key)

  (define f-name 'android)

  (define (get-home-services config)
    "Return home services related to Android tools."
    (list
     (simple-service
      'add-android-tools
      home-profile-service-type
      (list adb fastboot payload-dumper))
     (simple-service
      'add-android-envs
      home-environment-variables-service-type
      `(("ADB_VENDOR_KEYS" . "$XDG_CONFIG_HOME/android/adb")))
     (service home-fdroidcl-service-type
              (home-fdroidcl-configuration
               (fdroidcl fdroidcl)
               (config `((repos . #(((id . "fdroid")
                                     (url . "https://f-droid.org/repo"))
                                    ((id . "fdroid-archive")
                                     (url . "https://f-droid.org/archive"))
                                    ((id . "IzzyOnDroid")
                                     (url . "https://apt.izzysoft.de/fdroid/repo"))
                                    ,@extra-fdroid-repositories))))))
     (rde-elisp-configuration-service
      f-name
      config
      `((with-eval-after-load 'rde-keymaps
          (define-key rde-app-map (kbd ,fdroid-key) 'fdroid-map))
        (with-eval-after-load 'fdroid
          (setq fdroid-log-events t)
          (setq fdroid-sans-device t)))
      #:elisp-packages (list emacs-fdroid))))

  (feature
   (name f-name)
   (values `((,f-name . #t)))
   (home-services-getter get-home-services)))
-- 
2.39.1



-- 
Best regards,
conses
LGTM.