[feat] split to service and packages module

This commit is contained in:
SouthFox 2025-01-13 14:10:42 +08:00
parent d6669456c8
commit 1a8379745d
3 changed files with 57 additions and 48 deletions

View file

@ -11,7 +11,8 @@
(guix gexp) (guix gexp)
(gnu home services) (gnu home services)
(gnu home services shells) (gnu home services shells)
(fox packages)) (fox packages)
(fox services))
(if (equal? "lighthouse" (getlogin)) (if (equal? "lighthouse" (getlogin))
(home-environment (home-environment

View file

@ -6,18 +6,13 @@
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages emacs)
#:use-module (gnu packages check) #:use-module (gnu packages check)
#:use-module (gnu packages python-build) #:use-module (gnu packages python-build)
#:use-module (gnu packages python-xyz) #:use-module (gnu packages python-xyz)
#:use-module (gnu home services) #:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (guix build-system copy) #:use-module (guix build-system copy)
#:use-module (guix build-system pyproject) #:use-module (guix build-system pyproject)
#:use-module (gnu services) #:use-module (gnu services))
#:export (zellij
oh-my-zsh-service-type
home-emacs-service-type))
(define-public oh-my-zsh (define-public oh-my-zsh
(let ((commit "366d25435229bfa725109a147d6cb2fef8011b3c") (let ((commit "366d25435229bfa725109a147d6cb2fef8011b3c")
@ -34,23 +29,15 @@
(base32 (base32
"1w339zy12mnszdbh9gfpym39bhx5klrfpqaqbgh7vc2gw4m6slrc")))) "1w339zy12mnszdbh9gfpym39bhx5klrfpqaqbgh7vc2gw4m6slrc"))))
(build-system copy-build-system) (build-system copy-build-system)
(synopsis "Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.") (synopsis "framework for managing your zsh configuration")
(description "🙃A delightful community-driven (with 2,400+ contributors) framework for managing (description "🙃A delightful community-driven (with 2,400+ contributors)
your zsh configuration. Includes 300+ optional plugins framework for managing your zsh configuration. Includes 300+ optional plugins
(rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes
your morning, and an auto-update tool that makes it easy to keep up with the latest updates from the community. ") to spice up your morning, and an auto-update tool that makes it easy to keep up
with the latest updates from the community.")
(home-page "https://ohmyz.sh/") (home-page "https://ohmyz.sh/")
(license expat)))) (license expat))))
(define oh-my-zsh-service-type
(service-type (name 'oh-my-zsh)
(description "oh my zsh")
(extensions
(list (service-extension
home-files-service-type
(lambda (_) (list `(".oh-my-zsh" ,oh-my-zsh))))))
(default-value '())))
(define-public zellij (define-public zellij
(package (package
(name "zellij") (name "zellij")
@ -74,35 +61,10 @@ your morning, and an auto-update tool that makes it easy to keep up with the lat
(lambda* (#:key source #:allow-other-keys) (lambda* (#:key source #:allow-other-keys)
(invoke "tar" "-xvf" source)))))) (invoke "tar" "-xvf" source))))))
(home-page "https://github.com/zellij-org/zellij") (home-page "https://github.com/zellij-org/zellij")
(synopsis "A terminal workspace with batteries included.") (synopsis "terminal workspace with batteries included")
(description (description "Terminal workspace with batteries included.")
"A terminal workspace with batteries included.")
(license expat))) (license expat)))
(define (home-emacs-shepherd-service config)
(list
(shepherd-service
(documentation "Start Emacs")
(provision '(emacs))
(auto-start? #t)
(start
#~(make-forkexec-constructor
(list "/usr/bin/emacs"
"--fg-daemon")
#:log-file (format #f "~a/.local/var/log/emacs.log" (getenv "HOME"))))
(stop
#~(make-system-destructor
"/usr/bin/emacsclient --eval '(kill-emacs)'")))))
(define home-emacs-service-type
(service-type (name 'emacs-configuration)
(extensions
(list (service-extension
home-shepherd-service-type
home-emacs-shepherd-service)))
(default-value '())
(description "Configures Emacs and installs packages to home-profile.")))
(define-public python-hy-1 (define-public python-hy-1
(package (package
(name "python-hy-1") (name "python-hy-1")

46
modules/fox/services.scm Normal file
View file

@ -0,0 +1,46 @@
(define-module (fox services)
#:use-module (fox packages)
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages emacs)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu services)
#:export (oh-my-zsh-service-type
home-emacs-service-type))
(define oh-my-zsh-service-type
(service-type (name 'oh-my-zsh)
(description "oh my zsh")
(extensions
(list (service-extension
home-files-service-type
(lambda (_) (list `(".oh-my-zsh" ,oh-my-zsh))))))
(default-value '())))
(define (home-emacs-shepherd-service config)
(list
(shepherd-service
(documentation "Start Emacs")
(provision '(emacs))
(auto-start? #t)
(start
#~(make-forkexec-constructor
(list "/usr/bin/emacs"
"--fg-daemon")
#:log-file (format #f "~a/.local/var/log/emacs.log" (getenv "HOME"))))
(stop
#~(make-system-destructor
"/usr/bin/emacsclient --eval '(kill-emacs)'")))))
(define home-emacs-service-type
(service-type (name 'emacs-configuration)
(extensions
(list (service-extension
home-shepherd-service-type
home-emacs-shepherd-service)))
(default-value '())
(description "Configures Emacs and installs packages to home-profile.")))