From 02664b08f71e63f0c5f41e334586e4845fccadff Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Mon, 21 Jun 2021 09:23:36 +0300 Subject: [PATCH] feat(guix): xsettings, indigo, discord RPC, slack --- .config/guix/manifests/console.scm | 3 +- .config/guix/manifests/desktop.scm | 2 + .config/guix/systems/indigo.scm | 113 +++++++++++++++++++++++++++++ .config/shepherd/init.scm | 27 ++++++- Console.org | 3 +- Desktop.org | 90 +++++++++++++++++------ Emacs.org | 2 +- Guix.org | 39 +++++++++- bin/dummies/lsb_release | 8 ++ bin/polybar.sh | 4 +- bin/slack-wrapper | 6 ++ 11 files changed, 267 insertions(+), 30 deletions(-) create mode 100644 .config/guix/systems/indigo.scm create mode 100755 bin/dummies/lsb_release create mode 100755 bin/slack-wrapper diff --git a/.config/guix/manifests/console.scm b/.config/guix/manifests/console.scm index 51352c8..bb62c1a 100644 --- a/.config/guix/manifests/console.scm +++ b/.config/guix/manifests/console.scm @@ -1,5 +1,6 @@ (specifications->manifest '( + "neofetch" "osync" "nethogs" "htop" @@ -8,7 +9,7 @@ "ncurses" "alacritty" "xclip" - "tmuxp" + "python-tmuxp" "tmux" "rust-starship" "dt-colorscripts" diff --git a/.config/guix/manifests/desktop.scm b/.config/guix/manifests/desktop.scm index 871a8bd..40ad434 100644 --- a/.config/guix/manifests/desktop.scm +++ b/.config/guix/manifests/desktop.scm @@ -1,5 +1,6 @@ (specifications->manifest '( + "telegram-desktop" "keepassxc" "thunar" "xmodmap" @@ -13,6 +14,7 @@ "xprop" "xrandr" "megacmd-1.4" + "xsettingsd" "activitywatch-bin" "flatpak" "zathura-djvu" diff --git a/.config/guix/systems/indigo.scm b/.config/guix/systems/indigo.scm new file mode 100644 index 0000000..09d6ea3 --- /dev/null +++ b/.config/guix/systems/indigo.scm @@ -0,0 +1,113 @@ +;; [[file:../../../Guix.org::*indigo][indigo:1]] +(use-modules (gnu)) +(use-modules (gnu system nss)) +(use-modules (gnu packages bash)) +(use-modules ((gnu packages base) #:select (coreutils glibc))) +(use-modules (gnu packages certs)) +(use-modules (gnu packages version-control)) +(use-modules (gnu packages vim)) +(use-modules (gnu packages gnome)) +(use-modules (gnu packages xorg)) +(use-modules (gnu packages wm)) +(use-modules (gnu packages openbox)) +(use-modules (gnu services docker)) +(use-modules (gnu services cups)) +(use-modules (srfi srfi-1)) +(use-modules (guix channels)) +(use-modules (guix inferior)) +(use-modules (nongnu packages linux)) +(use-modules (nongnu system linux-initrd)) + +(use-service-modules desktop networking ssh xorg nix) +(use-package-modules ssh) +(define %my-base-services + (cons* + (service openssh-service-type) + (extra-special-file "/lib64/ld-linux-x86-64.so.2" (file-append glibc "/lib/ld-linux-x86-64.so.2")) + (service nix-service-type) + (service cups-service-type + (cups-configuration + (web-interface? #t))) + (service docker-service-type) + (modify-services %desktop-services + (network-manager-service-type config => + (network-manager-configuration (inherit config) + (vpn-plugins (list network-manager-openvpn))))))) + + +(operating-system + (kernel + (let* + ((channels + (list (channel + (name 'nonguix) + (url "https://gitlab.com/nonguix/nonguix") + (commit "46c1d8bcca674d3a71cd077c52dde9552a89873d")) + (channel + (name 'guix) + (url "https://git.savannah.gnu.org/git/guix.git") + (commit "f463f376e91ccc1fe4ab68d5e822b5d71a1234f5")))) + (inferior + (inferior-for-channels channels))) + (first (lookup-inferior-packages inferior "linux" "5.12.8")))) + ;; (kernel linux) + (initrd microcode-initrd) + (firmware (list linux-firmware)) + (locale "en_US.utf8") + (timezone "Europe/Moscow") + (keyboard-layout (keyboard-layout "us,ru" #:options '("grp:alt_shift_toggle"))) + (users (cons* (user-account + (name "pavel") + (comment "Pavel") + (group "users") + (home-directory "/home/pavel") + (supplementary-groups + '("wheel" ;; sudo + "netdev" ;; network devices + "audio" + "video" + "input" + "tty" + "docker" + "scanner" + "lp"))) + %base-user-accounts)) + + (packages + (append + (list nss-certs + git + i3-gaps + i3lock + openbox + xterm + vim) + %base-packages)) + + (host-name "indigo") + (services (cons* + (set-xorg-configuration + (xorg-configuration + (keyboard-layout keyboard-layout))) + %my-base-services)) + + (bootloader + (bootloader-configuration + (bootloader grub-efi-bootloader) + (target "/boot/efi") + (keyboard-layout keyboard-layout))) + + (swap-devices + (list (uuid "059a2c26-8f70-4986-adf0-1a2e7b511404"))) + + (file-systems + (cons* (file-system + (mount-point "/") + (device (file-system-label "my-root")) + (type "ext4")) + (file-system + (mount-point "/boot/efi") + (device "/dev/sda1") + (type "vfat")) + %base-file-systems))) +;; indigo:1 ends here diff --git a/.config/shepherd/init.scm b/.config/shepherd/init.scm index 0d4f5e4..ddd5a97 100644 --- a/.config/shepherd/init.scm +++ b/.config/shepherd/init.scm @@ -43,14 +43,37 @@ #:start (make-forkexec-constructor '("aw-watcher-window")) #:stop (make-kill-destructor))) +(define pulseeffects + (make + #:provides '(pulseeffects) + #:respawn? #t + #:start (make-forkexec-constructor '("flatpak" "run" "com.github.wwmm.pulseeffects" "--gapplication-service")) + #:stop (make-kill-destructor))) + +(define xsettingsd + (make + #:provides '(xsettingsd) + #:respawn? #t + #:start (make-forkexec-constructor '("xsettingsd")) + #:stop (make-kill-destructor))) + +(define discord-rich-presence + (make + #:provides '(discord-rich-presence) + #:one-shot? #t + #:start (make-system-constructor "ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-0"))) + (register-services mpd mpd-watcher mcron aw-server aw-watcher-afk - aw-watcher-window) + aw-watcher-window + pulseeffects + xsettingsd + discord-rich-presence) (action 'shepherd 'daemonize) -(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window)) +(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window pulseeffects xsettingsd discord-rich-presence)) diff --git a/Console.org b/Console.org index f6084bd..315cc35 100644 --- a/Console.org +++ b/Console.org @@ -472,7 +472,7 @@ symbol = " " | Guix dependency | |-----------------| | tmux | -| tmuxp | +| python-tmuxp | [[https://github.com/tmux/tmux][tmux]] is my terminal multiplexer of choice. @@ -667,6 +667,7 @@ key_bindings: | htop | Interactive process viewer | | nethogs | A tool to group processed by used bandwidth | | osync | rsync wrapper | +| neofetch | Fetch system info | | Note | Description | |------+-----------------| diff --git a/Desktop.org b/Desktop.org index 0462898..ad8e869 100644 --- a/Desktop.org +++ b/Desktop.org @@ -167,14 +167,26 @@ Xft.dpi: <> ** Themes A few programs I use to customize the apperance are listed below. -| Guix dependency | Description | -|--------------------+-------------------------------------------| -| lxappearance | A program to customize GTK+ themes | -| matcha-theme | My preferred GTK theme | -| papirus-icon-theme | My preferred Icon theme | -| hicolor-icon-theme | For some reason required for lxappearance | +| Guix dependency | Description | +|--------------------+-------------------------| +| matcha-theme | My preferred GTK theme | +| papirus-icon-theme | My preferred Icon theme | +| xsettingsd | X11 settings daemon | + +[[https://github.com/derat/xsettingsd][xsettingsd]] is a lightweight daemon which configures X11 applications. It is launched with shepherd in the sevices config below. + +#+begin_src conf-space :tangle ~/.config/xsettingsd/xsettingsd.conf +Net/ThemeName "Matcha-dark-azul" +Net/IconThemeName "Papirus-Dark" +Gtk/DecorationLayout "menu:minimize,maximize,close" +Gtk/FontName "Sans 12" +Gtk/MonospaceFontName "JetbrainsMono Nerd Mono 12" +Gtk/CursorThemeName "Adwaita" +Xft/Antialias 1 +Xft/Hinting 0 +Xft/HintStyle "hintnone" +#+end_src -IIRC the only thing =lxapparance= does is edit GTK config files. * i3wm :PROPERTIES: :header-args+: :tangle ./.config/i3/config @@ -753,8 +765,8 @@ declare -A BAR_HEIGHT=( ["HDMI-A-0"]="29" ) declare -A BLOCKS=( - ["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP" - ["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP" + ["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun date TSEP" + ["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun date TSEP" ["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun date TSEP" ) @@ -2099,12 +2111,12 @@ flatpak install --user Packages to install: #+NAME: flatpak-deps -| Flatpak dependency | Channel | -|------------------------+---------| -| org.mozilla.firefox | flathub | -| com.discordapp.Discord | flathub | -| us.zoom.Zoom | flathub | -| com.slack.Slack | flathub | +| Flatpak dependency | Channel | +|------------------------------+---------| +| com.github.wwmm.pulseeffects | flathub | +| com.discordapp.Discord | flathub | +| us.zoom.Zoom | flathub | +| com.slack.Slack | flathub | #+begin_src emacs-lisp :var table=flatpak-deps :wrap example (mapconcat @@ -2115,7 +2127,7 @@ Packages to install: #+RESULTS: #+begin_example -flatpak install --user flathub org.mozilla.firefox +flatpak install --user flathub com.github.wwmm.pulseeffects flatpak install --user flathub com.discordapp.Discord flatpak install --user flathub us.zoom.Zoom flatpak install --user flathub com.slack.Slack @@ -2222,10 +2234,36 @@ aw-watcher-window #:start (make-forkexec-constructor '("aw-watcher-window")) #:stop (make-kill-destructor))) #+end_src -** Sync -| Guix dependency | -|-----------------| -| megacmd-1.4 | +** PulseEffects +#+begin_src scheme +(define pulseeffects + (make + #:provides '(pulseeffects) + #:respawn? #t + #:start (make-forkexec-constructor '("flatpak" "run" "com.github.wwmm.pulseeffects" "--gapplication-service")) + #:stop (make-kill-destructor))) +#+end_src +** xsettingsd +#+begin_src scheme +(define xsettingsd + (make + #:provides '(xsettingsd) + #:respawn? #t + #:start (make-forkexec-constructor '("xsettingsd")) + #:stop (make-kill-destructor))) +#+end_src +** Discord rich presence + +References: +- [[https://github.com/flathub/com.discordapp.Discord/wiki/Rich-Precense-(discord-rpc)][Rich Precense (discord rpc)]] + +#+begin_src scheme +(define discord-rich-presence + (make + #:provides '(discord-rich-presence) + #:one-shot? #t + #:start (make-system-constructor "ln -sf {app/com.discordapp.Discord,$XDG_RUNTIME_DIR}/discord-ipc-0"))) +#+end_src ** Shepherd config Register services #+begin_src scheme @@ -2235,7 +2273,10 @@ Register services mcron aw-server aw-watcher-afk - aw-watcher-window) + aw-watcher-window + pulseeffects + xsettingsd + discord-rich-presence) #+end_src Daemonize shepherd @@ -2245,8 +2286,12 @@ Daemonize shepherd Run services #+begin_src scheme -(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window)) +(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window pulseeffects xsettingsd discord-rich-presence)) #+end_src +** Sync +| Guix dependency | +|-----------------| +| megacmd-1.4 | * Guix settings Other desktop programs I use are listed below. @@ -2264,6 +2309,7 @@ Other desktop programs I use are listed below. | xmodmap | Program to modify keybindings on X server | | thunar | My preferred GUI file manager | | keepassxc | My preferred password manager | +| telegram-desktop | telegram client | #+NAME: packages #+begin_src emacs-lisp :tangle no diff --git a/Emacs.org b/Emacs.org index 41b3621..765f182 100644 --- a/Emacs.org +++ b/Emacs.org @@ -3870,7 +3870,7 @@ Shows which file is being edited in Emacs. #+begin_src emacs-lisp (use-package elcord :straight t - :if (and (string= (system-name) "pdsk") (not my/slow-ssh)) + :if (and (string= (system-name) "indigo") (not my/slow-ssh)) :config (elcord-mode)) #+end_src diff --git a/Guix.org b/Guix.org index 9834666..af986e2 100644 --- a/Guix.org +++ b/Guix.org @@ -317,6 +317,42 @@ Default services for each machine: %base-file-systems))) #+end_src +** indigo +=indigo= is my desktop PC. + +#+begin_src scheme :noweb yes :tangle ~/.config/guix/systems/indigo.scm +<> + +(operating-system + <> + + (host-name "indigo") + (services (cons* + (set-xorg-configuration + (xorg-configuration + (keyboard-layout keyboard-layout))) + %my-base-services)) + + (bootloader + (bootloader-configuration + (bootloader grub-efi-bootloader) + (target "/boot/efi") + (keyboard-layout keyboard-layout))) + + (swap-devices + (list (uuid "059a2c26-8f70-4986-adf0-1a2e7b511404"))) + + (file-systems + (cons* (file-system + (mount-point "/") + (device (file-system-label "my-root")) + (type "ext4")) + (file-system + (mount-point "/boot/efi") + (device "/dev/sda1") + (type "vfat")) + %base-file-systems))) +#+end_src ** blue A VM on which I test Guix. Will probably be deleted sooner or later. @@ -495,12 +531,13 @@ What a nonsense of a program. I was able to launch the nix version with the following wrapper script: #+begin_src bash :tangle ~/bin/slack-wrapper +export PATH="$HOME/bin/dummies:$PATH" mkdir -p ~/.cache/slack slack -r ~/.cache/slack #+end_src Also, it requires a =lsb_release= in the PATH, so here is one: -#+begin_src bash :tangle ~/bin/lsb_release +#+begin_src bash :tangle ~/bin/dummies/lsb_release echo "LSB Version: Hey. I spent an hour figuring out why Slack doesn't launch." echo "Distributor ID: It seems like it requires an lsb_release." echo "Description: But GNU Guix doesn't have one." diff --git a/bin/dummies/lsb_release b/bin/dummies/lsb_release new file mode 100755 index 0000000..fd96c3b --- /dev/null +++ b/bin/dummies/lsb_release @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# [[file:../../Guix.org::*Slack][Slack:2]] +echo "LSB Version: Hey. I spent an hour figuring out why Slack doesn't launch." +echo "Distributor ID: It seems like it requires an lsb_release." +echo "Description: But GNU Guix doesn't have one." +echo "Release: 42.2" +echo "Codename: n/a" +# Slack:2 ends here diff --git a/bin/polybar.sh b/bin/polybar.sh index 163853b..f054c2f 100755 --- a/bin/polybar.sh +++ b/bin/polybar.sh @@ -27,8 +27,8 @@ declare -A BAR_HEIGHT=( ["HDMI-A-0"]="29" ) declare -A BLOCKS=( - ["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP" - ["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun aw-afk date TSEP" + ["DVI-D-0"]="pulseaudio SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun date TSEP" + ["HDMI-A-0"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP weather SEP sun date TSEP" ["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun date TSEP" ) diff --git a/bin/slack-wrapper b/bin/slack-wrapper new file mode 100755 index 0000000..1fd2b69 --- /dev/null +++ b/bin/slack-wrapper @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +# [[file:../Guix.org::*Slack][Slack:1]] +export PATH="$HOME/bin/dummies:$PATH" +mkdir -p ~/.cache/slack +slack -r ~/.cache/slack +# Slack:1 ends here