summaryrefslogtreecommitdiff
path: root/johnlepikhin/home/xsession.scm
diff options
context:
space:
mode:
authorEvgenii Lepikhin <e.lepikhin@corp.mail.ru>2023-02-05 12:04:15 +0300
committerEvgenii Lepikhin <e.lepikhin@corp.mail.ru>2023-02-05 12:04:15 +0300
commitaa45dede3bf4bd2fa622a31b78bfbd19c6dedd27 (patch)
treebbdd6f1043e662805bfebbd15b8d9c197c10af14 /johnlepikhin/home/xsession.scm
parentrefactor: Stalonetray config in separate file (diff)
downloadjohnlepikhin-guix-channel-aa45dede3bf4bd2fa622a31b78bfbd19c6dedd27.tar.gz
feat: [WIP] Added xsession file service
Diffstat (limited to 'johnlepikhin/home/xsession.scm')
-rw-r--r--johnlepikhin/home/xsession.scm62
1 files changed, 62 insertions, 0 deletions
diff --git a/johnlepikhin/home/xsession.scm b/johnlepikhin/home/xsession.scm
new file mode 100644
index 0000000..7cacd3e
--- /dev/null
+++ b/johnlepikhin/home/xsession.scm
@@ -0,0 +1,62 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 Evgenii Lepikhin <johnlepikhin@gmail.com>
+;;;
+;;; This file is not part of GNU Guix.
+;;;
+;;; GNU Guix 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.
+;;;
+;;; GNU Guix 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (johnlepikhin home xsession)
+ #:use-module (gnu services)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu home services)
+ #:use-module (srfi srfi-1)
+ #:use-module (guix records)
+ #:use-module (guix gexp)
+ #:export (home-xsession-configuration
+ home-xsession-service-type))
+
+(define-record-type* <home-xsession-configuration>
+ home-xsession-configuration make-xsession-configuration
+ home-xsession-configuration?
+ (root-process home-xsession-root-process (default "xmonad"))
+ (components home-xsession-components '()))
+
+(define (add-xsession-file config)
+ `((".xsession"
+ ,(mixed-text-file
+ "xsession"
+ "#! /bin/sh\n"
+ (gexp
+ (string-append
+ (map (lambda (component) (string-append compontent "\n"))
+ (home-xsession-components config))))
+ (home-xsession-root-process config)
+ "\n"))))
+
+(define (add-xsession-extensions config extensions)
+ (home-xsession-configuration
+ (inherit config)
+ (components (append (home-xsession-compontents config) extensions))))
+
+(define home-xsession-service-type
+ (service-type
+ (name 'home-xsession)
+ (extensions
+ (list
+ (service-extension
+ home-files-service-type add-xsession-file)))
+ (compose concatenate)
+ (extend add-xsession-extensions)
+ (default-value (home-xsession-configuration))
+ (description "Create @file{~/.xsession}")))