Merge pull request #1 from SqrtMinusOne/guix

Guix
This commit is contained in:
Pavel Korytov 2021-06-20 07:40:24 +03:00 committed by GitHub
commit fc674b8142
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 2270 additions and 450 deletions

View file

@ -1,22 +0,0 @@
! [[file:Desktop.org::*Xresources][Xresources:2]]
*color0: #292d3e
*color1: #f07178
*color2: #c3e88d
*color3: #ffcb6b
*color4: #82aaff
*color5: #c792ea
*color6: #89ddff
*color7: #d0d0d0
*color8: #434758
*color9: #ff8b92
*color10: #ddffa7
*color11: #ffe585
*color12: #9cc4ff
*color13: #e1acff
*color14: #a3f7ff
*color15: #ffffff
*background: #292d3e
*foreground: #d0d0d0
! Xresources:2 ends here

View file

@ -1,4 +1,4 @@
# [[file:Shell.org::*=.bash_profile=][=.bash_profile=:1]]
# [[file:Console.org::*=.bash_profile=][=.bash_profile=:1]]
[[ -f ~/.profile ]] && . ~/.profile
[[ -f ~/.bashrc ]] && . ~/.bashrc

92
.bashrc
View file

@ -1,23 +1,37 @@
# [[file:Shell.org::*Startup & environment][Startup & environment:1]]
[[ $- != *i* ]] && return
xhost +local:root > /dev/null 2>&1
use_fish=true
# [[file:Console.org::*Startup & environment][Startup & environment:1]]
export SHELL
# Startup & environment:1 ends here
# [[file:Shell.org::*Startup & environment][Startup & environment:2]]
export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'"
# [[file:Console.org::*Startup & environment][Startup & environment:2]]
if [[ $- != *i* ]]
then
[[ -n "$SSH_CLIENT" ]] && source /etc/profile
return
fi
# Startup & environment:2 ends here
# [[file:Shell.org::*Launch fish][Launch fish:1]]
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} ]]
# [[file:Console.org::*Startup & environment][Startup & environment:3]]
source /etc/bashrc
# Startup & environment:3 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:4]]
xhost +local:root > /dev/null 2>&1
# Startup & environment:4 ends here
# [[file:Console.org::*Startup & environment][Startup & environment:5]]
export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'"
# Startup & environment:5 ends here
# [[file:Console.org::*Launch fish][Launch fish:1]]
use_fish=true
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} && $(command -v fish) ]]
then
exec fish
fi
# Launch fish:1 ends here
# [[file:Shell.org::*Colors][Colors:1]]
# [[file:Console.org::*Colors][Colors:1]]
use_color=true
# Set colorful PS1 only on colorful terminals.
@ -66,7 +80,7 @@ fi
unset use_color safe_term match_lhs sh
# Colors:1 ends here
# [[file:Shell.org::*Settings][Settings:1]]
# [[file:Console.org::*Settings][Settings:1]]
complete -cf sudo # Sudo autocompletion
shopt -s checkwinsize # Check windows size after each command
@ -74,47 +88,49 @@ shopt -s expand_aliases # Aliases
shopt -s autocd # Cd to directory just by typing its name (without cd)
# Settings:1 ends here
# [[file:Shell.org::*Settings][Settings:2]]
# [[file:Console.org::*Settings][Settings:2]]
shopt -s histappend
export HISTCONTROL=ignoredups:erasedups
HISTSIZE=
HISTFILESIZE=
# Settings:2 ends here
# [[file:Shell.org::*Settings][Settings:3]]
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
if [ -d "/usr/share/fzf" ]; then
source /usr/share/fzf/completion.bash
source /usr/share/fzf/key-bindings.bash
fi
# Settings:3 ends here
# [[file:Shell.org::*Aliases][Aliases:1]]
# [[file:Console.org::*Aliases][Aliases:1]]
alias v="vim"
alias gg="lazygit"
alias ls="exa --icons"
alias ll="exa -lah --icons"
alias q="exit"
alias c="clear"
alias ic="init_conda"
# Aliases:1 ends here
# [[file:Shell.org::*Anaconda][Anaconda:1]]
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/pavel/Programs/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/pavel/Programs/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/pavel/Programs/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/home/pavel/Programs/miniconda3/bin:$PATH"
fi
# [[file:Console.org::*Aliases][Aliases:2]]
if [[ ! -z "$SIMPLE" ]]; then
unalias ls
alias ll="ls -lah"
fi
unset __conda_setup
# <<< conda initialize <<<
# Aliases:2 ends here
# [[file:Console.org::*Anaconda][Anaconda:1]]
init_conda () {
__conda_setup="$('/home/pavel/.guix-extra-profiles/dev/dev/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh" ]; then
. "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh"
else
# export PATH="/home/pavel/Programs/miniconda3/bin:$PATH"
echo "what"
fi
fi
unset __conda_setup
}
# Anaconda:1 ends here
# [[file:Shell.org::*Starship prompt][Starship prompt:1]]
eval "$(starship init bash)"
# [[file:Console.org::*Starship prompt][Starship prompt:1]]
if [[ -z "$SIMPLE" ]]; then
eval "$(starship init bash)"
fi
# Starship prompt:1 ends here

1
.config/cron/mail.guile Normal file
View file

@ -0,0 +1 @@
(job "*/5 * * * * " "~/bin/scripts/check-email")

View file

@ -1,8 +1,8 @@
# [[file:../../Shell.org::*Fish][Fish:1]]
# [[file:../../Console.org::*Fish][Fish:1]]
starship init fish | source
# Fish:1 ends here
# [[file:../../Shell.org::*Fish][Fish:2]]
# [[file:../../Console.org::*Fish][Fish:2]]
fish_vi_key_bindings
alias v="vim"
@ -11,17 +11,21 @@ alias ls="exa --icons"
alias ll="exa -lah --icons"
alias q="exit"
alias c="clear"
alias ic="init_conda"
# Fish:2 ends here
# [[file:../../Shell.org::*Fish][Fish:3]]
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
eval /home/pavel/Programs/miniconda3/bin/conda "shell.fish" "hook" $argv | source
# <<< conda initialize <<<
# [[file:../../Console.org::*Fish][Fish:3]]
function init_conda
eval /home/pavel/.guix-extra-profiles/dev/dev/bin/conda "shell.fish" "hook" $argv | source
end
# Fish:3 ends here
# [[file:../../Shell.org::*Fish][Fish:4]]
# [[file:../../Console.org::*Fish][Fish:4]]
if ! test -n "$TMUX"; and ! test -n "$IS_EMACS";
colorscript random
end
# Fish:4 ends here
# [[file:../../Console.org::*Fish][Fish:5]]
set fish_greeting
# Fish:5 ends here

24
.config/guix/channels.scm Normal file
View file

@ -0,0 +1,24 @@
;; [[file:../../Guix.org::*Channels][Channels:1]]
(cons*
(channel
(name 'channel-q)
(url "https://github.com/SqrtMinusOne/channel-q.git"))
(channel
(name 'flat)
(url "https://github.com/flatwhatson/guix-channel.git")
(introduction
(make-channel-introduction
"33f86a4b48205c0dc19d7c036c85393f0766f806"
(openpgp-fingerprint
"736A C00E 1254 378B A982 7AF6 9DBE 8265 81B6 4490"))))
(channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix")
(commit "d3c5eea0cbfe3e5bfbcf1fe15bc916fefacc624f")
(introduction
(make-channel-introduction
"897c1a470da759236cc11798f4e0a5f7d4d59fbc"
(openpgp-fingerprint
"2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))
%default-channels)
;; Channels:1 ends here

View file

@ -0,0 +1,4 @@
(specifications->manifest
'(
"firefox"
"ungoogled-chromium"))

View file

@ -0,0 +1,17 @@
(specifications->manifest
'(
"osync"
"nethogs"
"htop"
"bat"
"exa"
"ncurses"
"alacritty"
"xclip"
"tmuxp"
"tmux"
"rust-starship"
"dt-colorscripts"
"fish"
"xhost"
"xrdb"))

View file

@ -0,0 +1,37 @@
(specifications->manifest
'(
"keepassxc"
"thunar"
"xmodmap"
"copyq"
"feh"
"network-manager-applet"
"pavucontrol"
"ponymix"
"light"
"arandr"
"xprop"
"xrandr"
"megacmd"
"activitywatch-bin"
"flatpak"
"zathura-djvu"
"zathura-pdf-poppler"
"zathura-ps"
"zathura"
"picom"
"keynav"
"libnotify"
"dunst"
"flameshot"
"rofi"
"sunwait"
"jq"
"curl"
"bind"
"polybar"
"i3-gaps"
"hicolor-icon-theme"
"papirus-icon-theme"
"matcha-theme"
"lxappearance"))

View file

@ -0,0 +1,5 @@
(specifications->manifest
'("emacs-native-comp"
"the-silver-searcher"
"ripgrep"
"emacs-vterm"))

View file

@ -0,0 +1,3 @@
(specifications->manifest
'(
"texlive"))

View file

@ -0,0 +1,6 @@
(specifications->manifest
'(
"msmtp"
"parallel"
"notmuch"
"python-lieer"))

View file

@ -0,0 +1,7 @@
(specifications->manifest
'(
"mpd-mpc"
"mpd-watcher"
"picard"
"ncmpcpp"
"mpd"))

View file

@ -0,0 +1,4 @@
(specifications->manifest
'(
"gimp"
"libreoffice"))

View file

@ -0,0 +1,3 @@
(specifications->manifest
'(
))

View file

@ -0,0 +1,129 @@
;; [[file:../../../Guix.org::*azure][azure: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)))))))
(define %backlight-udev-rule
(udev-rule
"90-backlight.rules"
(string-append "ACTION==\"add\", SUBSYSTEM==\"backlight\", "
"RUN+=\"/run/current-system/profile/bin/chgrp video /sys/class/backlight/%k/brightness\""
"\n"
"ACTION==\"add\", SUBSYSTEM==\"backlight\", "
"RUN+=\"/run/current-system/profile/bin/chmod g+w /sys/class/backlight/%k/brightness\"")))
(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 "azure")
(services (cons*
(set-xorg-configuration
(xorg-configuration
(keyboard-layout keyboard-layout)))
(modify-services %my-base-services
(elogind-service-type config =>
(elogind-configuration (inherit config)
(handle-lid-switch-external-power 'suspend)))
(udev-service-type config =>
(udev-configuration (inherit config)
(rules (cons %backlight-udev-rule
(udev-configuration-rules config))))))))
(bootloader
(bootloader-configuration
(bootloader grub-efi-bootloader)
(target "/boot/efi")
(keyboard-layout keyboard-layout)))
(swap-devices
(list (uuid "4b2dedb3-b111-4e69-8c05-6daa2b072c76")))
(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)))
;; azure:1 ends here

View file

@ -0,0 +1,93 @@
;; [[file:../../../Guix.org::*blue][blue: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 (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)
(use-package-modules ssh)
(define %my-desktop-services
(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"
"lp")))
%base-user-accounts))
(packages
(append
(list nss-certs
git
i3-gaps
openbox
xterm
vim)
%base-packages))
(host-name "blue")
(bootloader
(bootloader-configuration
(bootloader grub-bootloader)
(target "/dev/sda")
(keyboard-layout keyboard-layout)))
(swap-devices
(list (uuid "d9ca4f8b-4bb1-420e-9371-3558731bada1")))
(file-systems
(cons* (file-system
(mount-point "/")
(device
(uuid "179fbd75-3c7f-4de2-8c4f-4c30939b8a3f"
'ext4))
(type "ext4"))
%base-file-systems)))
;; blue:1 ends here

View file

@ -9,8 +9,8 @@ floating_modifier $mod
mouse_warping output
# Apply XFCE Settings
exec xfsettingsd
exec xiccd
# exec xfsettingsd
# exec xiccd
# Most needed keybindigs
# reload the configuration file
@ -294,14 +294,14 @@ bindsym $mod+semicolon mode "apps"
mode "apps" {
bindsym Escape mode "default"
bindsym b exec firefox; mode default
bindsym v exec vk-messenger; mode default
bindsym s exec slack; mode default;
bindsym d exec discord; mode default;
bindsym v exec vk; mode default
bindsym s exec "flatpak run com.slack.Slack"; mode default;
bindsym d exec "flatpak run com.discordapp.Discord"; mode default;
bindsym m exec "alacritty -e ncmpcpp"; mode default
bindsym c exec "copyq toggle"; mode default
bindsym k exec "keepassxc"; mode default
# bindsym e exec mailspring; mode default
bindsym a exec "bash /home/pavel/bin/emacs.sh"; mode default
bindsym a exec emacs; mode default
bindsym n exec "alacritty -e newsboat"; mode default
bindsym w exec "alacritty /home/pavel/bin/scripts/run_wego"; mode default
# bindsym a exec emacsclient -c; mode default
@ -311,13 +311,13 @@ mode "apps" {
# [[file:../../Desktop.org::*Media controls & brightness][Media controls & brightness:1]]
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ +5%"
bindsym XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ -5%"
bindsym XF86AudioMute exec --no-startup-id "pactl set-sink-mute @DEFAULT_SINK@ toggle"
bindsym XF86AudioRaiseVolume exec --no-startup-id "ponymix increase 5"
bindsym XF86AudioLowerVolume exec --no-startup-id "ponymix decrease 5"
bindsym XF86AudioMute exec --no-startup-id "ponymix toggle"
exec --no-startup-id xmodmap -e 'keycode 135 = Super_R' && xset -r 135
bindsym $mod+F2 exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ -5%"
bindsym $mod+F3 exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ +5%"
bindsym $mod+F2 exec --no-startup-id "ponymix increase 5"
bindsym $mod+F3 exec --no-startup-id "ponymix decrease 5"
# Media player controls
bindsym XF86AudioPlay exec mpc toggle
@ -326,8 +326,8 @@ bindsym XF86AudioNext exec mpc next
bindsym XF86AudioPrev exec mpc prev
# Screen brightness
bindsym XF86MonBrightnessUp exec xbacklight -inc 5
bindsym XF86MonBrightnessDown exec xbacklight -dec 5
bindsym XF86MonBrightnessUp exec light -A 5
bindsym XF86MonBrightnessDown exec light -U 5
# Media controls & brightness:1 ends here
# [[file:../../Desktop.org::*Screenshots][Screenshots:1]]
@ -367,10 +367,10 @@ bindsym $mod+slash exec toggle_layout
exec_always --no-startup-id "bash /home/pavel/bin/polybar.sh"
# PulseEffects
exec --no-startup-id pulseeffects --gapplication-service
# exec --no-startup-id pulseeffects --gapplication-service
# Sudo
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# Wallpaper
exec_always "feh --bg-fill ~/Pictures/wallpaper.jpg"
@ -382,18 +382,21 @@ exec picom
exec keynav
# Applets
exec --no-startup-id /usr/bin/nm-applet
exec --no-startup-id /usr/bin/blueman-applet
exec --no-startup-id nm-applet
# exec --no-startup-id /usr/bin/blueman-applet
# MPD
exec --no-startup-id mpd
# exec --no-startup-id mpd
# Stuff
exec aw-qt
exec "vnstatd -d"
# exec aw-qt
# exec "bash ~/bin/aw-start"
exec shepherd
# exec "vnstatd -d"
exec dunst
exec kde-connect-indicator
# exec kde-connect-indicator
exec copyq
exec "xmodmap ~/.Xmodmap"
exec "bash ~/bin/autostart.sh"
# exec "xrdb -merge ~/.Xresources"
# exec "bash ~/bin/autostart.sh"
# Autostart:1 ends here

View file

@ -16,15 +16,15 @@ audio_output {
format "44100:16:2"
}
visualizer_fifo_path = /tmp/mpd.fifo
# visualizer_fifo_path = /tmp/mpd.fifo
visualizer_output_name = Visualizer feed
visualizer_in_stereo = yes
visualizer_sync_interval = 30
# visualizer_sync_interval = 30
# Available values: spectrum, wave, wave_filled, ellipse.
visualizer_type = spectrum
# visualizer_type = spectrum
visualizer_look = ●▮
#visualizer_color = blue, cyan, green, yellow, magenta, red
visualizer_color = 41, 83, 119, 155, 185, 215, 209, 203, 197, 161

56
.config/shepherd/init.scm Normal file
View file

@ -0,0 +1,56 @@
(define mpd
(make <service>
#:provides '(mpd)
#:respawn? #t
#:start (make-forkexec-constructor '("mpd" "--no-daemon"))
#:stop (make-kill-destructor)))
(define mpd-watcher
(make <service>
#:provides '(mpd-watcher)
#:respawn? #t
#:start (make-forkexec-constructor '("mpd_watcher"))
#:stop (make-kill-destructor)
#:requires '(mpd)))
(define mcron
(make <service>
#:provides '(mcron)
#:respawn? #t
#:start (make-forkexec-constructor '("mcron"))
#:stop (make-kill-destructor)))
(define aw-server
(make <service>
#:provides '(aw-server)
#:respawn? #t
#:start (make-forkexec-constructor '("aw-server"))
#:stop (make-kill-destructor)))
(define aw-watcher-afk
(make <service>
#:provides '(aw-watcher-afk)
#:requires '(aw-server)
#:respawn? #t
#:start (make-forkexec-constructor '("aw-watcher-afk"))
#:stop (make-kill-destructor)))
(define aw-watcher-window
(make <service>
#:provides '(aw-watcher-window)
#:requires '(aw-server)
#:respawn? #t
#:start (make-forkexec-constructor '("aw-watcher-window"))
#:stop (make-kill-destructor)))
(register-services
mpd
mpd-watcher
mcron
aw-server
aw-watcher-afk
aw-watcher-window)
(action 'shepherd 'daemonize)
(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window))

View file

@ -1,8 +1,5 @@
# [[file:../Console.org::*Starship prompt][Starship prompt:1]]
[character]
# success_symbol = "[➤](bold green)"
# vicmd_symbol = "[ᐊ](bold green)"
# error_symbol = "[](bold red)"
success_symbol = "[➤ ](bold green)"
error_symbol = "[ ](bold red)"
vicmd_symbol = "[ᐊ ](bold green)"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
LINKS=(
"$HOME/.config/tridactyl/themes $HOME/themes"
"$HOME/.config/tridactyl/.tridactylrc $HOME/.tridactylrc"

View file

@ -37,7 +37,7 @@
(garbage-collect))))
(add-hook 'after-focus-change-function 'garbage-collect))))
(setq my/lowpower (string= (system-name) "pntk"))
(setq my/lowpower (string= (system-name) "azure"))
(setq my/slow-ssh (string= (getenv "IS_TRAMP") "true"))
@ -46,13 +46,13 @@
(use-package conda
:straight t
:if (executable-find "conda")
:config
(setq conda-anaconda-home (expand-file-name "~/Programs/miniconda3/"))
(setq conda-env-home-directory (expand-file-name "~/Programs/miniconda3/"))
(setq conda-env-subdirectory "envs"))
(unless (getenv "CONDA_DEFAULT_ENV")
(conda-env-activate "base"))
(setq conda-env-subdirectory "envs")
(unless (getenv "CONDA_DEFAULT_ENV")
(conda-env-activate "base")))
(setenv "IS_EMACS" "true")
@ -126,6 +126,7 @@
'(eww
dired
debug
guix
calc
docker
geiser
@ -559,6 +560,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(use-package wakatime-mode
:straight t
:config
(advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path "/home/pavel/bin/wakatime")))
(global-wakatime-mode))
(use-package request
@ -586,8 +588,6 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(setq make-pointer-invisible t)
(set-frame-font "JetBrainsMono Nerd Font 10" nil t)
(global-display-line-numbers-mode 1)
(line-number-mode nil)
(setq display-line-numbers-type 'visual)
@ -618,6 +618,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(setq doom-themes-treemacs-theme "doom-colors")
(doom-themes-treemacs-config))
(set-frame-font "JetBrainsMono Nerd Font 10" nil t)
(setq-default frame-title-format
'(""
"emacs"
@ -843,6 +845,11 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
vc-ignore-dir-regexp
tramp-file-name-regexp))
(with-eval-after-load 'tramp
(setq tramp-remote-path
(append tramp-remote-path
'(tramp-own-remote-path))))
(defun my/dired-bookmark-open ()
(interactive)
(unless (boundp 'my/dired-bookmarks)
@ -858,7 +865,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
bookmarks)))))
(use-package vterm
:straight t
;; :straight t
:commands (vterm vterm-other-window)
:config
(setq vterm-kill-buffer-on-exit t)
@ -973,7 +980,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(general-nmap "~" 'eshell))
(use-package org
:straight org-plus-contrib
:straight t
:defer t
:config
(setq org-directory (expand-file-name "~/Documents/org-mode"))
@ -1437,7 +1444,7 @@ parent."
(add-to-list 'orhc-candidate-formats
'("online" . " |${=key=}| ${title} ${url}")))
(defun my/extract-guix-dependencies ()
(defun my/extract-guix-dependencies (&optional category)
(let ((dependencies '()))
(org-table-map-tables
(lambda ()
@ -1450,14 +1457,61 @@ parent."
nil
(mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem)
(string-match-p "[G|g]uix.*dep" elem)))))
(string-match-p "[G|g]uix.*dep" elem))))
(category-name-index
(cl-position
nil
(mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem)
(string-match-p ".*[C|c]ategory.*" elem))))
(disabled-name-index
(cl-position
nil
(mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem)
(string-match-p ".*[D|d]isabled.*" elem)))))
(when dep-name-index
(dolist (elem (cdr table))
(add-to-list
dependencies
(substring-no-properties (nth dep-name-index elem))))))))
(when
(and
;; Category
(or
;; Category not set and not present in the table
(and
(or (not category) (string-empty-p category))
(not category-name-index))
;; Category is set and present in the table
(and
category-name-index
(not (string-empty-p category))
(string-match-p category (nth category-name-index elem))))
;; Not disabled
(or
(not disabled-name-index)
(string-empty-p (nth disabled-name-index elem))))
(add-to-list
'dependencies
(substring-no-properties (nth dep-name-index elem)))))))))
dependencies))
(defun my/format-guix-dependencies (&optional category)
(mapconcat
(lambda (e) (concat "\"" e "\""))
(my/extract-guix-dependencies category)
"\n"))
(setq my/org-config-files
'("/home/pavel/Emacs.org"
"/home/pavel/Desktop.org"
"/home/pavel/Console.org"
"/home/pavel/Guix.org"
"/home/pavel/Mail.org"))
(add-hook 'org-mode-hook
(lambda ()
(when (member (buffer-file-name) my/org-config-files)
(setq-local org-confirm-babel-evaluate nil))))
(use-package lsp-mode
:straight t
:if (not my/slow-ssh)
@ -2090,6 +2144,10 @@ parent."
;; (add-hook 'emacs-lisp-mode-hook #'smartparens-strict-mode)
(add-hook 'emacs-lisp-mode-hook #'lispy-mode)
(add-hook 'lisp-mode-hook #'aggressive-indent-mode)
;; (add-hook 'emacs-lisp-mode-hook #'smartparens-strict-mode)
(add-hook 'lisp-mode-hook #'lispy-mode)
(use-package clojure-mode
:straight t
:mode "\\.clj[sc]?\\'"
@ -2115,8 +2173,12 @@ parent."
:config
(setq geiser-default-implementation 'guile))
(add-hook 'scheme-mode #'aggressive-indent-mode)
(add-hook 'scheme-mode #'lispy-mode)
(use-package geiser-guile
:straight t
:after geiser)
(add-hook 'scheme-mode-hook #'aggressive-indent-mode)
(add-hook 'scheme-mode-hook #'lispy-mode)
(use-package clips-mode
:straight t
@ -2350,13 +2412,15 @@ parent."
;; (general-define-key "C-c C" 'my/edit-exwm-configuration)
(my-leader-def "cc" 'my/edit-configuration)
(add-to-list 'tramp-methods
'("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") ("/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
(with-eval-after-load 'tramp
(add-to-list 'tramp-methods
`("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") "/bin/sh"))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c")))))
(defun my/yadm-magit ()
(interactive)
@ -2378,22 +2442,7 @@ parent."
(general-define-key "C-c f" 'my/open-yadm-file)
(my-leader-def "cf" 'my/open-yadm-file)
(use-package notmuch
:ensure nil
:commands (notmuch)
:config
(setq mail-specify-envelope-from t)
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(setq notmuch-always-prompt-for-sender t)
(setq sendmail-program "/usr/bin/msmtp")
(setq send-mail-function #'sendmail-send-it)
(add-hook 'notmuch-hello-mode-hook
(lambda () (display-line-numbers-mode 0)))
(custom-set-faces
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))))
(my-leader-def "am" 'notmuch)
(load-file (expand-file-name "mail.el" user-emacs-directory))
(use-package elfeed
:straight (:repo "SqrtMinusOne/elfeed" :host github)
@ -2545,3 +2594,9 @@ parent."
:if (and (string= (system-name) "pdsk") (not my/slow-ssh))
:config
(elcord-mode))
(use-package guix
:straight t
:commands (guix)
:init
(my-leader-def "ag" 'guix))

32
.emacs.d/mail.el Normal file
View file

@ -0,0 +1,32 @@
(setq my/notmuch-loaded nil)
(defun my/run-notmuch ()
(interactive)
(when (not my/notmuch-loaded)
(let* ((notmuch-dir (shell-command-to-string "readlink -f $(which notmuch)"))
(notmuch-version (substring (shell-command-to-string "notmuch --version") 8 -1))
(notmuch-lisp-dir (concat
(substring notmuch-dir 0 -13)
"/share/emacs/site-lisp/notmuch-"
notmuch-version
"/")))
(push notmuch-lisp-dir load-path))
(setq my/notmuch-loaded t))
(notmuch))
(my-leader-def "am" 'my/run-notmuch)
(use-package notmuch
;; :ensure nil
:commands (notmuch)
:config
(setq mail-specify-envelope-from t)
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(setq notmuch-always-prompt-for-sender t)
(setq sendmail-program (executable-find "msmtp"))
(setq send-mail-function #'sendmail-send-it)
(add-hook 'notmuch-hello-mode-hook
(lambda () (display-line-numbers-mode 0)))
(custom-set-faces
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))))

1
.nix-channels Normal file
View file

@ -0,0 +1 @@
https://nixos.org/channels/nixpkgs-unstable nixpkgs

View file

@ -1,94 +1,27 @@
# .notmuch-config - Configuration file for the notmuch mail system
#
# For more information about notmuch, see https://notmuchmail.org
# Database configuration
#
# The only value supported here is 'path' which should be the top-level
# directory where your mail currently exists and to where mail will be
# delivered in the future. Files should be individual email messages.
# Notmuch will store its database within a sub-directory of the path
# configured here named ".notmuch".
#
# [[file:Mail.org::*Config][Config:1]]
[database]
path=/home/pavel/Mail
# Config:1 ends here
# User configuration
#
# Here is where you can let notmuch know how you would like to be
# addressed. Valid settings are
#
# name Your full name.
# primary_email Your primary email address.
# other_email A list (separated by ';') of other email addresses
# at which you receive email.
#
# Notmuch will use the various email addresses configured here when
# formatting replies. It will avoid including your own addresses in the
# recipient list of replies, and will set the From address based on the
# address to which the original email was addressed.
#
# [[file:Mail.org::*Config][Config:2]]
[user]
name=Pavel Korytov
primary_email=thexcloud@gmail.com
# Configuration for "notmuch new"
#
# The following options are supported here:
#
# tags A list (separated by ';') of the tags that will be
# added to all messages incorporated by "notmuch new".
#
# ignore A list (separated by ';') of file and directory names
# that will not be searched for messages by "notmuch new".
#
# NOTE: *Every* file/directory that goes by one of those
# names will be ignored, independent of its depth/location
# in the mail store.
#
other_email=progin6304@gmail.com;
# Config:2 ends here
# [[file:Mail.org::*Config][Config:3]]
[new]
tags=new;
ignore=.osync_workdir
# Config:3 ends here
# Search configuration
#
# The following option is supported here:
#
# exclude_tags
# A ;-separated list of tags that will be excluded from
# search results by default. Using an excluded tag in a
# query will override that exclusion.
#
# [[file:Mail.org::*Config][Config:4]]
[search]
exclude_tags=trash;spam;
# Config:4 ends here
# Maildir compatibility configuration
#
# The following option is supported here:
#
# synchronize_flags Valid values are true and false.
#
# If true, then the following maildir flags (in message filenames)
# will be synchronized with the corresponding notmuch tags:
#
# Flag Tag
# ---- -------
# D draft
# F flagged
# P passed
# R replied
# S unread (added when 'S' flag is not present)
#
# The "notmuch new" command will notice flag changes in filenames
# and update tags, while the "notmuch tag" and "notmuch restore"
# commands will notice tag changes and update flags in filenames
#
# [[file:Mail.org::*Config][Config:5]]
[maildir]
synchronize_flags=true
# Config:5 ends here

View file

@ -1,57 +1,45 @@
# [[file:Shell.org::*Environment][Environment:1]]
export EDITOR=/usr/bin/vim
export BROWSER=/usr/bin/firefox
# [[file:Console.org::*Environment][Environment:1]]
# export EDITOR=/usr/bin/vim
# export BROWSER=/usr/bin/firefox
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
# export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
# Environment:1 ends here
# [[file:Shell.org::*Various paths][Various paths:1]]
# [[file:Console.org::*My paths][My paths:1]]
if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/bin/scripts:$PATH"
fi
# Various paths:1 ends here
# My paths:1 ends here
# [[file:Shell.org::*Various paths][Various paths:2]]
if [ -d "/usr/local/texlive/2020" ]; then
export MANPATH="/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH"
export INFOPATH="/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH"
export PATH="/usr/local/texlive/2020/bin/x86_64-linux:$PATH"
# [[file:Console.org::*Guix settings][Guix settings:1]]
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
for i in $GUIX_EXTRA_PROFILES/*; do
profile=$i/$(basename "$i")
if [ -f "$profile"/etc/profile ]; then
GUIX_PROFILE="$profile"
. "$GUIX_PROFILE"/etc/profile
fi
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$profile/share"
unset profile
done
# Guix settings:1 ends here
# [[file:Console.org::*Guix settings][Guix settings:2]]
if [ -f /run/current-system/profile/etc/profile.d/nix.sh ]; then
. /run/current-system/profile/etc/profile.d/nix.sh
fi
# Various paths:2 ends here
# Guix settings:2 ends here
# [[file:Shell.org::*Various paths][Various paths:3]]
if [ -d "$HOME/.cargo" ] ; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
# Various paths:3 ends here
# [[file:Console.org::*Guix settings][Guix settings:3]]
export GUIX_PACKAGE_PATH=~/guix-packages
# Guix settings:3 ends here
# [[file:Shell.org::*Various paths][Various paths:4]]
if [ -d "$HOME/.rvm" ] ; then
export PATH="$PATH:$HOME/.rvm/bin"
fi
# if [ -d "$HOME/.gem" ]; then
# export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH"
# fi
# Various paths:4 ends here
# [[file:Console.org::*Guix settings][Guix settings:4]]
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
# Guix settings:4 ends here
# [[file:Shell.org::*Various paths][Various paths:5]]
if [ -d "$HOME/go" ] ; then
export PATH="$HOME/go/bin:$PATH"
fi
# Various paths:5 ends here
# [[file:Shell.org::*Various paths][Various paths:6]]
[ -f "/home/pavel/.ghcup/env" ] && source "/home/pavel/.ghcup/env" # ghcup-env
# Various paths:6 ends here
# [[file:Shell.org::*Various paths][Various paths:7]]
if [ -d "$HOME/perl5" ] ; then
PATH="/home/pavel/perl5/bin${PATH:+:${PATH}}"
PERL5LIB="/home/pavel/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/home/pavel/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/home/pavel/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/home/pavel/perl5"; export PERL_MM_OPT;
fi
# Various paths:7 ends here
# [[file:Console.org::*XResources][XResources:1]]
xrdb ~/.Xresources
# XResources:1 ends here

View file

@ -1,26 +1,26 @@
# [[file:Shell.org::*Term settings][Term settings:1]]
# [[file:Console.org::*Term settings][Term settings:1]]
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",*256col*:Tc"
# Term settings:1 ends here
# [[file:Shell.org::*Term settings][Term settings:2]]
# [[file:Console.org::*Term settings][Term settings:2]]
set -g history-limit 20000
# Term settings:2 ends here
# [[file:Shell.org::*Keybindings][Keybindings:1]]
# [[file:Console.org::*Keybindings][Keybindings:1]]
set-window-option -g mode-keys vi
set-option -g xterm-keys on
set-option -g mouse on
set -sg escape-time 10
# Keybindings:1 ends here
# [[file:Shell.org::*Keybindings][Keybindings:2]]
# [[file:Console.org::*Keybindings][Keybindings:2]]
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Keybindings:2 ends here
# [[file:Shell.org::*Keybindings][Keybindings:3]]
# [[file:Console.org::*Keybindings][Keybindings:3]]
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
@ -34,15 +34,15 @@ bind-key t next-window
bind-key T previous-window
# Keybindings:3 ends here
# [[file:Shell.org::*Keybindings][Keybindings:4]]
# [[file:Console.org::*Keybindings][Keybindings:4]]
bind r source-file ~/.tmux.conf
# Keybindings:4 ends here
# [[file:Shell.org::*Copy to clipboard][Copy to clipboard:1]]
# [[file:Console.org::*Copy to clipboard][Copy to clipboard:1]]
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i"
# Copy to clipboard:1 ends here
# [[file:Shell.org::*UI][UI:2]]
# [[file:Console.org::*UI][UI:2]]
source ~/.tmux.line.conf
# UI:2 ends here

View file

@ -1,4 +1,4 @@
# [[file:Shell.org::*UI][UI:1]]
# [[file:Console.org::*UI][UI:1]]
# This tmux statusbar config was created by tmuxline.vim
# on Wed, 22 Jan 2020

View file

@ -3,8 +3,8 @@
#+PROPERTY: header-args :mkdirp yes
#+PROPERTY: header-args:conf-space :comments link
#+PROPERTY: header-args:conf-toml :comments link
#+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/bin/sh"
#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/bin/bash"
#+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/usr/bin/env sh"
#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/usr/bin/env bash"
* Contents
:PROPERTIES:
@ -42,13 +42,13 @@
:END:
** Environment
#+begin_src sh
export EDITOR=/usr/bin/vim
export BROWSER=/usr/bin/firefox
# export EDITOR=/usr/bin/vim
# export BROWSER=/usr/bin/firefox
export QT_QPA_PLATFORMTHEME="qt5ct"
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
# export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
#+end_src
** Various paths
** My paths
My script folders
#+begin_src sh
if [ -d "$HOME/bin" ] ; then
@ -56,9 +56,51 @@ if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin/scripts:$PATH"
fi
#+end_src
** Guix settings
Enable extra profiles
#+begin_src sh
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
for i in $GUIX_EXTRA_PROFILES/*; do
profile=$i/$(basename "$i")
if [ -f "$profile"/etc/profile ]; then
GUIX_PROFILE="$profile"
. "$GUIX_PROFILE"/etc/profile
fi
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$profile/share"
unset profile
done
#+end_src
Enable Nix
#+begin_src sh
if [ -f /run/current-system/profile/etc/profile.d/nix.sh ]; then
. /run/current-system/profile/etc/profile.d/nix.sh
fi
#+end_src
Set a folder for my packages.
#+begin_src sh
export GUIX_PACKAGE_PATH=~/guix-packages
#+end_src
Make flatpak apps visible to launchers
#+begin_src sh
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
#+end_src
** XResources
| Guix dependency |
|-----------------|
| xrdb |
#+begin_src sh
xrdb ~/.Xresources
#+end_src
** OFF (OFF) Package manager paths
Turned off for now, because probably it won't be necessary in Guix.
LaTeX
#+begin_src sh
#+begin_src sh :tangle no
if [ -d "/usr/local/texlive/2020" ]; then
export MANPATH="/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH"
export INFOPATH="/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH"
@ -67,14 +109,14 @@ fi
#+end_src
Cargo (Rust)
#+begin_src sh
#+begin_src sh :tangle no
if [ -d "$HOME/.cargo" ] ; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
#+end_src
RVM (Ruby)
#+begin_src sh
#+begin_src sh :tangle no
if [ -d "$HOME/.rvm" ] ; then
export PATH="$PATH:$HOME/.rvm/bin"
fi
@ -84,19 +126,19 @@ fi
#+end_src
Go
#+begin_src sh
#+begin_src sh :tangle no
if [ -d "$HOME/go" ] ; then
export PATH="$HOME/go/bin:$PATH"
fi
#+end_src
ghcup (Haskell)
#+begin_src sh
#+begin_src sh :tangle no
[ -f "/home/pavel/.ghcup/env" ] && source "/home/pavel/.ghcup/env" # ghcup-env
#+end_src
Perl
#+begin_src sh
#+begin_src sh :tangle no
if [ -d "$HOME/perl5" ] ; then
PATH="/home/pavel/perl5/bin${PATH:+:${PATH}}"
PERL5LIB="/home/pavel/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
@ -119,14 +161,37 @@ fi
:PROPERTIES:
:header-args+: :tangle ./.bashrc
:END:
My =.bashrc=, which has pieces from the default ones in Guix & Manjaro, as well some mine settings.
*** Startup & environment
Return if not run interactively & stuff
Export 'SHELL' to child processes. Programs such as 'screen' honor it and otherwise use /bin/sh.
#+begin_src bash
[[ $- != *i* ]] && return
export SHELL
#+end_src
We are being invoked from a non-interactive shell. If this is an SSH session (as in "ssh host command"), source /etc/profile so we get PATH and other essential variables.
#+begin_src bash
if [[ $- != *i* ]]
then
[[ -n "$SSH_CLIENT" ]] && source /etc/profile
return
fi
#+end_src
Source the system-wide file
#+begin_src bash
source /etc/bashrc
#+end_src
| Guix dependency |
|-----------------|
| xhost |
Allow other users to access X server. Necessary for stuff like aw-watcher-window.
#+begin_src bash
xhost +local:root > /dev/null 2>&1
use_fish=true
#+end_src
Set manpager to bat
@ -136,7 +201,9 @@ export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'"
*** Launch fish
Launch fish shell unless bash itself is launched from fish.
#+begin_src bash
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} ]]
use_fish=true
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} && $(command -v fish) ]]
then
exec fish
fi
@ -214,7 +281,7 @@ HISTFILESIZE=
#+end_src
Autocompletions
#+begin_src bash
#+begin_src bash :tangle no
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
if [ -d "/usr/share/fzf" ]; then
source /usr/share/fzf/completion.bash
@ -229,6 +296,14 @@ alias ls="exa --icons"
alias ll="exa -lah --icons"
alias q="exit"
alias c="clear"
alias ic="init_conda"
#+end_src
#+begin_src bash
if [[ ! -z "$SIMPLE" ]]; then
unalias ls
alias ll="ls -lah"
fi
#+end_src
*** Anaconda
#+begin_quote
@ -237,30 +312,36 @@ managed by 'conda init' !!!
Yeah, tell this to yourself
#+begin_src bash
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/pavel/Programs/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/pavel/Programs/miniconda3/etc/profile.d/conda.sh" ]; then
. "/home/pavel/Programs/miniconda3/etc/profile.d/conda.sh"
init_conda () {
__conda_setup="$('/home/pavel/.guix-extra-profiles/dev/dev/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
export PATH="/home/pavel/Programs/miniconda3/bin:$PATH"
if [ -f "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh" ]; then
. "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh"
else
# export PATH="/home/pavel/Programs/miniconda3/bin:$PATH"
echo "what"
fi
fi
fi
unset __conda_setup
# <<< conda initialize <<<
unset __conda_setup
}
#+end_src
*** Starship prompt
#+begin_src bash
eval "$(starship init bash)"
if [[ -z "$SIMPLE" ]]; then
eval "$(starship init bash)"
fi
#+end_src
* Fish
:PROPERTIES:
:header-args+: :tangle ./.config/fish/config.fish :comments link
:END:
| Guix dependency | Description |
|-----------------+------------------------------------------|
| fish | An alternative non POSIX-compliant shell |
[[https://fishshell.com/][Fish shell]] is a non-POSIX-compliant shell, which offers some fancy UI & UX features.
Launch starship
@ -277,19 +358,31 @@ fish_vi_key_bindings
Anaconda
#+begin_src fish
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
eval /home/pavel/Programs/miniconda3/bin/conda "shell.fish" "hook" $argv | source
# <<< conda initialize <<<
function init_conda
eval /home/pavel/.guix-extra-profiles/dev/dev/bin/conda "shell.fish" "hook" $argv | source
end
#+end_src
| Guix dependency |
|-----------------|
| dt-colorscripts |
Launch a random [[https://gitlab.com/dwt1/shell-color-scripts][DT's colorscript]] unless ran inside tmux or Emacs.
#+begin_src fish
if ! test -n "$TMUX"; and ! test -n "$IS_EMACS";
colorscript random
end
#+end_src
Suppress fish greeting
#+begin_src fish
set fish_greeting
#+end_src
* Starship prompt
| Guix dependency | Description |
|-----------------+---------------------|
| rust-starship | my prompt of choice |
[[https://starship.rs/][Starship]] is a nice cross-shell prompt, written in Rust.
References:
@ -376,6 +469,11 @@ symbol = " "
:PROPERTIES:
:header-args+: :tangle ./.tmux.conf
:END:
| Guix dependency |
|-----------------|
| tmux |
| tmuxp |
[[https://github.com/tmux/tmux][tmux]] is my terminal multiplexer of choice.
It provides pretty sane defaults, so the config is not too large. I rebind the prefix to =C-a= though.
@ -426,6 +524,10 @@ Reload the config.
bind r source-file ~/.tmux.conf
#+end_src
** Copy to clipboard
| Guix dependency |
|-----------------|
| xclip |
Make tmux copying copy to clipboard as well
#+begin_src conf-space
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i"
@ -466,6 +568,10 @@ source ~/.tmux.line.conf
:header-args+: :tangle ./.config/alacritty/alacritty.yml :comments link
:END:
| Guix dependency |
|-----------------|
| alacritty |
[[https://github.com/alacritty/alacritty][Alacritty]] is a GPU-accelerated terminal emulator. I haven't found it to be an inch faster than st, but configuration the in yml format is way more convinient than patches.
Once again, we have an application which doesn't support reading Xresources, so here goes noweb.
@ -552,3 +658,28 @@ key_bindings:
- { key: Minus, mods: Control, action: DecreaseFontSize }
- { key: NumpadSubtract, mods: Control, action: DecreaseFontSize }
#+end_src
* Various console applications
| Guix dependency | Description |
|-----------------+---------------------------------------------|
| ncurses | Provides stuff like ~clear~ |
| exa | ~ls~ replacement, written in Rust |
| bat | ~cat~ clone with syntax highlighting |
| htop | Interactive process viewer |
| nethogs | A tool to group processed by used bandwidth |
| osync | rsync wrapper |
| Note | Description |
|------+-----------------|
| TODO | package fselect |
* Guix settings
#+NAME: packages
#+begin_src emacs-lisp :tangle no
(my/format-guix-dependencies)
#+end_src
#+begin_src scheme :tangle .config/guix/manifests/console.scm :noweb yes
(specifications->manifest
'(
<<packages()>>))
#+end_src

View file

@ -5,8 +5,8 @@
#+PROPERTY: header-args:conf-unix :comments link
#+PROPERTY: header-args:conf-windows :comments link
#+PROPERTY: header-args:conf-xdefaults :comments link
#+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/bin/sh"
#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/bin/bash"
#+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/usr/bin/env bash"
#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/usr/bin/env bash"
My general desktop environment configuration.
@ -81,7 +81,8 @@ Parts prefixed with (OFF) are not used, but kept for historic purposes. For some
- [[#general-settings][General settings]]
- [[#zathura][Zathura]]
:END:
* Colors
* Global customization
** Colors
Most of the colors are from the Palenight theme. Colorcodes are taken from [[https://github.com/JonathanSpeek/palenight-iterm2][this repo]]:
#+tblname: colors
@ -129,6 +130,7 @@ Test:
: #f07178
** Xresources
*** Colors in Xresources
However, I'd rather use the =Xresources= file wherever possible. Here is the code to generate an Xresources file from this table:
#+NAME: get-xresources
@ -149,12 +151,42 @@ However, I'd rather use the =Xresources= file wherever possible. Here is the cod
*background: <<get-color(name="black")>>
*foreground: <<get-color(name="white")>>
#+end_src
*** Fonts
Also, Xresources are used to set =Xft= settings. Unfortunately, the DPI setting has to be unique for each machine, which means I cannot commit =Xresources= to the repo.
#+NAME: get-dpi
#+begin_src emacs-lisp
(let ((hostname (system-name)))
(cond ((string-equal hostname "azure") 120)
(t 96)))
#+end_src
#+begin_src conf-xdefaults :noweb yes :tangle ~/.Xresources
Xft.dpi: <<get-dpi()>>
#+end_src
** 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 |
IIRC the only thing =lxapparance= does is edit GTK config files.
* i3wm
:PROPERTIES:
:header-args+: :tangle ./.config/i3/config
:END:
| Guix dependency | Disabled |
|-----------------+----------|
| i3-gaps | |
| i3lock | true |
=i3lock= is disabled because the global one has to be used.
[[https://i3wm.org/][i3wm]] is a manual tiling window manager, which is currently my window manager of choice. I've tried several alternatives, including [[https://xmonad.org/][xmonad]] & [[https://github.com/ch11ng/exwm][EXWM]], but i3 seems to fit my workflow best.
[[https://github.com/Airblader/i3][i3-gaps]] is an i3 fork with a few features like window gaps. I like to enable inner gaps when there is at least one container in a workspace.
@ -175,8 +207,8 @@ floating_modifier $mod
mouse_warping output
# Apply XFCE Settings
exec xfsettingsd
exec xiccd
# exec xfsettingsd
# exec xiccd
# Most needed keybindigs
# reload the configuration file
@ -512,14 +544,14 @@ bindsym $mod+semicolon mode "apps"
mode "apps" {
bindsym Escape mode "default"
bindsym b exec firefox; mode default
bindsym v exec vk-messenger; mode default
bindsym s exec slack; mode default;
bindsym d exec discord; mode default;
bindsym v exec vk; mode default
bindsym s exec "flatpak run com.slack.Slack"; mode default;
bindsym d exec "flatpak run com.discordapp.Discord"; mode default;
bindsym m exec "alacritty -e ncmpcpp"; mode default
bindsym c exec "copyq toggle"; mode default
bindsym k exec "keepassxc"; mode default
# bindsym e exec mailspring; mode default
bindsym a exec "bash /home/pavel/bin/emacs.sh"; mode default
bindsym a exec emacs; mode default
bindsym n exec "alacritty -e newsboat"; mode default
bindsym w exec "alacritty /home/pavel/bin/scripts/run_wego"; mode default
# bindsym a exec emacsclient -c; mode default
@ -529,13 +561,13 @@ mode "apps" {
*** Media controls & brightness
#+begin_src conf-space
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ +5%"
bindsym XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ -5%"
bindsym XF86AudioMute exec --no-startup-id "pactl set-sink-mute @DEFAULT_SINK@ toggle"
bindsym XF86AudioRaiseVolume exec --no-startup-id "ponymix increase 5"
bindsym XF86AudioLowerVolume exec --no-startup-id "ponymix decrease 5"
bindsym XF86AudioMute exec --no-startup-id "ponymix toggle"
exec --no-startup-id xmodmap -e 'keycode 135 = Super_R' && xset -r 135
bindsym $mod+F2 exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ -5%"
bindsym $mod+F3 exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ +5%"
bindsym $mod+F2 exec --no-startup-id "ponymix increase 5"
bindsym $mod+F3 exec --no-startup-id "ponymix decrease 5"
# Media player controls
bindsym XF86AudioPlay exec mpc toggle
@ -544,9 +576,8 @@ bindsym XF86AudioNext exec mpc next
bindsym XF86AudioPrev exec mpc prev
# Screen brightness
bindsym XF86MonBrightnessUp exec xbacklight -inc 5
bindsym XF86MonBrightnessDown exec xbacklight -dec 5
bindsym XF86MonBrightnessUp exec light -A 5
bindsym XF86MonBrightnessDown exec light -U 5
#+end_src
*** Screenshots
#+begin_src conf-space
@ -639,10 +670,10 @@ bindsym $mod+slash exec toggle_layout
exec_always --no-startup-id "bash /home/pavel/bin/polybar.sh"
# PulseEffects
exec --no-startup-id pulseeffects --gapplication-service
# exec --no-startup-id pulseeffects --gapplication-service
# Sudo
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# Wallpaper
exec_always "feh --bg-fill ~/Pictures/wallpaper.jpg"
@ -654,30 +685,39 @@ exec picom
exec keynav
# Applets
exec --no-startup-id /usr/bin/nm-applet
exec --no-startup-id /usr/bin/blueman-applet
exec --no-startup-id nm-applet
# exec --no-startup-id /usr/bin/blueman-applet
# MPD
exec --no-startup-id mpd
# exec --no-startup-id mpd
# Stuff
exec aw-qt
exec "vnstatd -d"
# exec aw-qt
# exec "bash ~/bin/aw-start"
exec shepherd
# exec "vnstatd -d"
exec dunst
exec kde-connect-indicator
# exec kde-connect-indicator
exec copyq
exec "xmodmap ~/.Xmodmap"
exec "bash ~/bin/autostart.sh"
# exec "xrdb -merge ~/.Xresources"
# exec "bash ~/bin/autostart.sh"
#+end_src
* Polybar
:PROPERTIES:
:header-args+: :tangle ./.config/polybar/config
:END:
| Guix dependency | Description |
|------------------+--------------------------|
| polybar | statusbar |
[[https://github.com/polybar/polybar][Polybar]] is a nice-looking, WM-agnostic statusbar program.
I switched to polybar because I wanted to try out some WMs other than i3, but decided to stick with i3 for now.
Don't forget to install the Google Noto Color Emoji font. Guix package with all Noto fonts is way too large.
References:
- [[https://github.com/polybar/polybar/wiki][polybar docs]]
** Launching
@ -688,8 +728,8 @@ The script below allows me to:
#+begin_src bash :tangle ./bin/polybar.sh
hostname=$(hostname)
# Settings varying on the hostname
if [ "$hostname" = "pntk" ]; then
TRAY_MONITOR="eDP1"
if [ "$hostname" = "azure" ]; then
TRAY_MONITOR="eDP-1"
export WLAN_INTERFACE="wlp3s0"
else
TRAY_MONITOR="HDMI-A-0"
@ -698,24 +738,24 @@ fi
# Setting varying on the monitor
declare -A FONT_SIZES=(
["eDP1"]="13"
["eDP-1"]="13"
["DVI-D-0"]="11"
["HDMI-A-0"]="13"
)
declare -A EMOJI_SCALE=(
["eDP1"]="9"
["eDP-1"]="9"
["DVI-D-0"]="10"
["HDMI-A-0"]="10"
)
declare -A BAR_HEIGHT=(
["eDP1"]="29"
["eDP-1"]="29"
["DVI-D-0"]="23"
["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"
["eDP1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun aw-afk date TSEP"
["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun date TSEP"
)
# Geolocation for some modules
@ -832,11 +872,22 @@ margin-bottom = 0
Some of the custom modules below use Org mode noweb to evaluate colors, because it's faster than querying =xrdb= at runtime. I wish I could reference polybar values there, but [[https://github.com/polybar/polybar/issues/615][it looks like this is impossible]].
If you want to copy something, you can go to the [[file:bin/polybar/][bin/polybar]] folder.
*** ipstack-vpn
| Guix dependency | Description |
|-----------------+-------------------------|
| bind | Provides dig |
| curl | |
| jq | util to work with JSONs |
A module to get a country of the current IP and openvpn status. Uses [[https://ipstack.com/][ipstack]] API.
#+begin_src bash :tangle ./bin/polybar/ipstack-vpn.sh :noweb yes
ip=$(dig +short +timeout=1 myip.opendns.com @resolver1.opendns.com 2> /dev/null)
if [[ ! -f ~/secrets/ipstack-api-key ]]; then
echo "%{u<<get-color(name="red")>>}%{+u} ?? %{u-}"
exit
fi
API_KEY="$(cat ~/secrets/ipstack-api-key)"
if [[ -z $ip || $ip == *"timed out"* ]]; then
echo "%{u<<get-color(name="red")>>}%{+u} ?? %{u-}"
@ -889,9 +940,10 @@ interval = 1200
*** aw-afk
Prints out a current uptime and non-AFK time from [[https://github.com/ActivityWatch][ActivityWatch]] server
| Type | Note |
|------+---------------------------|
| TODO | Fix crash on uptime > 99h |
| Type | Note |
|------+--------------------------------------------|
| TODO | Fix crash on uptime > 99h |
| TODO | Fix non-compatible uptime in GNU coreutils |
#+begin_src bash :tangle ./bin/polybar/aw_afk.sh :noweb yes
afk_event=$(curl -s -X GET "http://localhost:5600/api/0/buckets/aw-watcher-afk_$(hostname)/events?limit=1" -H "accept: application/json")
@ -914,6 +966,10 @@ exec = /home/pavel/bin/polybar/aw_afk.sh
interval = 60
#+end_src
*** sun
| Guix dependency |
|-----------------|
| sunwait |
Prints out the time of sunrise/sunset. Uses [[https://github.com/risacher/sunwait][sunwait]]
#+begin_src bash :tangle ./bin/polybar/sun.sh :noweb yes
@ -1199,6 +1255,10 @@ ramp-capacity-4 = 
#+end_src
* Rofi
| Guix dependency |
|-----------------|
| rofi |
[[https://github.com/davatorium/rofi][rofi]] is another dynamic menu generator. It can act as dmenu replacement but offers a superset of dmenu's features.
** Theme
@ -1404,6 +1464,10 @@ if [[ ! -z $SELECTED ]]; then
fi
#+end_src
* Flameshot
| Guix dependency |
|-----------------|
| flameshot |
[[https://github.com/flameshot-org/flameshot][flameshot]] is my program of choice to make screenshots.
As it overwrites its own config all the time, I do not keep the file in VC.
@ -1453,6 +1517,11 @@ TYPE_TOGGLE_PANEL=Space
TYPE_UNDO=Ctrl+Z
#+end_src
* dunst
| Guix dependency |
|-----------------|
| dunst |
| libnotify |
| Type | Note |
|------+---------------------------------|
| TODO | Cleanup default config comments |
@ -1752,6 +1821,10 @@ References:
#icon = /path/to/icon
#+end_src
* keynav
| Guix dependency |
|-----------------|
| keynav |
| Type | Note |
|---------+--------------------------------|
| SYMLINK | ./config/keynavrc -> .keynavrc |
@ -1830,6 +1903,11 @@ fade-exclude = [
:PROPERTIES:
:header-args+: :tangle ./.config/picom.conf
:END:
| Guix dependency |
|-----------------|
| picom |
[[https://github.com/yshui/picom][picom]] is a compositor for X11. It allows effects such as transparency, blurring, etc.
Sample configuration is a good resource for getting an overview of the available settings. I have only a bunch of necessary settings in mine.
@ -1917,6 +1995,13 @@ wintypes:
};
#+end_src
* Zathura
| Guix dependency |
|---------------------|
| zathura |
| zathura-ps |
| zathura-pdf-poppler |
| zathura-djvu |
[[https://pwmt.org/projects/zathura/][Zathura]] is a pdf viewer with vim-like keybindings. One of my favorite features is an ability to invert the document colors.
#+begin_src conf-space :noweb yes :tangle .config/zathura/zathurarc
@ -1930,3 +2015,268 @@ set recolor true
map <C-r> set recolor false
map <C-R> set recolor true
#+end_src
* Various software
This section generates manifests for various desktop software that I'm using.
** Browsers
| Category | Guix dependency |
|----------+--------------------|
| browsers | ungoogled-chromium |
| browsers | firefox |
** Office
| Category | Guix dependency |
|----------+-----------------|
| office | libreoffice |
| office | gimp |
** LaTeX
| Category | Guix dependency |
|----------+-----------------|
| latex | texlive |
** Dev
| Category | Guix dependency |
|----------+-----------------|
| dev | conda |
| dev | docker-compose |
** Manifests
#+NAME: packages
#+begin_src emacs-lisp :tangle no :var category=""
(my/format-guix-dependencies category)
#+end_src
Dev
#+begin_src scheme :tangle .config/guix/manifests/dev.scm :noweb yes
(specifications->manifest
'(
<<packages("dev")>>))
#+end_src
Browsers
#+begin_src scheme :tangle .config/guix/manifests/browsers.scm :noweb yes
(specifications->manifest
'(
<<packages("browsers")>>))
#+end_src
System
#+begin_src scheme :tangle .config/guix/manifests/system.scm :noweb yes
(specifications->manifest
'(
<<packages("system")>>))
#+end_src
Music
#+begin_src scheme :tangle .config/guix/manifests/music.scm :noweb yes
(specifications->manifest
'(
<<packages("music")>>))
#+end_src
Office
#+begin_src scheme :tangle .config/guix/manifests/office.scm :noweb yes
(specifications->manifest
'(
<<packages("office")>>))
#+end_src
LaTeX
#+begin_src scheme :tangle .config/guix/manifests/latex.scm :noweb yes
(specifications->manifest
'(
<<packages("latex")>>))
#+end_src
** Flatpak
A lot of proprietary desktop applications can be installed most easily with flatpak & flathub.
| Guix dependency |
|-----------------|
| flatpak |
After installation, add the following repositories:
#+begin_example
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo
#+end_example
Installation syntax is as follows:
#+begin_example
flatpak install --user <remote> <package>
#+end_example
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 |
#+begin_src emacs-lisp :var table=flatpak-deps :wrap example
(mapconcat
(lambda (c) (concat "flatpak install --user " (nth 1 c) " " (nth 0 c)))
table
"\n")
#+end_src
#+RESULTS:
#+begin_example
flatpak install --user flathub org.mozilla.firefox
flatpak install --user flathub com.discordapp.Discord
flatpak install --user flathub us.zoom.Zoom
flatpak install --user flathub com.slack.Slack
#+end_example
** Nix
I probably should've used nix, as almost every program I packaged so far exists in the Nix repo.
But it's easy enough to use Nix on Guix.
#+begin_src conf :tangle ~/.nix-channels
https://nixos.org/channels/nixpkgs-unstable nixpkgs
#+end_src
Don't forget to run the following after the first installation:
#+begin_src sh
nix-channel --update
#+end_src
Installing packages:
#+begin_src
nix-env -i vk-messenger
#+end_src
* Services
:PROPERTIES:
:header-args+: :tangle ~/.config/shepherd/init.scm
:END:
[[https://www.gnu.org/software/shepherd/manual/html_node/index.html][GNU Shepherd]] is a service management system for GNU Guix.
I previously used supervisor, but shepherd also seems pretty capable.
** Music
| Category | Guix dependency |
|----------+-----------------|
| music | mpd |
| music | ncmpcpp |
| music | picard |
| music | mpd-watcher |
| music | mpd-mpc |
Music player daemon
#+begin_src scheme
(define mpd
(make <service>
#:provides '(mpd)
#:respawn? #t
#:start (make-forkexec-constructor '("mpd" "--no-daemon"))
#:stop (make-kill-destructor)))
#+end_src
MPD watcher
#+begin_src scheme
(define mpd-watcher
(make <service>
#:provides '(mpd-watcher)
#:respawn? #t
#:start (make-forkexec-constructor '("mpd_watcher"))
#:stop (make-kill-destructor)
#:requires '(mpd)))
#+end_src
** GNU Mcron
[[https://www.gnu.org/software/mcron/][GNU Mcron]] is a replacement for cron, written in Scheme.
#+begin_src scheme
(define mcron
(make <service>
#:provides '(mcron)
#:respawn? #t
#:start (make-forkexec-constructor '("mcron"))
#:stop (make-kill-destructor)))
#+end_src
** ActivityWatch
[[https://activitywatch.net/][ActivityWatch]] is a FOSS time tracker. It tracks screen and application usage and has integrations with browsers, Emacs, etc.
| Guix dependency |
|-------------------|
| activitywatch-bin |
aw-server
#+begin_src scheme
(define aw-server
(make <service>
#:provides '(aw-server)
#:respawn? #t
#:start (make-forkexec-constructor '("aw-server"))
#:stop (make-kill-destructor)))
#+end_src
aw-watcher-afk
#+begin_src scheme
(define aw-watcher-afk
(make <service>
#:provides '(aw-watcher-afk)
#:requires '(aw-server)
#:respawn? #t
#:start (make-forkexec-constructor '("aw-watcher-afk"))
#:stop (make-kill-destructor)))
#+end_src
aw-watcher-window
#+begin_src scheme
(define aw-watcher-window
(make <service>
#:provides '(aw-watcher-window)
#:requires '(aw-server)
#:respawn? #t
#:start (make-forkexec-constructor '("aw-watcher-window"))
#:stop (make-kill-destructor)))
#+end_src
** Sync
| Guix dependency |
|-----------------|
| megacmd |
** Shepherd config
Register services
#+begin_src scheme
(register-services
mpd
mpd-watcher
mcron
aw-server
aw-watcher-afk
aw-watcher-window)
#+end_src
Daemonize shepherd
#+begin_src scheme
(action 'shepherd 'daemonize)
#+end_src
Run services
#+begin_src scheme
(for-each start '(mpd mpd-watcher mcron aw-server aw-watcher-afk aw-watcher-window))
#+end_src
* Guix settings
Other desktop programs I use are listed below.
| Guix dependency | Description |
|------------------------+-------------------------------------------|
| xrandr | X11 CLI to RandR |
| xprop | Tool to display properties of X windows |
| arandr | GUI to xrandr |
| light | Control screen brightness |
| ponymix | Control PulseAudio CLI |
| pavucontrol | Control PulseAudio GUI |
| network-manager-applet | Applet to manage network connections |
| feh | Image viewer. Used to set background |
| copyq | Clipboard manager |
| xmodmap | Program to modify keybindings on X server |
| thunar | My preferred GUI file manager |
| keepassxc | My preferred password manager |
#+NAME: packages
#+begin_src emacs-lisp :tangle no
(my/format-guix-dependencies)
#+end_src
#+begin_src scheme :tangle .config/guix/manifests/desktop.scm :noweb yes
(specifications->manifest
'(
<<packages()>>))
#+end_src

209
Emacs.org
View file

@ -1,4 +1,5 @@
#+PROPERTY: header-args:emacs-lisp :tangle ./.emacs.d/init.el :mkdirp yes
#+PROPERTY: header-args :mkdirp yes
#+PROPERTY: header-args:emacs-lisp :tangle ~/.emacs.d/init.el :mkdirp yes
#+TODO: CHECK(s) | OFF(o)
#+begin_quote
@ -75,6 +76,7 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept
- [[#ui][UI]]
- [[#general-ui--gui-settings][General UI & GUI Settings]]
- [[#theme--global-stuff][Theme & global stuff]]
- [[#font][Font]]
- [[#custom-frame-title][Custom frame title]]
- [[#tab-bar][Tab bar]]
- [[#setup][Setup]]
@ -126,6 +128,7 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept
- [[#org-ref][org-ref]]
- [[#system-configuration][System configuration]]
- [[#tables-for-guix-dependencies][Tables for Guix Dependencies]]
- [[#noweb-evaluations][Noweb evaluations]]
- [[#off-eaf][(OFF) EAF]]
- [[#installation][Installation]]
- [[#config][Config]]
@ -214,6 +217,8 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept
- [[#snow][Snow]]
- [[#zone][Zone]]
- [[#discord-integration][Discord integration]]
- [[#guix][Guix]]
- [[#guix-settings][Guix settings]]
:END:
* Primary setup
** Measure startup speed
@ -292,7 +297,7 @@ Run GC when Emacs loses focus. Time will tell if that's a good idea.
*** Misc
The following variable is true when my machine is not powerful enough for some resource-heavy packages.
#+begin_src emacs-lisp
(setq my/lowpower (string= (system-name) "pntk"))
(setq my/lowpower (string= (system-name) "azure"))
#+end_src
And the following is true if Emacs is meant to be used with TRAMP over slow ssh
@ -317,13 +322,14 @@ References:
#+begin_src emacs-lisp
(use-package conda
:straight t
:if (executable-find "conda")
:config
(setq conda-anaconda-home (expand-file-name "~/Programs/miniconda3/"))
(setq conda-env-home-directory (expand-file-name "~/Programs/miniconda3/"))
(setq conda-env-subdirectory "envs"))
(setq conda-env-subdirectory "envs")
(unless (getenv "CONDA_DEFAULT_ENV")
(conda-env-activate "base")))
(unless (getenv "CONDA_DEFAULT_ENV")
(conda-env-activate "base"))
#+end_src
Also, I sometimes need to know if a program is running inside Emacs (say, inside a terminal emulator). To do that, I set the following environment variable:
@ -454,6 +460,7 @@ I don't enable the entire package, just the modes I need.
'(eww
dired
debug
guix
calc
docker
geiser
@ -1114,10 +1121,16 @@ References:
- [[https://activitywatch.net/][ActivityWatch]]
*** WakaTime
Before I figure out how to package this for Guix:
- Clone [[https://github.com/wakatime/wakatime-cli][the repo]]
- Run ~go build~
- Copy the binary to the =~/bin= folder
#+begin_src emacs-lisp
(use-package wakatime-mode
:straight t
:config
(advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path "/home/pavel/bin/wakatime")))
(global-wakatime-mode))
#+end_src
*** ActivityWatch
@ -1170,11 +1183,6 @@ Hide mouse cursor while typing
(setq make-pointer-invisible t)
#+end_src
Font
#+begin_src emacs-lisp
(set-frame-font "JetBrainsMono Nerd Font 10" nil t)
#+end_src
Line numbers. There seems to be a catch with the relative number setting:
- =visual= doesn't take folding into account, but also doesn't take wrapped lines into account (makes multiple numbers for a single wrapped line)
- =relative= makes a single number for a wrapped line, but counts folded lines.
@ -1226,6 +1234,19 @@ My colorscheme of choice.
(setq doom-themes-treemacs-theme "doom-colors")
(doom-themes-treemacs-config))
#+end_src
*** Font
To install a font, download the font and unpack it into the =.local/share/fonts= directory. Create one if it doesn't exist.
As I use nerd fonts elsewhere, I use one in Emacs as well.
References:
- [[https://nerdfonts.com][nerd fonts homepage]]
#+begin_src emacs-lisp
(set-frame-font "JetBrainsMono Nerd Font 10" nil t)
#+end_src
To make the icons work (e.g. in the Doom Modeline), run =M-x all-the-icons-install-fonts=. The package definition is somewhere later in the config.
** Custom frame title
#+begin_src emacs-lisp
(setq-default frame-title-format
@ -1545,6 +1566,14 @@ Some other optimization settings:
vc-ignore-dir-regexp
tramp-file-name-regexp))
#+end_src
Also, here is a hack to make TRAMP find =ls= on Guix:
#+begin_src emacs-lisp
(with-eval-after-load 'tramp
(setq tramp-remote-path
(append tramp-remote-path
'(tramp-own-remote-path))))
#+end_src
** Bookmarks
A simple bookmark list for Dired, mainly to use with TRAMP. I may look into a proper bookmarking system later.
@ -1578,9 +1607,11 @@ My terminal emulator of choice.
References:
- [[https://github.com/akermu/emacs-libvterm][emacs-libvterm repo]]
*** Configuration
I use the package from the Guix repository to avoid building libvterm.
#+begin_src emacs-lisp
(use-package vterm
:straight t
;; :straight t
:commands (vterm vterm-other-window)
:config
(setq vterm-kill-buffer-on-exit t)
@ -1713,7 +1744,7 @@ Use the built-in org mode.
#+begin_src emacs-lisp :noweb yes
(use-package org
:straight org-plus-contrib
:straight t
:defer t
:config
(setq org-directory (expand-file-name "~/Documents/org-mode"))
@ -2325,11 +2356,15 @@ As of now, this package loads Helm on start. To avoid this, I have to exclude He
Functions used across my literate config files.
*** Tables for Guix Dependencies
A function to extract Guix dependencies from the org file. If column name matches =[G|g]uix.*dep=, its contents will be added to the result.
A function to extract Guix dependencies from the org file.
- If column name matches =[G|g]uix.*dep=, its contents will be added to the result.
- If =CATEGORY= is passed, a column with name =[C|c]ategory= will be used to filter results. That way one file can be used to produce multiple manifests.
- If =CATEGORY= is not passed, entries with non-empty category will be filtered out
- If there is a =[D|d]isabled= column, entries which have non-empty value in this column will be filtered out.
That seems pretty nice as I'm planning to move to Guix unless I encounter some unmovable obstacles.
#+begin_src emacs-lisp
(defun my/extract-guix-dependencies ()
(defun my/extract-guix-dependencies (&optional category)
(let ((dependencies '()))
(org-table-map-tables
(lambda ()
@ -2342,14 +2377,68 @@ That seems pretty nice as I'm planning to move to Guix unless I encounter some u
nil
(mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem)
(string-match-p "[G|g]uix.*dep" elem)))))
(string-match-p "[G|g]uix.*dep" elem))))
(category-name-index
(cl-position
nil
(mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem)
(string-match-p ".*[C|c]ategory.*" elem))))
(disabled-name-index
(cl-position
nil
(mapcar #'substring-no-properties (nth 0 table))
:test (lambda (_ elem)
(string-match-p ".*[D|d]isabled.*" elem)))))
(when dep-name-index
(dolist (elem (cdr table))
(add-to-list
dependencies
(substring-no-properties (nth dep-name-index elem))))))))
(when
(and
;; Category
(or
;; Category not set and not present in the table
(and
(or (not category) (string-empty-p category))
(not category-name-index))
;; Category is set and present in the table
(and
category-name-index
(not (string-empty-p category))
(string-match-p category (nth category-name-index elem))))
;; Not disabled
(or
(not disabled-name-index)
(string-empty-p (nth disabled-name-index elem))))
(add-to-list
'dependencies
(substring-no-properties (nth dep-name-index elem)))))))))
dependencies))
#+end_src
Now, join dependencies list to make it compatible with Scheme:
#+begin_src emacs-lisp
(defun my/format-guix-dependencies (&optional category)
(mapconcat
(lambda (e) (concat "\"" e "\""))
(my/extract-guix-dependencies category)
"\n"))
#+end_src
*** Noweb evaluations
Turn off eval confirmations for configuration files.
#+begin_src emacs-lisp
(setq my/org-config-files
'("/home/pavel/Emacs.org"
"/home/pavel/Desktop.org"
"/home/pavel/Console.org"
"/home/pavel/Guix.org"
"/home/pavel/Mail.org"))
(add-hook 'org-mode-hook
(lambda ()
(when (member (buffer-file-name) my/org-config-files)
(setq-local org-confirm-babel-evaluate nil))))
#+end_src
* OFF (OFF) EAF
[[https://github.com/manateelazycat/emacs-application-framework][Emacs Application Framework]] provides a way to integrate PyQt applications with Emacs.
@ -3124,6 +3213,12 @@ Some packages for editing various Lisps.
;; (add-hook 'emacs-lisp-mode-hook #'smartparens-strict-mode)
(add-hook 'emacs-lisp-mode-hook #'lispy-mode)
#+end_src
*** Common lisp
#+begin_src emacs-lisp
(add-hook 'lisp-mode-hook #'aggressive-indent-mode)
;; (add-hook 'emacs-lisp-mode-hook #'smartparens-strict-mode)
(add-hook 'lisp-mode-hook #'lispy-mode)
#+end_src
*** Clojure
#+begin_src emacs-lisp
(use-package clojure-mode
@ -3159,8 +3254,12 @@ Python requirements:
:config
(setq geiser-default-implementation 'guile))
(add-hook 'scheme-mode #'aggressive-indent-mode)
(add-hook 'scheme-mode #'lispy-mode)
(use-package geiser-guile
:straight t
:after geiser)
(add-hook 'scheme-mode-hook #'aggressive-indent-mode)
(add-hook 'scheme-mode-hook #'lispy-mode)
#+end_src
*** CLIPS
An honorary Lisp
@ -3506,18 +3605,24 @@ A bunch of functions for managing dotfiles with yadm.
(my-leader-def "cc" 'my/edit-configuration)
#+end_src
*** Open Magit for yadm
| Note | Type |
|------+-------------------|
| TODO | Fix this for Guix |
Idea:
- [[https://www.reddit.com/r/emacs/comments/gjukb3/yadm_magit/]]
#+begin_src emacs-lisp
(add-to-list 'tramp-methods
'("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") ("/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))))
(with-eval-after-load 'tramp
(add-to-list 'tramp-methods
`("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") "/bin/sh"))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c")))))
(defun my/yadm-magit ()
(interactive)
@ -3545,30 +3650,11 @@ Open a file managed by yadm.
#+end_src
** Notmuch
My notmuch config.
References:
- [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][My post about notmuch configuration]]
My notmuch config now resides in [[file:Mail.org][Mail.org]].
#+begin_src emacs-lisp
(use-package notmuch
:ensure nil
:commands (notmuch)
:config
(setq mail-specify-envelope-from t)
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(setq notmuch-always-prompt-for-sender t)
(setq sendmail-program "/usr/bin/msmtp")
(setq send-mail-function #'sendmail-send-it)
(add-hook 'notmuch-hello-mode-hook
(lambda () (display-line-numbers-mode 0)))
(custom-set-faces
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))))
(my-leader-def "am" 'notmuch)
(load-file (expand-file-name "mail.el" user-emacs-directory))
#+end_src
** Elfeed
[[https://github.com/skeeto/elfeed][elfeed]] is an Emacs RSS client.
@ -3788,3 +3874,28 @@ Shows which file is being edited in Emacs.
:config
(elcord-mode))
#+end_src
** Guix
#+begin_src emacs-lisp
(use-package guix
:straight t
:commands (guix)
:init
(my-leader-def "ag" 'guix))
#+end_src
* Guix settings
| Guix dependency | Description |
|---------------------+-------------------------------|
| emacs-vterm | A vterm package |
| ripgrep | A recursive search tool |
| the-silver-searcher | Another recursive search tool |
#+NAME: packages
#+begin_src emacs-lisp :tangle no
(my/format-guix-dependencies)
#+end_src
#+begin_src scheme :tangle .config/guix/manifests/emacs.scm :noweb yes
(specifications->manifest
'("emacs-native-comp"
<<packages()>>))
#+end_src

490
Guix.org Normal file
View file

@ -0,0 +1,490 @@
#+TITLE: Guix
#+PROPERTY: header-args :mkdirp yes
#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/usr/bin/env bash"
#+PROPERTY: header-args:scheme :comments link
[[https://guix.gnu.org/][GNU Guix]] is (1) a transactional package manager and (2) a GNU/Linux distribution.
My personal selling points are declarative package configuration and transactional upgrades.
References:
- [[https://guix.gnu.org/en/help/][Official help]]
- [[https://wiki.systemcrafters.cc/guix][System Crafters wiki]]
- [[https://gitlab.com/pjotrp/guix-notes][Pjotr Prins' Guix notes]]
- [[https://www.youtube.com/watch?v=iBaqOK75cho&list=PLEoMzSkcN8oNxnj7jm5V2ZcGc52002pQU][Davil Wilson's YouTube series]]
* Profiles
A profile is way to group Guix packages. Amongst many advantages, profiles can be defined by manifests, which in turn can be stored in VCS.
References:
- [[https://guix.gnu.org/en/cookbook/en/html_node/Guix-Profiles-in-Practice.html][Guix Profiles in Practice]]
** Activate profiles
A script to activate guix profiles. Usage:
#+begin_example
activate-profiles [profile1] [profile2] ...
#+end_example
Source: [[https://github.com/daviwil/dotfiles/blob/master/Systems.org#activating-profiles][David Wilson's config]]
#+begin_src bash :tangle ./bin/scripts/activate-profles
GREEN='\033[1;32m'
RED='\033[1;30m'
NC='\033[0m'
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
profiles=$*
if [[ $# -eq 0 ]]; then
profiles="$HOME/.config/guix/manifests/*.scm";
fi
for profile in $profiles; do
# Remove the path and file extension, if any
profileName=$(basename $profile)
profileName="${profileName%.*}"
profilePath="$GUIX_EXTRA_PROFILES/$profileName"
manifestPath=$HOME/.config/guix/manifests/$profileName.scm
if [ -f $manifestPath ]; then
echo
echo -e "${GREEN}Activating profile:" $manifestPath "${NC}"
echo
mkdir -p $profilePath
guix package --manifest=$manifestPath --profile="$profilePath/$profileName"
# Source the new profile
GUIX_PROFILE="$profilePath/$profileName"
if [ -f $GUIX_PROFILE/etc/profile ]; then
. "$GUIX_PROFILE"/etc/profile
else
echo -e "${RED}Couldn't find profile:" $GUIX_PROFILE/etc/profile "${NC}"
fi
else
echo "No profile found at path" $profilePath
fi
done
#+end_src
** Update profiles
A script to update Guix profiles. Usage:
#+begin_example
update-profiles [profile1] [profile2] ...
#+end_example
Source: once again, [[https://github.com/daviwil/dotfiles/blob/master/Systems.org#updating-profiles][David Wilson's config]].
#+begin_src bash :tangle ./bin/scripts/update-profiles
GREEN='\033[1;32m'
NC='\033[0m'
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
profiles=$*
if [[ $# -eq 0 ]]; then
profiles="$GUIX_EXTRA_PROFILES/*";
fi
for profile in $profiles; do
profileName=$(basename $profile)
profilePath=$GUIX_EXTRA_PROFILES/$profileName
echo
echo -e "${GREEN}Updating profile:" $profilePath "${NC}"
echo
guix package --profile="$profilePath/$profileName" --manifest="$HOME/.config/guix/manifests/$profileName.scm"
done
#+end_src
* Channels
Specifying additional channels.
References:
- [[https://gitlab.com/nonguix/nonguix][nonguix channel repo]]
- [[https://guix.gnu.org/manual/en/html_node/Channels.html][Guix channels reference]]
Nonguix channel is pinned to a particular commit to avoid recompiling stuff more than necessary.
#+begin_src scheme :tangle .config/guix/channels.scm
(cons*
(channel
(name 'channel-q)
(url "https://github.com/SqrtMinusOne/channel-q.git"))
(channel
(name 'flat)
(url "https://github.com/flatwhatson/guix-channel.git")
(introduction
(make-channel-introduction
"33f86a4b48205c0dc19d7c036c85393f0766f806"
(openpgp-fingerprint
"736A C00E 1254 378B A982 7AF6 9DBE 8265 81B6 4490"))))
(channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix")
(commit "d3c5eea0cbfe3e5bfbcf1fe15bc916fefacc624f")
(introduction
(make-channel-introduction
"897c1a470da759236cc11798f4e0a5f7d4d59fbc"
(openpgp-fingerprint
"2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"))))
%default-channels)
#+end_src
* Systems
Configuring systems with Guix.
Yes, all my machines are named after colors I like.
** Base configuration
The base configuration is shared between all the machines.
While it's possible to make a single =.scm= file with base confguration and load it, I noticed that it produces more cryptic error messages whenever there is an error in the base file, so I opt in for noweb.
=guix system= invocation is as follows:
#+begin_example
sudo -E guix system reconfigure ~/.config/guix/systems/[system].scm
#+end_example
Common modules:
#+begin_src scheme :tangle no :noweb-ref system-common
(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)
#+end_src
In principle, we could define a variable called =base-operating-system= and extend it in ancestors. However, then we would have to define mandatory fields like =host-name=, =bootloader= with dummy values. Since I'm already using noweb, there is little point.
The following code will be inserted in the top of the =operating-system= definition.
Use the fulll Linux kernel. I hope I'll be able to use Libre kernel somewhere later.
Inferior in kernel is used to avoid recompilation. It looks like I can pin these to diffent commits than in my =channels.scm=
#+begin_src scheme :tangle no :noweb-ref system-base
(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")
#+end_src
US/RU keyboard layout, switch with Alt+Shift.
#+begin_src scheme :tangle no :noweb-ref system-base
(keyboard-layout (keyboard-layout "us,ru" #:options '("grp:alt_shift_toggle")))
#+end_src
User accounts.
#+begin_src scheme :tangle no :noweb-ref system-base
(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))
#+end_src
Base packages, necessary right after the installation.
#+begin_src scheme :tangle no :noweb-ref system-base
(packages
(append
(list nss-certs
git
i3-gaps
i3lock
openbox
xterm
vim)
%base-packages))
#+end_src
Default services for each machine:
- override the default =%desktop-services= to add OpenVPN support
- add nix service
- add docker service
- add CUPS service
- add a symlink to ELF interpeter to where most Linux binaries expect it
#+begin_src scheme :tangle no :noweb-ref system-common
(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)))))))
#+end_src
** azure
=azure= is a Lenovo Ideapad 330 laptop.
=%backlight-udev-rule= should enable members of =video= group change the display backlight. See the relevant page at [[https://wiki.archlinux.org/title/Backlight][Arch Wiki]].
#+begin_src scheme :noweb yes :tangle ~/.config/guix/systems/azure.scm
<<system-common>>
(define %backlight-udev-rule
(udev-rule
"90-backlight.rules"
(string-append "ACTION==\"add\", SUBSYSTEM==\"backlight\", "
"RUN+=\"/run/current-system/profile/bin/chgrp video /sys/class/backlight/%k/brightness\""
"\n"
"ACTION==\"add\", SUBSYSTEM==\"backlight\", "
"RUN+=\"/run/current-system/profile/bin/chmod g+w /sys/class/backlight/%k/brightness\"")))
(operating-system
<<system-base>>
(host-name "azure")
(services (cons*
(set-xorg-configuration
(xorg-configuration
(keyboard-layout keyboard-layout)))
(modify-services %my-base-services
(elogind-service-type config =>
(elogind-configuration (inherit config)
(handle-lid-switch-external-power 'suspend)))
(udev-service-type config =>
(udev-configuration (inherit config)
(rules (cons %backlight-udev-rule
(udev-configuration-rules config))))))))
(bootloader
(bootloader-configuration
(bootloader grub-efi-bootloader)
(target "/boot/efi")
(keyboard-layout keyboard-layout)))
(swap-devices
(list (uuid "4b2dedb3-b111-4e69-8c05-6daa2b072c76")))
(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.
#+begin_src scheme :noweb yes :tangle ~/.config/guix/systems/blue.scm
<<system-common>>
(operating-system
<<system-base>>
(host-name "blue")
(bootloader
(bootloader-configuration
(bootloader grub-bootloader)
(target "/dev/sda")
(keyboard-layout keyboard-layout)))
(swap-devices
(list (uuid "d9ca4f8b-4bb1-420e-9371-3558731bada1")))
(file-systems
(cons* (file-system
(mount-point "/")
(device
(uuid "179fbd75-3c7f-4de2-8c4f-4c30939b8a3f"
'ext4))
(type "ext4"))
%base-file-systems)))
#+end_src
* System installation
** Preparation
In my cases the provided ISO doesn't work because of Libre kernel.
Fortunately, David Wilson has made [[https://github.com/SystemCrafters/guix-installer][a repository]] with a toolchain to make an ISO with the full kernel. In case it won't be an option, the [[https://gitlab.com/nonguix/nonguix][nonguix repo]] also has instructions on how to do that.
When an ISO is there, we have to write it on a USB stick. Run =sudo fdisk -l= to get a list of disks.
The approach in the official instruction is to create a bootable USB with =dd=:
#+begin_example
sudo dd of=/dev/sdxX if=<path-to-iso> status=progress && sync
#+end_example
However, I couldn't make it work for some strange reason. Fortunately, =gnome-disk-utility= was able to produce a bootable USB.
** Installation
Going further, the official instructions for installation & SystemCrafters wiki entry are pretty good, so it's not necessary to repeat them here.
** After installation
After the installation, the strategy is as follows.
Set a password for the main user (pavel). Login with openbox to get a tolerable interface, because i3 default config is horrible.
[[https://guix.gnu.org/en/manual/en/html_node/Keyboard-Layout-and-Networking-and-Partitioning.html#Keyboard-Layout-and-Networking-and-Partitioning][Connect to the internet]].
Clone the dotfiles repo:
#+begin_example
mkdir Code
cd Code
git clone https://github.com/SqrtMinusOne/dotfiles.git
#+end_example
Copy the channels file and run guix pull:
#+begin_example
cp ~/Code/dotfiles/.config/guix/channels.scm ~/.config/guix
guix pull
#+end_example
The first pull usually takes a while. After that install yadm and pull dotfiles:
#+begin_example
guix install yadm
guix clone https://github.com/SqrtMinusOne/dotfiles.git
#+end_example
And activate the required profiles. Again, downloading & building Emacs, Starship and stuff will take a while.
Don't forget to install =JetBrainsMono Nerd Font=.
* Misc software
| Category | Guix dependency |
|----------+-----------------|
| system | openvpn |
| system | python |
** VPN
I'm not sure how to properly spin up VPN on Guix, so here is what I'm doing now.
I'm currently using CyberGhost VPN. =~/.vpn= folder stores its OpenVPN config, modified as follows:
- paths to =ca=, =cert= and =key= are made absolute
- added =auth-user-pass= with a link to login info
*** vpn-start
To start VPN propely, we have to use DNS given by CyberGhost to prevent DNS leaks and disabled ipv6. The thing is that the manual method requires also manual setting of the IP address and gateway.
So this script:
- gets an active connection
- gets a device from that connection
- gets an IP from that device
- gets a gateway
- modifies the connection
- runs openvpn
This isn't tested and probably will fail if there are multiple active connections, for instance.
Also I'm a bit concerned with running openvpn as sudo, but I shall see if that screws me up somehow.
#+begin_src bash :tangle ~/bin/scripts/vpn-start
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME)" | sed 's/ *$//g')
DEVICE=$(nmcli -f connection.interface-name con show "$CONN" | awk '{ print $2 }')
IP=$(ip addr show "$DEVICE" | awk 'match($0, /.*inet (addr:)?(([0-9]*\.){3}[0-9]*\/[0-9]*).*/, ga) { print ga[2] } ')
GATEWAY=$(ip route list | awk ' /^default/ {print $3}')
DNS_1=10.101.0.243
DNS_2=38.132.106.139
echo "Connection: $CONN"
echo "Device: $DEVICE"
echo "IP: $IP"
echo "Gateway: $GATEWAY"
nmcli con modify "$CONN" ipv4.addresses "${IP}"
nmcli con modify "$CONN" ipv4.gateway "${GATEWAY}"
nmcli con modify "$CONN" ipv4.method manual
nmcli con modify "$CONN" ipv4.ignore-auto-dns yes
nmcli con modify "$CONN" +ipv4.dns $DNS_1
nmcli con modify "$CONN" +ipv4.dns $DNS_2
nmcli con modify "$CONN" ipv6.method ignore
nmcli connection up "$CONN"
sudo openvpn --config ~/.vpn/openvpn.ovpn
#+end_src
*** vpn-stop
Also a script to reverse the changes.
#+begin_src bash :tangle ~/bin/scripts/vpn-stop
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME)" | sed 's/ *$//g')
DNS_1=10.101.0.243
DNS_2=38.132.106.139
echo "Connection: $CONN"
nmcli con modify "$CONN" ipv4.ignore-auto-dns no
nmcli con modify "$CONN" -ipv4.dns $DNS_1
nmcli con modify "$CONN" -ipv4.dns $DNS_2
nmcli con modify "$CONN" ipv4.method auto
nmcli con modify "$CONN" ipv6.method auto
nmcli connection up "$CONN"
#+end_src
* Notes on installing software
| Category | Guix dependency | Description |
|----------+-----------------+----------------------------------------------------|
| system | patchelf | A program to modify existsing ELF executables |
| system | glibc | A lot of stuff, including ELF interpeter and ~ldd~ |
** flatpak
As for now, the easiest way to install most of proprietary software is via flatpak. See the relevant section in [[file:Desktop.org][Desktop.org]].
** conda
[[https://docs.conda.io/en/latest/][conda]] is a package manager, which I use for managing various versions of Python & Node.js.
It is packaged for GNU Guix, although the definition has its fair share of workarounds. It is almost surprising to see it work with all the C libraries and stuff. But there are still some problems.
First, it's impossible to perform =conda init= to patch files like =.bashrc=, because the command is hell-bent on modifying =/gnu/store/=. So I do this manually, look for the =init_conda= procedures in [[file:Console.org][Console.org]].
Second, base environment root is =/gnu/store=, so don't install anything there.
Third, by default it tries to create envronments in =/gnu/store=. I think it's enough to create one environment like this to fix it:
#+begin_src sh
mkdir -p ~/.conda/envs
conda create -p ~/.conda/envs/test
#+end_src
** wakatime-cli
| Note | Description |
|------+-----------------------|
| TODO | Package this for Guix |
Before I figure out how to package this for Guix:
- Clone [[https://github.com/wakatime/wakatime-cli][the repo]]
- Run ~go build~
- Copy the binary to the =~/bin= folder

215
Mail.org Normal file
View file

@ -0,0 +1,215 @@
#+TITLE: Mail
#+PROPERTY: header-args :mkdirp yes
#+PROPERTY: header-args:conf-unix :comments link
#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/usr/bin/env bash"
My email configuration with [[https://notmuchmail.org/][notmuch]] + [[https://github.com/gauteh/lieer][lieer]] + [[https://marlam.de/msmtp/][msmtp]]. My problem with any particular mail setup was that I use Gmail labels quite extensively, and handling these over IMAP is rather awkward. Hence this choice of software.
References:
- [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][My post]] about email configuration. I wrote it some time ago, but the general idea remains.
* Lieer
| Guix dependency |
|-----------------|
| python-lieer |
Lieer is a program to link up Gmail and notmuch. Basically, it dowloads mail from Gmail via API, stores them in maildir and syncronizes labels with notmuch.
I have a separate directory in my =~/Mail= for each address. To init lieer, run the following command in the directory:
#+begin_example
gmi init <address>
#+end_example
After which the settings will be stored in =gmailieer.json= and the credentials in =.credentials.gmailieer.json=. The latter file is stored encrypted.
My preferred settings:
#+begin_example
gmi set --replace-slash-with-dot
gmi set --ignore-tags-local new
#+end_example
Running =gmi sync= in the required directory performs the syncronization. The first sync takes a while, the subsequent syncs are pretty fast.
* Notmuch
| Guix dependency |
|-----------------|
| notmuch |
| parallel |
Notmuch is a CLI email indexer program, which handles labels in a way not unlike Gmail. It also provides a frontend for Emacs, but it's not the only one available.
** Config
:PROPERTIES:
:header-args+: :tangle ~/.notmuch-config
:END:
Not much is going on here.
First, the database path.
#+begin_src conf-unix
[database]
path=/home/pavel/Mail
#+end_src
Name and list of emails. It's not like it's a secret anyhow.
#+begin_src conf-unix
[user]
name=Pavel Korytov
primary_email=thexcloud@gmail.com
other_email=progin6304@gmail.com;
#+end_src
A list of tags which will be added by =notmuch new= and directory names which will be ignored by =notmuch new=.
#+begin_src conf-unix
[new]
tags=new;
ignore=.osync_workdir
#+end_src
Exclude these tags from search by default.
#+begin_src conf-unix
[search]
exclude_tags=trash;spam;
#+end_src
Maildir compatibility.
#+begin_src conf-unix
[maildir]
synchronize_flags=true
#+end_src
** Hooks
Now, we have to link up lieer and notmuch. This is done via the notmuch hook system, which allows to run custom scripts before and after any command.
*** =pre_new=
This hook runs fetch from Gmail in parallel before the =notmuch new= command.
The =parallel= command is provided by [[https://www.gnu.org/software/parallel/][GNU Parallel]].
#+begin_src bash :tangle ~/Mail/.notmuch/hooks/pre-new
# GMI="/home/pavel/Programs/miniconda3/envs/mail/bin/gmi"
GMI="gmi"
parallel -j0 "(cd /home/pavel/Mail/{}/ && $GMI sync)" ::: thexcloud progin6304
#+end_src
*** =post_new=
And this hook tags different mailboxes with different tags.
#+begin_src bash :tangle ~/Mail/.notmuch/hooks/post-new
notmuch tag +main "path:thexcloud/** AND tag:new"
notmuch tag +progin "path:progin6304/** AND tag:new"
notmuch tag -new "tag:new"
#+end_src
* Sync script
A script to run =notmuch new= and push a notification if there is new mail.
#+begin_src bash :tangle ~/bin/scripts/check-email
export DISPLAY=:0
CHECK_FILE="/home/pavel/Mail/.last_check"
QUERY="tag:unread"
ALL_QUERY="tag:unread"
if [ -f "$CHECK_FILE" ]; then
DATE=$(cat "$CHECK_FILE")
QUERY="$QUERY and date:@$DATE.."
fi
notmuch new
NEW_UNREAD=$(notmuch count "$QUERY")
ALL_UNREAD=$(notmuch count "$ALL_QUERY")
if [ $NEW_UNREAD -gt 0 ]; then
MAIN_UNREAD=$(notmuch count "tag:unread AND tag:main")
PROGIN_UNREAD=$(notmuch count "tag:unread AND tag:progin")
read -r -d '' NOTIFICATION <<EOM
$NEW_UNREAD new messages
$MAIN_UNREAD thexcloud@gmail.com
$PROGIN_UNREAD progin6304@gmail.com
$ALL_UNREAD total
EOM
notify-send "New Mail" "$NOTIFICATION"
fi
echo "$(date +%s)" > $CHECK_FILE
#+end_src
The script is ran via GNU Mcron every 5 minutes.
#+begin_src scheme :tangle ~/.config/cron/mail.guile
(job "*/5 * * * * " "~/bin/scripts/check-email")
#+end_src
* MSTP
| Guix dependency |
|-----------------|
| msmtp |
Sending emails can be done with MSMTP. It automatially chooses the email address and server based on the contents of the message, which is handy if there are multiple mailboxes to be managed.
As I haven't encrypted my passwords properly yet, I encrypt the entire configuration file.
* Emacs
:PROPERTIES:
:header-args+: :tangle ~/.emacs.d/mail.el
:END:
Finally, Emacs configuration.
The problem with my Guix setup is that Emacs by default doesn't see the elisp files of notmuch, so here is a small workaround:
#+begin_src emacs-lisp
(setq my/notmuch-loaded nil)
(defun my/run-notmuch ()
(interactive)
(when (not my/notmuch-loaded)
(let* ((notmuch-dir (shell-command-to-string "readlink -f $(which notmuch)"))
(notmuch-version (substring (shell-command-to-string "notmuch --version") 8 -1))
(notmuch-lisp-dir (concat
(substring notmuch-dir 0 -13)
"/share/emacs/site-lisp/notmuch-"
notmuch-version
"/")))
(push notmuch-lisp-dir load-path))
(setq my/notmuch-loaded t))
(notmuch))
(my-leader-def "am" 'my/run-notmuch)
#+end_src
And the proper notmuch settings:
#+begin_src emacs-lisp
(use-package notmuch
;; :ensure nil
:commands (notmuch)
:config
(setq mail-specify-envelope-from t)
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(setq notmuch-always-prompt-for-sender t)
(setq sendmail-program (executable-find "msmtp"))
(setq send-mail-function #'sendmail-send-it)
(add-hook 'notmuch-hello-mode-hook
(lambda () (display-line-numbers-mode 0)))
(custom-set-faces
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))))
#+end_src
The file to which this is tangled is read in the init.el.
* mailcap
mailcap file is a file which defines how to read to different MIME types. Notmuch also uses it, so why not keep it here.
#+begin_src text :tangle ~/.mailcap
audio/*; mpc add %s
image/*; feh %s
application/msword; /usr/bin/xdg-open %s
application/pdf; zathura %s
application/postscript ; zathura %s
text/html; /usr/bin/xdg-open %s
#+end_src
* Guix settings
#+NAME: packages
#+begin_src emacs-lisp :tangle no
(my/format-guix-dependencies)
#+end_src
#+begin_src scheme :tangle .config/guix/manifests/mail.scm :noweb yes
(specifications->manifest
'(
<<packages()>>))
#+end_src

View file

@ -1,4 +1,6 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../../Mail.org::*=post_new=][=post_new=:1]]
notmuch tag +main "path:thexcloud/** AND tag:new"
notmuch tag +progin "path:progin6304/** AND tag:new"
notmuch tag -new "tag:new"
# =post_new=:1 ends here

View file

@ -1,3 +1,6 @@
#!/bin/bash
GMI="/home/pavel/Programs/miniconda3/envs/mail/bin/gmi"
#!/usr/bin/env bash
# [[file:../../../Mail.org::*=pre_new=][=pre_new=:1]]
# GMI="/home/pavel/Programs/miniconda3/envs/mail/bin/gmi"
GMI="gmi"
parallel -j0 "(cd /home/pavel/Mail/{}/ && $GMI sync)" ::: thexcloud progin6304
# =pre_new=:1 ends here

View file

@ -2,50 +2,59 @@
[[https://forthebadge.com/images/badges/works-on-my-machine.svg]]
* Programs used
Deployed with [[https://yadm.io/][yadm]]
A set of my GNU/Linux configuration files.
| Group | Program | Purpose | Status | Documented? | Notes |
|-----------+----------------+--------------------------------+-------------------+-------------+-----------------------------------------------------------|
| console | bash | shell | launches fish :) | [[file:Console.org::*Bash][Console.org]] | |
| console | [[https://fishshell.com/][fish]] | shell | *active* | [[file:Console.org::*Fish][Console.org]] | |
| console | [[https://github.com/starship/starship][starship]] | prompt | *active* | [[file:Console.org::*Starship][Console.org]] | |
| console | [[https://github.com/tmux/tmux][tmux]] | terminal multiplexer | *active* | [[file:Console.org::*Tmux][Console.org]] | |
| console | [[https://github.com/ogham/exa][exa]] | ls clone | *active* | - | |
| console | [[https://github.com/moonpyk/dtrx][dtrx]] | archive extractor | *active* | - | |
| console | [[https://github.com/jhspetersson/fselect][fselect]] | SQL-like find | *active* | - | |
| console | [[https://github.com/sharkdp/bat][bat]] | cat clone | *active* | - | |
| console | [[https://github.com/alacritty/alacritty][alacritty]] | terminal emulator | *active* | [[file:Console.org::*Alacritty][Console.org]] | |
| console | [[https://vifm.info/][vifm]] | file manager with vim bindings | archive | - | |
| mail | [[https://notmuchmail.org/][notmuch]] | mail indexer | *active* | [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][post]] | |
| mail | [[https://github.com/gauteh/lieer][lieer]] | gmail API client | *active* | [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][post]] | credentials are encrypted |
| mail | [[https://marlam.de/msmtp/][msmtp]] | SMTP client | *active* | - | encrypted |
| editor | [[https://www.gnu.org/software/emacs/][emacs]] | everything | *active* | [[file:Emacs.org][Emacs.org]] | GitHub renders .org files without labels and =tangle: no= |
| editor | [[https://www.vim.org/][vim]] | text edtior | *active* | - | A minimal config to have a lightweight terminal $EDITOR |
| editor | [[https://neovim.io/][neovim]] | text edtior | archive | - | |
| documents | [[https://mg.readthedocs.io/latexmk.html][latexmk]] | LaTeX build tool | *active* | - | |
| documents | [[https://pwmt.org/projects/zathura/][zathura]] | pdf viewer | *active* | [[file:Desktop.org::*dunst][Desktop.org]] | |
| desktop | [[https://github.com/dunst-project/dunst][dunst]] | notification manager | *active* | [[file:Desktop.org::*dunst][Desktop.org]] | |
| desktop | [[https://i3wm.org/][i3wm]] | tiling WM | *active* | [[file:Desktop.org::*i3wm][Desktop.org]] | |
| desktop | [[https://github.com/jordansissel/keynav][keynav]] | control mouse with keyboard | *active* | [[file:Desktop.org::*keynav][Desktop.org]] | |
| desktop | [[https://github.com/polybar/polybar][polybar]] | status bar | *active* | [[file:Desktop.org::*Polybar][Desktop.org]] | |
| desktop | [[https://github.com/davatorium/rofi][rofi]] | generic menu | *active* | [[file:Desktop.org::*Rofi][Desktop.org]] | |
| desktop | [[https://github.com/flameshot-org/flameshot][flameshot]] | screenshot | *active* | [[file:Desktop.org::Flameshot][Desktop.org]] | |
| desktop | [[https://github.com/yshui/picom][picom]] | X11 compositor | *active* | [[file:Desktop.org::*Picom][Desktop.org]] | |
| desktop | [[https://github.com/vivien/i3blocks][i3blocks]] | status bar | archive | - | |
| internet | [[https://github.com/tridactyl/tridactyl][tridactyl]] | vim bindings for Firefox | *active* | - | templated with yadm |
| internet | [[https://newsboat.org/][newsboat]] | terminal RSS reader | *active* | - | urls are encrypted |
| internet | [[https://qutebrowser.org/][qutebrowser]] | browser with vim bindings | archive | - | |
| internet | [[https://github.com/jarun/buku][buku]] | bookmarks manager | archive | - | |
| internet | [[https://tabliss.io/][tabliss]] | new tab page | *active* | - | runned as server to work with tridactyl |
| audio | [[https://www.musicpd.org/][mpd]] | music player daemon | *active* | - | |
| audio | [[https://github.com/ncmpcpp/ncmpcpp][ncmpcpp]] | MPD frontend | *active* | - | |
| audio | [[https://github.com/graysky2/pulseaudio-ctl][pulseaudio-ctl]] | PulseAudio controller | archive | - | |
| dev | [[https://github.com/prompt-toolkit/ptpython][ptpython]] | Python REPL | archive | - | |
| dev | [[https://github.com/inducer/pudb][pudb]] | Python Debugger | archive | - | |
| misc | [[https://yadm.io][yadm]] | dotfiles manager | *active* | - | |
| misc | [[https://github.com/risacher/sunwait][sunwait]] | sunrise calculator | *active* | - | |
| misc | [[https://github.com/vergoh/vnstat][vnstat]] | traffic stats | *active* | - | |
The majority of the software is configured with [[https://leanpub.com/lit-config/read][literate configuration]] strategy via Emacs' Org Mode. This way has its advantages and disadvantages, but overall it's pretty nice to keep the configs interweaved with comments in a handful of files.
The files themselved are managed and deployed via [[https://yadm.io/][yadm]], but I mostly use Org Mode rich noweb whenever I can instead of what yadm offers.
My current GNU/Linux distribution is [[https://guix.gnu.org/][GNU Guix]]. In the context of this repo, Guix allows to list all the used programs in manifests, which means I have the same set of programs across multiple machines. Looks for Org tables with "Guix dependency" in the header.
Literate configuration files:
- [[file:Emacs.org][Emacs.org]]
- [[file:Desktop.org][Desktop.org]]
- [[file:Console.org][Console.org]]
- [[file:Guix.org][Guix.org]]
* Programs used
Some of the notable programs are listed in the table below.
| Group | Program | Purpose | Status | Documented? | Notes |
|-----------+----------------+-----------------------------+------------------+-------------+-----------------------------------------------------------|
| console | bash | shell | launches fish :) | [[file:Console.org::*Bash][Console.org]] | |
| console | [[https://fishshell.com/][fish]] | shell | *active* | [[file:Console.org::*Fish][Console.org]] | |
| console | [[https://github.com/starship/starship][starship]] | prompt | *active* | [[file:Console.org::*Starship][Console.org]] | |
| console | [[https://github.com/tmux/tmux][tmux]] | terminal multiplexer | *active* | [[file:Console.org::*Tmux][Console.org]] | |
| console | [[https://github.com/alacritty/alacritty][alacritty]] | terminal emulator | *active* | [[file:Console.org::*Alacritty][Console.org]] | |
| mail | [[https://notmuchmail.org/][notmuch]] | mail indexer | *active* | [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][post]] | |
| mail | [[https://github.com/gauteh/lieer][lieer]] | gmail API client | *active* | [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][post]] | credentials are encrypted |
| mail | [[https://marlam.de/msmtp/][msmtp]] | SMTP client | *active* | - | encrypted |
| editor | [[https://www.gnu.org/software/emacs/][emacs]] | everything | *active* | [[file:Emacs.org][Emacs.org]] | GitHub renders .org files without labels and =tangle: no= |
| editor | [[https://www.vim.org/][vim]] | text edtior | *active* | - | A minimal config to have a lightweight terminal $EDITOR |
| editor | [[https://neovim.io/][neovim]] | text edtior | archive | - | |
| documents | [[https://mg.readthedocs.io/latexmk.html][latexmk]] | LaTeX build tool | *active* | - | |
| documents | [[https://pwmt.org/projects/zathura/][zathura]] | pdf viewer | *active* | [[file:Desktop.org::*dunst][Desktop.org]] | |
| desktop | [[https://github.com/dunst-project/dunst][dunst]] | notification manager | *active* | [[file:Desktop.org::*dunst][Desktop.org]] | |
| desktop | [[https://i3wm.org/][i3wm]] | tiling WM | *active* | [[file:Desktop.org::*i3wm][Desktop.org]] | |
| desktop | [[https://github.com/jordansissel/keynav][keynav]] | control mouse with keyboard | *active* | [[file:Desktop.org::*keynav][Desktop.org]] | |
| desktop | [[https://github.com/polybar/polybar][polybar]] | status bar | *active* | [[file:Desktop.org::*Polybar][Desktop.org]] | |
| desktop | [[https://github.com/davatorium/rofi][rofi]] | generic menu | *active* | [[file:Desktop.org::*Rofi][Desktop.org]] | |
| desktop | [[https://github.com/flameshot-org/flameshot][flameshot]] | screenshot | *active* | [[file:Desktop.org::Flameshot][Desktop.org]] | |
| desktop | [[https://github.com/yshui/picom][picom]] | X11 compositor | *active* | [[file:Desktop.org::*Picom][Desktop.org]] | |
| desktop | [[https://github.com/vivien/i3blocks][i3blocks]] | status bar | archive | - | |
| internet | [[https://github.com/tridactyl/tridactyl][tridactyl]] | vim bindings for Firefox | *active* | - | templated with yadm |
| internet | [[https://newsboat.org/][newsboat]] | terminal RSS reader | archive | - | urls are encrypted |
| internet | [[https://qutebrowser.org/][qutebrowser]] | browser with vim bindings | archive | - | |
| internet | [[https://github.com/jarun/buku][buku]] | bookmarks manager | archive | - | |
| internet | [[https://tabliss.io/][tabliss]] | new tab page | *active* | - | runned as server to work with tridactyl |
| audio | [[https://www.musicpd.org/][mpd]] | music player daemon | *active* | - | |
| audio | [[https://github.com/ncmpcpp/ncmpcpp][ncmpcpp]] | MPD frontend | *active* | - | |
| audio | [[https://github.com/graysky2/pulseaudio-ctl][pulseaudio-ctl]] | PulseAudio controller | archive | - | |
| dev | [[https://github.com/prompt-toolkit/ptpython][ptpython]] | Python REPL | archive | - | |
| dev | [[https://github.com/inducer/pudb][pudb]] | Python Debugger | archive | - | |
| misc | [[https://yadm.io][yadm]] | dotfiles manager | *active* | - | |
| misc | [[https://github.com/risacher/sunwait][sunwait]] | sunrise calculator | *active* | - | |
| misc | [[https://github.com/vergoh/vnstat][vnstat]] | traffic stats | *active* | - | |
* Posts about my configuration
- [[https://sqrtminusone.xyz/posts/2021-05-01-org-python/][Replacing Jupyter Notebook with Org Mode]]

6
bin/aw-start Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# [[file:../Guix.org::*ActivityWatch][ActivityWatch:3]]
~/bin/activitywatch/aw-server/aw-server &
~/bin/activitywatch/aw-watcher-afk/aw-watcher-afk &
~/bin/activitywatch/aw-watcher-window/aw-watcher-window &
# ActivityWatch:3 ends here

View file

@ -1,9 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../Desktop.org::*Launching][Launching:1]]
hostname=$(hostname)
# Settings varying on the hostname
if [ "$hostname" = "pntk" ]; then
TRAY_MONITOR="eDP1"
if [ "$hostname" = "azure" ]; then
TRAY_MONITOR="eDP-1"
export WLAN_INTERFACE="wlp3s0"
else
TRAY_MONITOR="HDMI-A-0"
@ -12,24 +12,24 @@ fi
# Setting varying on the monitor
declare -A FONT_SIZES=(
["eDP1"]="13"
["eDP-1"]="13"
["DVI-D-0"]="11"
["HDMI-A-0"]="13"
)
declare -A EMOJI_SCALE=(
["eDP1"]="9"
["eDP-1"]="9"
["DVI-D-0"]="10"
["HDMI-A-0"]="10"
)
declare -A BAR_HEIGHT=(
["eDP1"]="29"
["eDP-1"]="29"
["DVI-D-0"]="23"
["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"
["eDP1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun aw-afk date TSEP"
["eDP-1"]="pulseaudio mpd SEP cpu ram-memory swap-memory SEP network ipstack-vpn SEP xkeyboard SEP battery SEP sun date TSEP"
)
# Geolocation for some modules

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*aw-afk][aw-afk:1]]
afk_event=$(curl -s -X GET "http://localhost:5600/api/0/buckets/aw-watcher-afk_$(hostname)/events?limit=1" -H "accept: application/json")
status=$(echo ${afk_event} | jq -r '.[0].data.status')

View file

@ -1,6 +1,10 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*ipstack-vpn][ipstack-vpn:1]]
ip=$(dig +short +timeout=1 myip.opendns.com @resolver1.opendns.com 2> /dev/null)
if [[ ! -f ~/secrets/ipstack-api-key ]]; then
echo "%{u#f07178}%{+u} ?? %{u-}"
exit
fi
API_KEY="$(cat ~/secrets/ipstack-api-key)"
if [[ -z $ip || $ip == *"timed out"* ]]; then
echo "%{u#f07178}%{+u} ?? %{u-}"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*sun][sun:1]]
declare -A LAT_DATA=(
["TMN"]="57.15N"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*TSEP][TSEP:1]]
if [ ! -z "$TRAY" ] && [ "$TRAY" != "none" ]; then
echo "| "

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*weather][weather:1]]
bar_format="${BAR_FORMAT:-"%t"}"
location="${LOCATION:-"Saint-Petersburg"}"

39
bin/scripts/activate-profles Executable file
View file

@ -0,0 +1,39 @@
#!/usr/bin/env bash
# [[file:../../Guix.org::*Activate profiles][Activate profiles:1]]
GREEN='\033[1;32m'
RED='\033[1;30m'
NC='\033[0m'
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
profiles=$*
if [[ $# -eq 0 ]]; then
profiles="$HOME/.config/guix/manifests/*.scm";
fi
for profile in $profiles; do
# Remove the path and file extension, if any
profileName=$(basename $profile)
profileName="${profileName%.*}"
profilePath="$GUIX_EXTRA_PROFILES/$profileName"
manifestPath=$HOME/.config/guix/manifests/$profileName.scm
if [ -f $manifestPath ]; then
echo
echo -e "${GREEN}Activating profile:" $manifestPath "${NC}"
echo
mkdir -p $profilePath
guix package --manifest=$manifestPath --profile="$profilePath/$profileName"
# Source the new profile
GUIX_PROFILE="$profilePath/$profileName"
if [ -f $GUIX_PROFILE/etc/profile ]; then
. "$GUIX_PROFILE"/etc/profile
else
echo -e "${RED}Couldn't find profile:" $GUIX_PROFILE/etc/profile "${NC}"
fi
else
echo "No profile found at path" $profilePath
fi
done
# Activate profiles:1 ends here

View file

@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Mail.org::*Sync script][Sync script:1]]
export DISPLAY=:0
CHECK_FILE="/home/pavel/Mail/.last_check"
QUERY="tag:unread"
@ -25,3 +26,4 @@ EOM
fi
echo "$(date +%s)" > $CHECK_FILE
# Sync script:1 ends here

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*Launch script][Launch script:1]]
CLASSNAME="dropdown_tmux"
COMMAND="alacritty --class $CLASSNAME -e tmux new-session -s $CLASSNAME"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*Buku bookmarks][Buku bookmarks:1]]
if [ $(hostname) = 'pdsk' ]; then
BUKU="/home/pavel/.local/bin/buku"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*Man pages][Man pages:1]]
SELECTED=$(man -k . | rofi -dmenu -l 20 | awk '{print $1}')
if [[ ! -z $SELECTED ]]; then

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*Keyboard Layout][Keyboard Layout:1]]
setxkbmap -layout us,ru
setxkbmap -model pc105 -option 'grp:win_space_toggle' -option 'grp:alt_shift_toggle'

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# [[file:../../Desktop.org::*Keyboard Layout][Keyboard Layout:2]]
if setxkbmap -query | grep -q us,ru; then
setxkbmap -layout us

22
bin/scripts/update-profiles Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# [[file:../../Guix.org::*Update profiles][Update profiles:1]]
GREEN='\033[1;32m'
NC='\033[0m'
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
profiles=$*
if [[ $# -eq 0 ]]; then
profiles="$GUIX_EXTRA_PROFILES/*";
fi
for profile in $profiles; do
profileName=$(basename $profile)
profilePath=$GUIX_EXTRA_PROFILES/$profileName
echo
echo -e "${GREEN}Updating profile:" $profilePath "${NC}"
echo
guix package --profile="$profilePath/$profileName" --manifest="$HOME/.config/guix/manifests/$profileName.scm"
done
# Update profiles:1 ends here

25
bin/scripts/vpn-start Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# [[file:../../Guix.org::*vpn-start][vpn-start:1]]
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME)" | sed 's/ *$//g')
DEVICE=$(nmcli -f connection.interface-name con show "$CONN" | awk '{ print $2 }')
IP=$(ip addr show "$DEVICE" | awk 'match($0, /.*inet (addr:)?(([0-9]*\.){3}[0-9]*\/[0-9]*).*/, ga) { print ga[2] } ')
GATEWAY=$(ip route list | awk ' /^default/ {print $3}')
DNS_1=10.101.0.243
DNS_2=38.132.106.139
echo "Connection: $CONN"
echo "Device: $DEVICE"
echo "IP: $IP"
echo "Gateway: $GATEWAY"
nmcli con modify "$CONN" ipv4.addresses "${IP}"
nmcli con modify "$CONN" ipv4.gateway "${GATEWAY}"
nmcli con modify "$CONN" ipv4.method manual
nmcli con modify "$CONN" ipv4.ignore-auto-dns yes
nmcli con modify "$CONN" +ipv4.dns $DNS_1
nmcli con modify "$CONN" +ipv4.dns $DNS_2
nmcli con modify "$CONN" ipv6.method ignore
nmcli connection up "$CONN"
sudo openvpn --config ~/.vpn/openvpn.ovpn
# vpn-start:1 ends here

15
bin/scripts/vpn-stop Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# [[file:../../Guix.org::*vpn-stop][vpn-stop:1]]
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME)" | sed 's/ *$//g')
DNS_1=10.101.0.243
DNS_2=38.132.106.139
echo "Connection: $CONN"
nmcli con modify "$CONN" ipv4.ignore-auto-dns no
nmcli con modify "$CONN" -ipv4.dns $DNS_1
nmcli con modify "$CONN" -ipv4.dns $DNS_2
nmcli con modify "$CONN" ipv4.method auto
nmcli con modify "$CONN" ipv6.method auto
nmcli connection up "$CONN"
# vpn-stop:1 ends here