From c9beaec472f153830b8f9fac31a710d629bd9b05 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 8 Jul 2023 00:38:08 -0700 Subject: [PATCH] Add one-shot service to update my Inkplate display --- oni/home/config/rincewind.scm | 6 +++- oni/home/services/utilities.scm | 60 +++++++++++++++++++++++++++++++++ oni/packages/inkplate.scm | 41 ++++++++++++++++++++++ oni/packages/utilities.scm | 42 +++++++++++++++++++++++ 4 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 oni/home/services/utilities.scm create mode 100644 oni/packages/inkplate.scm create mode 100644 oni/packages/utilities.scm diff --git a/oni/home/config/rincewind.scm b/oni/home/config/rincewind.scm index b4d8718..7734900 100644 --- a/oni/home/config/rincewind.scm +++ b/oni/home/config/rincewind.scm @@ -81,6 +81,8 @@ home-stumpwm-configuration)) #:use-module ((oni home services syncthing) #:select (home-syncthing-service-type)) + #:use-module ((oni home services utilities) + #:select (home-inkplate-display-service-type)) #:use-module ((oni home services zsh) #:select (home-zsh-syntax-highlighting-service-type home-zsh-autosuggestions-service-type)) @@ -285,4 +287,6 @@ (service home-stumpwm-service-type (home-stumpwm-configuration - (package stumpwm+swank)))))) + (package stumpwm+swank))) + + (service home-inkplate-display-service-type)))) diff --git a/oni/home/services/utilities.scm b/oni/home/services/utilities.scm new file mode 100644 index 0000000..26d0212 --- /dev/null +++ b/oni/home/services/utilities.scm @@ -0,0 +1,60 @@ +(define-module (oni home services utilities) + #:use-module ((gnu services configuration) + #:select (serialize-package + define-configuration)) + #:use-module ((gnu home services) + #:select (service-type + service-extension + home-profile-service-type)) + #:use-module ((gnu home services shepherd) + #:select (home-shepherd-service-type + shepherd-service)) + #:use-module ((guix gexp) + #:select (gexp + file-append)) + #:use-module ((guix packages) + #:select (package?)) + #:use-module ((oni packages utilities) + #:select (inkplate-display)) + + #:export (home-inkplate-display-service-type + home-inkplate-display-configuration)) + +(define (serialize-boolean field value) + "") + +(define-configuration home-inkplate-display-configuration + (package + (package inkplate-display) + "Package to use for updating the inkplate display.") + (auto-start? + (boolean #t) + "Should the Inkplate display be updated automatically?")) + +(define (add-inkplate-display-packages config) + (list (home-inkplate-display-configuration-package config))) + +(define (home-inkplate-display-shepherd-service config) + (list + (shepherd-service + (documentation "Update the Inkplate display") + (provision '(inkplate-display)) + (auto-start? (home-inkplate-display-configuration-auto-start? config)) + (one-shot? #t) + (start + #~(make-forkexec-constructor + '(#$(file-append inkplate-display "/bin/inkplate-display"))))))) + +(define home-inkplate-display-service-type + (service-type + (name 'home-inkplate-display) + (extensions + (list (service-extension + home-profile-service-type + add-inkplate-display-packages) + (service-extension + home-shepherd-service-type + home-inkplate-display-shepherd-service))) + (compose identity) + (default-value (home-inkplate-display-configuration)) + (description "Install and configure Inkplate display."))) diff --git a/oni/packages/inkplate.scm b/oni/packages/inkplate.scm new file mode 100644 index 0000000..911a218 --- /dev/null +++ b/oni/packages/inkplate.scm @@ -0,0 +1,41 @@ +(define-module (oni packages inkplate) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system gnu) + #:use-module (gnu packages autotools) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages texinfo) + #:use-module (gnu packages guile) + #:use-module ((guix licenses) #:prefix license:)) + +(define-public guile-inkplate + (package + (name "guile-inkplate") + (version "0.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://code.ryuslash.org/ryuslash/guile-inkplate/") + (commit "17e45127e137ff5c96596ae35b1913deb77f0d83"))) + (file-name "guile-inkplate-0.1-checkout") + (sha256 (base32 "106w10c07kvgxhk702ii3bkxw00ra4xsf0nyybgwcnbswxcn1m19")))) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-before 'configure 'autoreconf + (lambda* (#:key inputs #:allow-other-keys) + (system* (string-append (assoc-ref inputs "autoconf") "/bin/autoreconf"))))))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("pkg-config" ,pkg-config) + ("texinfo" ,texinfo))) + (inputs `(("guile" ,guile-3.0))) + (propagated-inputs `()) + (synopsis "") + (description "") + (home-page "") + (license license:gpl3+))) + diff --git a/oni/packages/utilities.scm b/oni/packages/utilities.scm new file mode 100644 index 0000000..10dd5bb --- /dev/null +++ b/oni/packages/utilities.scm @@ -0,0 +1,42 @@ +(define-module (oni packages utilities) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system gnu) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (gnu packages base) + #:use-module (gnu packages bash) + #:use-module (gnu packages guile) + #:use-module (oni packages inkplate)) + +(define-public inkplate-display + (let ((commit "8b2782e00b37d6e94d17071b7fe570d654af56f6") + (revision "0")) + (package + (name "inkplate-display") + (version (git-version "0.0.0" revision commit)) + (source + (origin + (uri (git-reference + (url "https://code.ryuslash.org/ryuslash/inkplate-display.git") + (commit commit))) + (method git-fetch) + (sha256 + (base32 "0s8vm09zdhwyvdnna68yhwxcxn869g5xds8p87jfzwvi7rg08crr")) + (file-name (git-file-name name version)))) + (propagated-inputs + (list guile-3.0 guile-inkplate)) + (build-system gnu-build-system) + (arguments + `(#:tests? #f + #:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'build) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((bin (string-append (assoc-ref outputs "out") "/bin"))) + (install-file "inkplate-display" bin))))))) + (home-page "https://ryuslash.org/") + (synopsis "My script for displaying information on my Inkplate") + (description "My script for displaying information on my Inkplate.") + (license license:gpl3+))))