feat(*): migrate to Guix

This commit is contained in:
Pavel Korytov 2021-06-01 17:27:11 +03:00
parent c40d199aad
commit 8c7105de9d
20 changed files with 109 additions and 40 deletions

View file

@ -25,7 +25,7 @@ export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'"
# [[file:Console.org::*Launch fish][Launch fish:1]]
use_fish=true
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} ]]
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} && $(command -v fish) ]]
then
exec fish
fi

View file

@ -18,3 +18,7 @@ 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

View file

@ -1,8 +1,11 @@
;; [[file:../../Guix.org::*Channels][Channels:1]]
(cons*
(channel
(name 'flat)
(url "https://github.com/flatwhatson/guix-channel.git"))
(channel
(name 'channel-q)
(url "file:///home/pavel/Code/channel-q"))
(url "https://github.com/SqrtMinusOne/channel-q.git"))
(channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix"))

View file

@ -1,5 +1,6 @@
(specifications->manifest
'(
"xrandr"
"zathura-djvu"
"zathura-pdf-poppler"
"zathura-ps"
@ -10,6 +11,7 @@
"flameshot"
"rofi"
"sunwait"
"jq"
"curl"
"bind"
"polybar"

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"))
@ -558,6 +558,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(use-package wakatime-mode
:straight t
:disabled
:config
(advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path "/home/pavel/bin/wakatime-cli")))
(global-wakatime-mode))
@ -2373,8 +2374,8 @@ parent."
'("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") ("/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-login-env (("SHELL") ("/usr/bin/env bash")))
(tramp-remote-shell "/usr/bin/env bash")
(tramp-remote-shell-args ("-c")))))

View file

@ -186,7 +186,7 @@ Launch fish shell unless bash itself is launched from fish.
#+begin_src bash
use_fish=true
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} ]]
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} && $(command -v fish) ]]
then
exec fish
fi
@ -347,6 +347,11 @@ 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 |
|-----------------+---------------------|

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.
@ -697,7 +697,7 @@ The script below allows me to:
hostname=$(hostname)
# Settings varying on the hostname
if [ "$hostname" = "pntk" ]; then
TRAY_MONITOR="eDP1"
TRAY_MONITOR="eDP-1"
export WLAN_INTERFACE="wlp3s0"
else
TRAY_MONITOR="HDMI-A-0"
@ -706,24 +706,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
@ -842,15 +842,20 @@ Some of the custom modules below use Org mode noweb to evaluate colors, because
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 | |
| 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-}"
@ -903,9 +908,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")
@ -1977,6 +1983,9 @@ map <C-r> set recolor false
map <C-R> set recolor true
#+end_src
* Guix settings
| Guix dependency | Description |
| xrandr | X11 CLI to RandR |
#+NAME: packages
#+begin_src emacs-lisp :tangle no
(my/format-guix-dependencies)

View file

@ -297,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
@ -1128,6 +1128,7 @@ Before I figure out how to package this for Guix:
#+begin_src emacs-lisp
(use-package wakatime-mode
:straight t
:disabled
:config
(advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path "/home/pavel/bin/wakatime-cli")))
(global-wakatime-mode))
@ -3558,6 +3559,10 @@ 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/]]
@ -3568,8 +3573,8 @@ Idea:
'("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") ("/bin/sh")))
(tramp-remote-shell "/bin/sh")
(tramp-login-env (("SHELL") (locate-file "file" exec-path)))
(tramp-remote-shell (locate-file "file" exec-path))
(tramp-remote-shell-args ("-c")))))

View file

@ -105,9 +105,12 @@ References:
#+begin_src scheme :tangle .config/guix/channels.scm
(cons*
(channel
(name 'flat)
(url "https://github.com/flatwhatson/guix-channel.git"))
(channel
(name 'channel-q)
(url "file:///home/pavel/Code/channel-q"))
(url "https://github.com/SqrtMinusOne/channel-q.git"))
(channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix"))
@ -134,6 +137,7 @@ Common modules:
(use-modules (gnu packages certs))
(use-modules (gnu packages version-control))
(use-modules (gnu packages vim))
(use-modules (gnu packages xorg))
(use-modules (gnu packages wm))
(use-modules (gnu packages openbox))
(use-modules (nongnu packages linux))
@ -181,6 +185,7 @@ The following code will be inserted in the top of the =operating-system= definit
git
i3-gaps
openbox
xterm
vim)
%base-packages))
@ -193,6 +198,37 @@ The following code will be inserted in the top of the =operating-system= definit
(keyboard-layout keyboard-layout))))
%desktop-services))
#+end_src
** azure
=azure= is a Lenovo Ideapad 330 laptop.
#+begin_src scheme :noweb yes :tangle ~/.config/guix/systems/azure.scm
<<system-common>>
(operating-system
<<system-base>>
(host-name "azure")
(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.

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"
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"}"

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