From 73af89d935df5a8166114c9257f9f247f29850bf Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Fri, 26 Apr 2024 18:21:56 +0200 Subject: Migrate from stumpwm to sway and from manifests to home-services. --- guix/jd/desktops/base.scm | 128 ++++++++++++++++----------- guix/jd/desktops/mimir.scm | 6 +- guix/jd/home/services/desktop.scm | 178 +++++++++++++++++++++++++++++++------- guix/jd/home/services/emacs.scm | 112 ++++++++++++++++++++++++ guix/jd/packages/emacs.scm | 57 ++++++++++++ guix/jd/utils.scm | 21 +++-- 6 files changed, 412 insertions(+), 90 deletions(-) create mode 100644 guix/jd/home/services/emacs.scm create mode 100644 guix/jd/packages/emacs.scm (limited to 'guix/jd') diff --git a/guix/jd/desktops/base.scm b/guix/jd/desktops/base.scm index db95939..c613c26 100644 --- a/guix/jd/desktops/base.scm +++ b/guix/jd/desktops/base.scm @@ -1,6 +1,7 @@ (define-module (jd desktops base) #:use-module (jd home services polkit) - #:use-module (jd home services desktop) + #:use-module (jd home services desktop) + #:use-module (jd home services emacs) #:use-module (jd services polkit) #:use-module (gnu) @@ -9,61 +10,46 @@ #:use-module (gnu home services desktop) #:use-module (gnu home services gnupg) #:use-module (gnu home services xdg) + #:use-module (gnu home services sound) #:use-module (gnu services) + #:use-module (guix packages) #:use-module (nongnu packages linux) #:use-module (nongnu system linux-initrd)) -(use-package-modules wm gnome gnupg networking virtualization - lisp lisp-xyz cups) +(use-package-modules wm gnome networking virtualization + lisp lisp-xyz cups fonts gnupg) (use-service-modules cups desktop networking ssh xorg docker virtualization pm sound dbus - nix) + nix sddm) (define-public %jd-base-home-services (list - (service home-xdg-mime-applications-service-type - (home-xdg-mime-applications-configuration - (default '((inode/directory . emacs-desktop.desktop) - (application/pdf . emacs-desktop.desktop))) - (desktop-entries - (list (xdg-desktop-entry - (file "emacs-desktop") - (name "Emacs") - (type 'application) - (config - '((exec . "emacsclient -a emacs %u")))))))) - - (service home-redshift-service-type - (home-redshift-configuration - (location-provider 'manual) - (latitude 51.919438) - (longitude 19.145136))) ;; Poland - - (simple-service 'some-useful-env-vars-service - home-environment-variables-service-type - `(("GTK_THEME" . "Adwaita:dark") - ("VISUAL" . "emacsclient") - ("EDITOR" . "emacsclient") - ("PATH" . "$HOME/.bin:$HOME/.npm-global/bin:$PATH") - ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share") - ("SBCL_HOME" . "/run/current-system/profile/lib/sbcl/"))) - - (service home-gpg-agent-service-type - (home-gpg-agent-configuration - (pinentry-program - (file-append pinentry "/bin/pinentry")) - (ssh-support? #t) - (default-cache-ttl 28800) - (max-cache-ttl 28800) - (default-cache-ttl-ssh 28800) - (max-cache-ttl-ssh 28800))) + ;; (service home-redshift-service-type + ;; (home-redshift-configuration + ;; (location-provider 'manual) + ;; (latitude 51.919438) + ;; (longitude 19.145136))) + ;; Poland (service home-dbus-service-type) - + (service home-emacs-service-type) (service home-desktop-service-type) - (service home-polkit-gnome-service-type))) + + ;; Dont know why, but when i put home-gpg-agent-service-type as an + ;; extension in home-desktop-service-type service it doesn't work. + (service home-gpg-agent-service-type + (home-gpg-agent-configuration + (pinentry-program + (file-append pinentry-gnome3 "/bin/pinentry-gnome3")) + (ssh-support? #t) + (default-cache-ttl 28800) + (max-cache-ttl 28800) + (default-cache-ttl-ssh 28800) + (max-cache-ttl-ssh 28800))) + ;; (service home-polkit-gnome-service-type) + )) (define-public %jakub-user @@ -82,7 +68,6 @@ "audio" ;; control audio devices "video" ;; access to webcam "dialout" ;; access to /dev/ttyUSBX devices - "adbusers" )))) (define-public %jd-base-user-accounts @@ -105,6 +90,8 @@ sbcl-stumpwm-battery-portable sbcl-stumpwm-stumptray + sbcl-stumpwm-ttf-fonts + sbcl-drakma sbcl-yason @@ -121,21 +108,54 @@ "xf86-input-libinput" "intel-vaapi-driver" "libva-utils" ;; vainfo - "nss-certs" + ;; "nss-certs" -- it is in %base-packages from fdfd7667c66cf9ce746330f39bcd366e124460e1 "nix"))) (define-public %jd-base-packages (append %root-packages - %stumpwm-packages + ;; %stumpwm-packages %base-packages)) (define-public %jd-base-services (cons* (service openssh-service-type) - (set-xorg-configuration - (xorg-configuration ;for Xorg - (keyboard-layout (keyboard-layout "pl")))) + ;; (set-xorg-configuration + ;; (xorg-configuration ;for Xorg + ;; (keyboard-layout (keyboard-layout "pl")))) + ;; (service greetd-service-type + ;; (greetd-configuration + ;; ;; We need to give the greeter user these permissions, otherwise + ;; ;; Sway will crash on launch. + ;; (greeter-supplementary-groups (list "video" "input")) + ;; (terminals + ;; (list (greetd-terminal-configuration + ;; (terminal-vt "1") + ;; (terminal-switch #t)) + ;; (greetd-terminal-configuration + ;; (terminal-vt "2")) + ;; (greetd-terminal-configuration + ;; (terminal-vt "3")) + ;; (greetd-terminal-configuration + ;; (terminal-vt "4")) + ;; (greetd-terminal-configuration + ;; (terminal-vt "5")) + ;; (greetd-terminal-configuration + ;; (terminal-vt "6")))))) + + (service console-font-service-type + (map (lambda (tty) + (cons tty (file-append + font-terminus + "/share/consolefonts/ter-112n"))) + '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) + + (service screen-locker-service-type + (screen-locker-configuration + (name "swaylock") + (program (file-append swaylock "/bin/swaylock")) + (using-pam? #t) + (using-setuid? #f))) (service network-manager-service-type (network-manager-configuration @@ -180,7 +200,17 @@ (append (list (plain-file "non-guix.pub" "(public-key (ecc (curve Ed25519) (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#)))")) %default-authorized-guix-keys)))) - (delete network-manager-service-type)))) + (delete network-manager-service-type) + ;; (delete mingetty-service-type) + (delete console-font-service-type) + + (delete pulseaudio-service-type) + (delete alsa-service-type) + (delete (if (string-prefix? "x86_64" + (or (%current-target-system) + (%current-system))) + gdm-service-type + sddm-service-type))))) ;; Odin is a base for my operating systems (define-public odin-free diff --git a/guix/jd/desktops/mimir.scm b/guix/jd/desktops/mimir.scm index 742f8c5..7d9823d 100644 --- a/guix/jd/desktops/mimir.scm +++ b/guix/jd/desktops/mimir.scm @@ -18,17 +18,17 @@ (swap-devices (list (swap-space (target (uuid - "658793cb-d374-426e-bcd5-00d032b003a0"))))) + "5402ec34-85b8-4716-9c37-3d38c452ef98"))))) (file-systems (cons* (file-system (mount-point "/boot/efi") - (device (uuid "64D8-134F" + (device (uuid "1A88-DB36" 'fat32)) (type "vfat")) (file-system (mount-point "/") (device (uuid - "1f9304b0-5623-4248-ab66-534b5ac85876" + "640c44ea-125f-4410-a8de-3ec0fb3656c4" 'ext4)) (type "ext4")) %base-file-systems)))) diff --git a/guix/jd/home/services/desktop.scm b/guix/jd/home/services/desktop.scm index bb4916e..c53377f 100644 --- a/guix/jd/home/services/desktop.scm +++ b/guix/jd/home/services/desktop.scm @@ -4,51 +4,165 @@ #:use-module (gnu packages networking) #:use-module (gnu packages syncthing) #:use-module (gnu packages gnome) + #:use-module (gnu packages gnupg) #:use-module (gnu services) #:use-module (gnu services configuration) #:use-module (gnu home services) #:use-module (gnu home services shepherd) #:use-module (gnu home services desktop) + #:use-module (gnu home services sound) + #:use-module (gnu home services xdg) + #:use-module (gnu home services gnupg) #:use-module (guix gexp)) (define (desktop-profile-service config) - (specifications->packages '("udiskie" + (specifications->packages '(;; sway + "swayfx" + "swaylock" + "swayidle" + "waybar" + "fuzzel" + "foot" + "mako" + "wl-clipboard" + "wlsunset" + "grimshot" + + "udiskie" + ;; rest + "qutebrowser" + "ungoogled-chromium" + "firefox" + "tor-client" + "signal-desktop" + + "pulsemixer" + "pavucontrol" + "alsa-utils" + + "virt-manager" + + "flatpak" + "redshift" + "fontmanager" + + "polybar" + + "blueman" + + "xdg-utils" + "xdg-dbus-proxy" + "xdg-desktop-portal-gtk" + "xdg-desktop-portal-wlr" + "glib:bin" + "gtk+:bin" + "gnome-keyring" + "shared-mime-info" + "libnotify" + "dconf" + "hicolor-icon-theme" + + "dunst" + + "gimp" + "inkscape" + + "mpv" + "youtube-dl" + + "pamixer" + "playerctl" + "scrot" + "brightnessctl" + "upower" + "tlp" + "feh" + "alacritty" + + "curl" + "wget" + "zip" + "unzip" + "qrencode" + "trash-cli" + "pandoc" + "password-store" + "oath-toolkit" + ;; "pinentry" + + "syncthing" "syncthing-gtk" - "network-manager-applet"))) - -(define (desktop-shepherd-services config) - (list (shepherd-service - (documentation "Udiskie daemon with tray.") - (provision '(udiskie)) - (start #~(make-forkexec-constructor - (list #$(file-append udiskie - "/bin/udiskie") - "-t"))) - (stop #~(make-kill-destructor))) - - (shepherd-service - (documentation "Syncthing daemon with tray.") - (provision '(syncthing-gtk)) - (start #~(make-forkexec-constructor - (list #$(file-append syncthing-gtk - "/bin/syncthing-gtk") - "-m"))) - (stop #~(make-kill-destructor))) - - (shepherd-service - (documentation "NetworkManager tray.") - (provision '(nm-applet)) - (start #~(make-forkexec-constructor - (list #$(file-append network-manager-applet - "/bin/nm-applet")))) - (stop #~(make-kill-destructor))))) + + "xmodmap" + "xrandr" + "arandr" + "xss-lock" + "libinput" + "xinput" + "xprop" + "rlwrap" + + "nheko" + "quassel"))) + +(define (desktop-environment-variables-service config) + `(("GTK_THEME" . "Adwaita:dark") + ("VISUAL" . "emacsclient") + ("EDITOR" . "emacsclient") + ("PATH" . "$HOME/.bin:$HOME/.npm-global/bin:$PATH") + ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share") + ("SBCL_HOME" . "/run/current-system/profile/lib/sbcl/") + + ;; Set Wayland-specific environment variables (taken from RDE) + ("XDG_CURRENT_DESKTOP" . "sway") + ("XDG_SESSION_TYPE" . "wayland") + ("RTC_USE_PIPEWIRE" . "true") + ("SDL_VIDEODRIVER" . "wayland") + ("MOZ_ENABLE_WAYLAND" . "1") + ("CLUTTER_BACKEND" . "wayland") + ("ELM_ENGINE" . "wayland_egl") + ("ECORE_EVAS_ENGINE" . "wayland-egl") + ("QT_QPA_PLATFORM" . "wayland-egl"))) + +(define (desktop-xdg-mime-applications-service config) + (home-xdg-mime-applications-configuration + (default '((inode/directory . emacsclient.desktop) + (application/pdf . emacsclient.desktop) + (x-scheme-handler/http= . firefox.desktop) + (x-scheme-handler/https= . firefox.desktop))) + ;; (desktop-entries + ;; (list (xdg-desktop-entry + ;; (file "emacs-desktop") + ;; (name "Emacs") + ;; (type 'application) + ;; (config + ;; '((exec . "emacsclient -a emacs %u")))))) + )) + +(define (desktop-gpg-agent-service config) + (home-gpg-agent-configuration + (pinentry-program + (file-append pinentry-gnome3 "/bin/pinentry-gnome3")) + (ssh-support? #t) + (default-cache-ttl 28800) + (max-cache-ttl 28800) + (default-cache-ttl-ssh 28800) + (max-cache-ttl-ssh 28800))) + (define-public home-desktop-service-type - (service-type (name 'home-udiskie) + (service-type (name 'home-desktop) (extensions (list (service-extension home-profile-service-type desktop-profile-service) - (service-extension home-shepherd-service-type - desktop-shepherd-services))) + (service-extension home-environment-variables-service-type + desktop-environment-variables-service) + (service-extension home-pipewire-service-type + (lambda (_) (home-pipewire-configuration))) + (service-extension home-xdg-mime-applications-service-type + desktop-xdg-mime-applications-service) + (service-extension home-gpg-agent-service-type + desktop-gpg-agent-service) + )) (default-value #f) (description "Runs desktop services."))) diff --git a/guix/jd/home/services/emacs.scm b/guix/jd/home/services/emacs.scm new file mode 100644 index 0000000..5eb74e8 --- /dev/null +++ b/guix/jd/home/services/emacs.scm @@ -0,0 +1,112 @@ +(define-module (jd home services emacs) + #:use-module (jd packages emacs) + + #:use-module (gnu packages) + #:use-module (gnu packages emacs) + + #:use-module (gnu services) + #:use-module (gnu services configuration) + #:use-module (gnu home services) + #:use-module (gnu home services shepherd) + #:use-module (gnu home services desktop) + + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix profiles)) + +(define-configuration home-emacs-service-configuration + (emacs-package + (package emacs-next-pgtk) + "Emacs packages")) + +(define (emacs-profile-service config) + (append (list emacs-org-roam-ui + emacs-lsp-mode! + (home-emacs-service-configuration-emacs-package + config)) + (specifications->packages '("emacs-sway" + "emacs-shackle" + "emacs-ytdl" + "emacs-desktop-environment" + "emacs-exwm" + "emacs-perspective" + "emacs-mu4e-alert" + "mu" + "isync" + "emacs-htmlize" + "emacs-bluetooth" + "emacs-nov-el" + "emacs-password-store" + "emacs-mastodon" + "emacs-elfeed" + "emacs-pdf-tools" + "emacs-emms" + "emacs-all-the-icons-dired" + "emacs-vterm" + "emacs-restclient" + "emacs-magit" + "emacs-neotree" + "emacs-projectile" + "emacs-company-box" + "emacs-company" + "emacs-docker" + "emacs-yaml-mode" + "emacs-web-mode" + "emacs-flycheck" + "emacs-tide" + "emacs-cider" + "emacs-typescript-mode" + "emacs-pyvenv" + "emacs-geiser-guile" + "emacs-racket-mode" + "emacs-geiser-racket" + "emacs-geiser" + "emacs-sly" + "emacs-rainbow-delimiters" + "emacs-paredit" + ;; "emacs-lsp-ivy" + ;; "emacs-lsp-mode" + "emacs-org-pomodoro" + "emacs-org-roam" + "emacs-org-roam-bibtex" + "emacs-org-superstar" + "emacs-org" + "emacs-ox-pandoc" + "emacs-beacon" + "emacs-all-the-icons" + "emacs-which-key" + "emacs-counsel" + "emacs-ivy" + "emacs-hl-todo" + "emacs-diminish" + "emacs-solarized-theme" + "font-terminus" + "emacs-undo-tree" + "emacs-hydra" + "emacs-multiple-cursors" + "emacs-general" + "emacs-guix" + "emacs-doom-modeline" + "emacs-use-package")))) + +(define (emacs-shepherd-services config) + (list (shepherd-service + (documentation "Emacs daemon.") + (provision '(emacs)) + (start #~(make-forkexec-constructor + (list #$(file-append (home-emacs-service-configuration-emacs-package + config) + "/bin/emacs") + "--fg-daemon"))) + (stop #~(make-kill-destructor))))) + +(define-public home-emacs-service-type + (service-type (name 'home-emacs) + (extensions (list (service-extension home-profile-service-type + emacs-profile-service) + (service-extension home-shepherd-service-type + emacs-shepherd-services) + )) + (default-value (home-emacs-service-configuration)) + (description "Runs emacs daemon service."))) + diff --git a/guix/jd/packages/emacs.scm b/guix/jd/packages/emacs.scm new file mode 100644 index 0000000..0b9b19d --- /dev/null +++ b/guix/jd/packages/emacs.scm @@ -0,0 +1,57 @@ +(define-module (jd packages emacs) + #:use-module (gnu packages emacs-xyz) + #:use-module (gnu packages) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system emacs) + #:use-module ((guix licenses) #:prefix license:) + #:export (emacs-org-roam-ui + emacs-lsp-mode!)) + + +(define emacs-org-roam-ui + (let ((commit "9474a254390b1e42488a1801fed5826b32a8030b") + (revision "0")) + (package + (name "emacs-org-roam-ui") + (version (git-version "0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/org-roam/org-roam-ui") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0v54vxh95izch74wz2dl2dkdqicbvshra55l6qvd4xl5qmfhpjdc")))) + (build-system emacs-build-system) + (arguments + `(#:include (cons "^out" %default-include))) + (propagated-inputs + (list emacs-org-roam emacs-websocket emacs-simple-httpd emacs-f)) + (home-page "https://github.com/org-roam/org-roam-ui") + (synopsis "A graphical frontend for your org-roam Zettelkasten") + (description " Org-Roam-UI is a frontend for exploring and interacting +with your @code{org-roam} notes. It is meant a successor of +@code{org-roam-server} that extends functionality of org-roam with a Web app +that runs side-by-side with Emacs.") + (license license:gpl3+)))) + + + +(define emacs-lsp-mode! + (let ((commit "808c4d0ab9f19bb92c56716cf59df89432b63f5d") + (revision "1")) + (package + (inherit emacs-lsp-mode) + (name "emacs-lsp-mode") + (version (git-version "8.0.1" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/emacs-lsp/lsp-mode") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0ridjhzndwjj8947vabq05njgnns74hi69x77axgcbv1c4nasz2y"))))))) diff --git a/guix/jd/utils.scm b/guix/jd/utils.scm index 5be7fa9..f4a35c1 100644 --- a/guix/jd/utils.scm +++ b/guix/jd/utils.scm @@ -3,15 +3,24 @@ ;; This code is copied and modified from (gnu packages) module. -(define %jd-patch-path +(define (make-custom-load-path dir-path) (make-parameter (map (lambda (directory) - (let ((jd-patch-dir (string-append directory "/jd/packages/patches"))) - (if (and (file-exists? jd-patch-dir) - (file-is-directory? jd-patch-dir)) - jd-patch-dir + (let ((custom-dir (string-append directory dir-path))) + (if (and (file-exists? custom-dir) + (file-is-directory? custom-dir)) + custom-dir directory))) - %load-path))) + %load-path))) + +(define (make-custom-searcher load-path) + (lambda (file-name) + (or (search-path (load-path) file-name) + (raise (string-append file-name + ": not found"))))) + +(define %jd-patch-path (make-custom-load-path "/jd/packages/patches")) +(define %jd-dot-files-path (make-custom-load-path "/jd/home/services/dotfiles")) (define (jd-search-patch file-name) "Search the patch FILE-NAME. Raise an error if not found." -- cgit v1.2.3