Add one-shot service to update my Inkplate display

This commit is contained in:
Tom Willemse 2023-07-08 00:38:08 -07:00
parent 7450bdcb2c
commit c9beaec472
4 changed files with 148 additions and 1 deletions

View file

@ -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))))

View file

@ -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.")))

41
oni/packages/inkplate.scm Normal file
View file

@ -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+)))

View file

@ -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+))))