--- /dev/null
+;; Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; program.scm - service for installing programs and symlinking their dotfiles.
+
+(define-module (conf home program)
+ #:use-module (conf home symlink)
+ #:use-module (gnu home services)
+ #:use-module (gnu services configuration)
+ #:use-module (guix packages)
+ #:export (home-program-configuration
+ home-program-service-type))
+
+(define (packages? ps)
+ (or (null? ps)
+ (and (package? (car ps)) (packages? (cdr ps)))))
+
+(define (serialize-packages field-name value)
+ #~(#$@value))
+
+(define-configuration home-program-configuration
+ (packages
+ (packages)
+ "List of packages of the service to install.")
+ (dotfiles
+ (text-config '())
+ "List of dotfiles of the service to symlink."))
+
+(define (install-packages config)
+ (home-program-configuration-packages config))
+
+(define (symlink-dotfiles config)
+ (home-program-configuration-dotfiles config))
+
+(define home-program-service-type
+ (service-type (name 'home-program)
+ (extensions
+ (list
+ (service-extension home-profile-service-type
+ install-packages)
+ (service-extension home-symlink-service-type
+ symlink-dotfiles)))
+ (description "Installs programs and symlinks dotfiles.")))
#:use-module (gnu services configuration)
#:use-module (guix gexp)
#:use-module (guix packages)
+ #:use-module (srfi srfi-1)
#:export (home-symlink-service-type))
(define (symlink paths)
(extensions
(list (service-extension home-files-service-type
symlink)))
+ (compose concatenate)
+ (extend append)
(default-value '())
(description "Copies files to the guix store and symlinks them in
the home directory. For a @path{a/b/c/d.ext}, creates a @file{d.ext} file in the