summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2024-02-17 07:49:33 -0500
committerDavid Thompson <dthompson2@worcester.edu>2024-02-17 07:49:33 -0500
commitbc4c3c85a8738958a2a1394eac3df8981e6a6eae (patch)
treebe7ddbbc9893ce46b26fefbdce0994262a1ad418
parentad604d3d735e7f44e7e4011f0d6d8e03537e6561 (diff)
Refactor home stuff into modules, add pipewire.
-rw-r--r--dthompson/home/common.scm (renamed from common-home.scm)25
-rw-r--r--dthompson/home/pipewire.scm100
-rw-r--r--ikaruga-home.scm11
-rw-r--r--rise-home.scm6
4 files changed, 127 insertions, 15 deletions
diff --git a/common-home.scm b/dthompson/home/common.scm
index 8c78f7b..3469e3f 100644
--- a/common-home.scm
+++ b/dthompson/home/common.scm
@@ -14,25 +14,28 @@
;;; along with this program. If not, see
;;; <http://www.gnu.org/licenses/>.
-(use-modules (gnu home)
- (gnu packages)
- (gnu services)
- (guix channels)
- (guix gexp)
- (gnu home services)
- (gnu home services guix)
- (gnu home services shells))
+(define-module (dthompson home common)
+ #:use-module (gnu home)
+ #:use-module (gnu packages)
+ #:use-module (gnu services)
+ #:use-module (guix channels)
+ #:use-module (guix gexp)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services desktop)
+ #:use-module (gnu home services guix)
+ #:use-module (gnu home services shells))
(define (dotfiles . file-names)
- (define dir (dirname (current-filename)))
+ (define dir (getcwd))
(map (lambda (file-name)
(list file-name
(local-file (string-append dir "/dotfiles/" file-name)
(string-append "dotfile-" (basename file-name)))))
file-names))
-(define common-services
- (list (service home-bash-service-type
+(define-public common-services
+ (list (service home-dbus-service-type)
+ (service home-bash-service-type
(home-bash-configuration
(aliases '(("grep" . "grep --color=auto")
("ls" . "ls -ahlp --color=auto")))))
diff --git a/dthompson/home/pipewire.scm b/dthompson/home/pipewire.scm
new file mode 100644
index 0000000..bff47ea
--- /dev/null
+++ b/dthompson/home/pipewire.scm
@@ -0,0 +1,100 @@
+;; Snarfed from David Wilson who I believe snarfed from Andrew Tropin.
+(define-module (dthompson home pipewire)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu services)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services shepherd)
+ #:use-module (guix gexp))
+
+(define (home-pipewire-profile-service config)
+ (map specification->package
+ (list "pipewire"
+ "wireplumber")))
+
+(define (home-pipewire-shepherd-service config)
+ (list
+ ;; Start Pipewire daemon
+ (shepherd-service
+ (requirement '(dbus))
+ (provision '(pipewire))
+ (stop #~(make-kill-destructor))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append pipewire "/bin/pipewire"))
+ #:log-file (string-append
+ (or (getenv "XDG_LOG_HOME")
+ (format #f "~a/.local/var/log"
+ (getenv "HOME")))
+ "/pipewire.log")
+ #:environment-variables
+ (append (list "DISABLE_RTKIT=1")
+ (default-environment-variables)))))
+ ;; Start Pipewire PulseAudio module
+ (shepherd-service
+ (requirement '(pipewire))
+ (provision '(pipewire-pulse))
+ (stop #~(make-kill-destructor))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append pipewire "/bin/pipewire-pulse"))
+ #:log-file (string-append
+ (or (getenv "XDG_LOG_HOME")
+ (format #f "~a/.local/var/log"
+ (getenv "HOME")))
+ "/pipewire-pulse.log")
+ #:environment-variables
+ (append (list "DISABLE_RTKIT=1")
+ (default-environment-variables)))))
+ ;; Start Wireplumber session manager
+ (shepherd-service
+ (requirement '(pipewire))
+ (provision '(wireplumber))
+ (stop #~(make-kill-destructor))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append wireplumber "/bin/wireplumber"))
+ #:log-file (string-append
+ (or (getenv "XDG_LOG_HOME")
+ (format #f "~a/.local/var/log"
+ (getenv "HOME")))
+ "/wireplumber.log")
+ #:environment-variables
+ (append (list "DISABLE_RTKIT=1")
+ (default-environment-variables)))))))
+
+(define (home-pipewire-xdg-configuration-service config)
+ `(("alsa/asoundrc"
+ ,(mixed-text-file
+ "asoundrc"
+ #~(string-append
+ "<"
+ #$(file-append
+ pipewire "/share/alsa/alsa.conf.d/50-pipewire.conf")
+ ">\n<"
+ #$(file-append
+ pipewire "/share/alsa/alsa.conf.d/99-pipewire-default.conf")
+ ">\n"
+ "
+pcm_type.pipewire {
+ lib " #$(file-append pipewire "/lib/alsa-lib/libasound_module_pcm_pipewire.so")
+ "
+}
+ctl_type.pipewire {
+ lib " #$(file-append pipewire "/lib/alsa-lib/libasound_module_ctl_pipewire.so")
+ "
+}
+")))))
+
+(define-public home-pipewire-service-type
+ (service-type (name 'home-pipewire)
+ (extensions
+ (list (service-extension
+ home-profile-service-type
+ home-pipewire-profile-service)
+ (service-extension
+ home-shepherd-service-type
+ home-pipewire-shepherd-service)
+ (service-extension
+ home-xdg-configuration-files-service-type
+ home-pipewire-xdg-configuration-service)))
+ (default-value #f)
+ (description "Configures and runs the Pipewire audio system.")))
diff --git a/ikaruga-home.scm b/ikaruga-home.scm
index edf5ce5..85bd022 100644
--- a/ikaruga-home.scm
+++ b/ikaruga-home.scm
@@ -14,7 +14,12 @@
;;; along with this program. If not, see
;;; <http://www.gnu.org/licenses/>.
-(include "common-home.scm")
+(define-module (ikaruga-home)
+ #:use-module (dthompson home common)
+ #:use-module (dthompson home pipewire)
+ #:use-module (gnu home)
+ #:use-module (gnu packages)
+ #:use-module (gnu services))
(home-environment
(packages (specifications->packages
@@ -64,7 +69,6 @@
"openssh"
"pavucontrol"
"pinentry"
- "quassel"
"quodlibet"
"sfxr"
"sicp"
@@ -74,4 +78,5 @@
"tor"
"vlc"
"xournal")))
- (services common-services))
+ (services (cons (service home-pipewire-service-type)
+ common-services)))
diff --git a/rise-home.scm b/rise-home.scm
index d7db69e..c072142 100644
--- a/rise-home.scm
+++ b/rise-home.scm
@@ -14,7 +14,11 @@
;;; along with this program. If not, see
;;; <http://www.gnu.org/licenses/>.
-(include "common-home.scm")
+(define-module (rise-home)
+ #:use-module (dthompson home common)
+ #:use-module (gnu home)
+ #:use-module (gnu packages)
+ #:use-module (gnu services))
(home-environment
(packages (specifications->packages