Service emacs (not yet working) + elogind sleep fix (couldn't test)

This commit is contained in:
Aleksandr Lebedev 2025-11-06 22:21:14 +01:00
parent bd1f1ee81e
commit b5f7a5be75
5 changed files with 104 additions and 5 deletions

View file

@ -3,7 +3,7 @@
(url "https://git.guix.gnu.org/guix.git")
(branch "master")
(commit
"47df71794f7ee9fc09398382feac12a5d39e6ddd")
"189712d428dc22c5a698216a812dd652725223a3")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"

View file

@ -0,0 +1,55 @@
(define-module (guix-config home services emacs)
#:use-module (gnu services configuration)
#:use-module (gnu packages emacs)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (gnu services)
#:use-module (gnu home services)
#:use-module (gnu packages emacs-xyz)
#:use-module (ice-9 textual-ports) ;for get-string-all
#:export (home-emacs-service-type
home-emacs-configuration))
(define-configuration home-emacs-configuration
(emacs
(package emacs-pgtk)
"The Emacs package to use.")
(config-file
(text-config '())
"The config.el file.")
(early-config-file
(text-config '())
"The early-config.el file.")
; (emacs-packages
; (list-of-packages)
; "Emacs packages to install with emacs")
)
(define package-user-dir "~/.cache/emacs/elpa")
(define (home-emacs-files-service config)
(list `(".emacs.d/config.el"
,(mixed-text-file "config.el"
";; Emacs Config from Guix Home\n"
(call-with-input-file (home-emacs-configuration-config-file config) get-string-all)))
`(".emacs.d/early-config.el"
,(mixed-text-file "early-config.el"
";; Emacs Early Config from Guix Home\n"
(string-append "(make-directory \"" package-user-dir "\" t)\n")
(string-append "(setq package-user-dir \"" package-user-dir "\")\n")
(home-emacs-configuration-early-config-file config)))))
(define (home-emacs-profile-service config)
(list (home-emacs-configuration-emacs config)))
(define home-emacs-service-type
(service-type (name 'home-emacs)
(description "The home service to configure Emacs.")
(extensions
(list (service-extension
home-files-service-type
home-emacs-files-service)
(service-extension
home-profile-service-type
home-emacs-profile-service)))
(default-value (home-emacs-configuration))))

View file

@ -1,6 +1,7 @@
(define-module (guix-config home workstation)
#:use-module (gnu home)
#:use-module (gnu packages emacs)
#:use-module (gnu packages glib)
#:use-module (gnu packages gnuzilla)
#:use-module (gnu packages mail)
#:use-module (gnu packages messaging)
@ -20,12 +21,14 @@
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages admin)
#:use-module (gnu packages fonts)
#:use-module (gnu packages games)
#:use-module (gnu services)
#:use-module (guix gexp)
#:use-module (gnu home services shells)
#:use-module (gnu home services dotfiles)
#:use-module (gnu home services sound)
#:use-module (gnu home services desktop)
#:use-module (guix-config home services emacs)
#:use-module (gnu home services niri))
(home-environment
@ -40,6 +43,8 @@
librewolf
icecat
nheko
supertux
supertuxkart
;birdtray
nextcloud-client
nautilus
@ -50,7 +55,7 @@
wl-clipboard
brightnessctl
qtmultimedia
accountsservice
`(,glib "bin")
matugen
wayland
xwayland-satellite
@ -74,5 +79,16 @@
("guix-full-upgrade" . "guix-pull && reconfigure")))))
(service home-dotfiles-service-type
(home-dotfiles-configuration
(directories '("../../files")))))
(directories '("../../files"))))
; (service home-emacs-service-type
; (home-emacs-configuration
; (emacs emacs-pgtk)
; (config-file
; "../../../.emacs.d/config.el")
; (early-config-file
; "../../../.emacs.d/init.el")
; (emacs-packages (list
; emacs-guix))
;))
)
%base-home-services)))

View file

@ -1,5 +1,6 @@
(define-module (guix-config system base-system)
#:use-module (gnu)
#:use-module (gnu services dbus)
#:use-module (guix)
#:export (base-system))
@ -7,7 +8,25 @@
(define %my-desktop-services
(modify-services %desktop-services
(delete gdm-service-type)))
(delete gdm-service-type)
(elogind-service-type config =>
(elogind-configuration
(inherit config)
(suspend-state '("mem"))
(suspend-mode '("s2idle"))))))
(define my-polkit-wheel
(file-union
"my-polkit-wheel"
`(("share/polkit-1/rules.d/00-my-wheel.rules"
,(plain-file
"00-my-wheel.rules"
"polkit.addRule(function(action, subject) {
if (subject.isInGroup(\"wheel\")) {
return polkit.Result.YES
}
});
")))))
(define base-system
(operating-system
@ -25,6 +44,9 @@
(supplementary-groups '("wheel" "netdev" "audio" "video")))
%base-user-accounts))
;; Globally-installed packages.
; (packages (cons %base-packages))
;; Below is the list of system services. To search for available
;; services, run 'guix system search KEYWORD' in a terminal.
(services
@ -36,6 +58,7 @@
(service gnome-keyring-service-type)
(service bluetooth-service-type)
(service power-profiles-daemon-service-type)
(simple-service 'my-polkit-wheel polkit-service-type (list my-polkit-wheel))
(set-xorg-configuration
(xorg-configuration (keyboard-layout keyboard-layout))))
@ -45,7 +68,6 @@
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
(targets '("/dev/vda"))
(terminal-outputs '(console))
(keyboard-layout keyboard-layout)))
(file-systems (cons (file-system