feat(guix): xsettings, indigo, discord RPC, slack

This commit is contained in:
Pavel Korytov 2021-06-21 09:23:36 +03:00
parent b887ae0c7d
commit 02664b08f7
11 changed files with 267 additions and 30 deletions

View file

@ -1,5 +1,6 @@
(specifications->manifest (specifications->manifest
'( '(
"neofetch"
"osync" "osync"
"nethogs" "nethogs"
"htop" "htop"
@ -8,7 +9,7 @@
"ncurses" "ncurses"
"alacritty" "alacritty"
"xclip" "xclip"
"tmuxp" "python-tmuxp"
"tmux" "tmux"
"rust-starship" "rust-starship"
"dt-colorscripts" "dt-colorscripts"

View file

@ -1,5 +1,6 @@
(specifications->manifest (specifications->manifest
'( '(
"telegram-desktop"
"keepassxc" "keepassxc"
"thunar" "thunar"
"xmodmap" "xmodmap"
@ -13,6 +14,7 @@
"xprop" "xprop"
"xrandr" "xrandr"
"megacmd-1.4" "megacmd-1.4"
"xsettingsd"
"activitywatch-bin" "activitywatch-bin"
"flatpak" "flatpak"
"zathura-djvu" "zathura-djvu"

View file

@ -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

View file

@ -43,14 +43,37 @@
#:start (make-forkexec-constructor '("aw-watcher-window")) #:start (make-forkexec-constructor '("aw-watcher-window"))
#:stop (make-kill-destructor))) #:stop (make-kill-destructor)))
(define pulseeffects
(make <service>
#:provides '(pulseeffects)
#:respawn? #t
#:start (make-forkexec-constructor '("flatpak" "run" "com.github.wwmm.pulseeffects" "--gapplication-service"))
#:stop (make-kill-destructor)))
(define xsettingsd
(make <service>
#:provides '(xsettingsd)
#:respawn? #t
#:start (make-forkexec-constructor '("xsettingsd"))
#:stop (make-kill-destructor)))
(define discord-rich-presence
(make <service>
#: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 (register-services
mpd mpd
mpd-watcher mpd-watcher
mcron mcron
aw-server aw-server
aw-watcher-afk aw-watcher-afk
aw-watcher-window) aw-watcher-window
pulseeffects
xsettingsd
discord-rich-presence)
(action 'shepherd 'daemonize) (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))

View file

@ -472,7 +472,7 @@ symbol = " "
| Guix dependency | | Guix dependency |
|-----------------| |-----------------|
| tmux | | tmux |
| tmuxp | | python-tmuxp |
[[https://github.com/tmux/tmux][tmux]] is my terminal multiplexer of choice. [[https://github.com/tmux/tmux][tmux]] is my terminal multiplexer of choice.
@ -667,6 +667,7 @@ key_bindings:
| htop | Interactive process viewer | | htop | Interactive process viewer |
| nethogs | A tool to group processed by used bandwidth | | nethogs | A tool to group processed by used bandwidth |
| osync | rsync wrapper | | osync | rsync wrapper |
| neofetch | Fetch system info |
| Note | Description | | Note | Description |
|------+-----------------| |------+-----------------|

View file

@ -168,13 +168,25 @@ Xft.dpi: <<get-dpi()>>
A few programs I use to customize the apperance are listed below. A few programs I use to customize the apperance are listed below.
| Guix dependency | Description | | Guix dependency | Description |
|--------------------+-------------------------------------------| |--------------------+-------------------------|
| lxappearance | A program to customize GTK+ themes |
| matcha-theme | My preferred GTK theme | | matcha-theme | My preferred GTK theme |
| papirus-icon-theme | My preferred Icon theme | | papirus-icon-theme | My preferred Icon theme |
| hicolor-icon-theme | For some reason required for lxappearance | | 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 * i3wm
:PROPERTIES: :PROPERTIES:
:header-args+: :tangle ./.config/i3/config :header-args+: :tangle ./.config/i3/config
@ -753,8 +765,8 @@ declare -A BAR_HEIGHT=(
["HDMI-A-0"]="29" ["HDMI-A-0"]="29"
) )
declare -A BLOCKS=( 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" ["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 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 date TSEP"
["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery 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"
) )
@ -2100,8 +2112,8 @@ flatpak install --user <remote> <package>
Packages to install: Packages to install:
#+NAME: flatpak-deps #+NAME: flatpak-deps
| Flatpak dependency | Channel | | Flatpak dependency | Channel |
|------------------------+---------| |------------------------------+---------|
| org.mozilla.firefox | flathub | | com.github.wwmm.pulseeffects | flathub |
| com.discordapp.Discord | flathub | | com.discordapp.Discord | flathub |
| us.zoom.Zoom | flathub | | us.zoom.Zoom | flathub |
| com.slack.Slack | flathub | | com.slack.Slack | flathub |
@ -2115,7 +2127,7 @@ Packages to install:
#+RESULTS: #+RESULTS:
#+begin_example #+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 com.discordapp.Discord
flatpak install --user flathub us.zoom.Zoom flatpak install --user flathub us.zoom.Zoom
flatpak install --user flathub com.slack.Slack flatpak install --user flathub com.slack.Slack
@ -2222,10 +2234,36 @@ aw-watcher-window
#:start (make-forkexec-constructor '("aw-watcher-window")) #:start (make-forkexec-constructor '("aw-watcher-window"))
#:stop (make-kill-destructor))) #:stop (make-kill-destructor)))
#+end_src #+end_src
** Sync ** PulseEffects
| Guix dependency | #+begin_src scheme
|-----------------| (define pulseeffects
| megacmd-1.4 | (make <service>
#: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 <service>
#: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 <service>
#: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 ** Shepherd config
Register services Register services
#+begin_src scheme #+begin_src scheme
@ -2235,7 +2273,10 @@ Register services
mcron mcron
aw-server aw-server
aw-watcher-afk aw-watcher-afk
aw-watcher-window) aw-watcher-window
pulseeffects
xsettingsd
discord-rich-presence)
#+end_src #+end_src
Daemonize shepherd Daemonize shepherd
@ -2245,8 +2286,12 @@ Daemonize shepherd
Run services Run services
#+begin_src scheme #+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 #+end_src
** Sync
| Guix dependency |
|-----------------|
| megacmd-1.4 |
* Guix settings * Guix settings
Other desktop programs I use are listed below. 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 | | xmodmap | Program to modify keybindings on X server |
| thunar | My preferred GUI file manager | | thunar | My preferred GUI file manager |
| keepassxc | My preferred password manager | | keepassxc | My preferred password manager |
| telegram-desktop | telegram client |
#+NAME: packages #+NAME: packages
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no

View file

@ -3870,7 +3870,7 @@ Shows which file is being edited in Emacs.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package elcord (use-package elcord
:straight t :straight t
:if (and (string= (system-name) "pdsk") (not my/slow-ssh)) :if (and (string= (system-name) "indigo") (not my/slow-ssh))
:config :config
(elcord-mode)) (elcord-mode))
#+end_src #+end_src

View file

@ -317,6 +317,42 @@ Default services for each machine:
%base-file-systems))) %base-file-systems)))
#+end_src #+end_src
** indigo
=indigo= is my desktop PC.
#+begin_src scheme :noweb yes :tangle ~/.config/guix/systems/indigo.scm
<<system-common>>
(operating-system
<<system-base>>
(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 ** blue
A VM on which I test Guix. Will probably be deleted sooner or later. 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: I was able to launch the nix version with the following wrapper script:
#+begin_src bash :tangle ~/bin/slack-wrapper #+begin_src bash :tangle ~/bin/slack-wrapper
export PATH="$HOME/bin/dummies:$PATH"
mkdir -p ~/.cache/slack mkdir -p ~/.cache/slack
slack -r ~/.cache/slack slack -r ~/.cache/slack
#+end_src #+end_src
Also, it requires a =lsb_release= in the PATH, so here is one: 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 "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 "Distributor ID: It seems like it requires an lsb_release."
echo "Description: But GNU Guix doesn't have one." echo "Description: But GNU Guix doesn't have one."

8
bin/dummies/lsb_release Executable file
View file

@ -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

View file

@ -27,8 +27,8 @@ declare -A BAR_HEIGHT=(
["HDMI-A-0"]="29" ["HDMI-A-0"]="29"
) )
declare -A BLOCKS=( 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" ["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 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 date TSEP"
["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery 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"
) )

6
bin/slack-wrapper Executable file
View file

@ -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