feat(guix): eminence

This commit is contained in:
Pavel Korytov 2021-07-10 19:49:10 +03:00
parent f5e7d44aed
commit 21d8917821
9 changed files with 256 additions and 50 deletions

View file

@ -1,5 +1,6 @@
(specifications->manifest
'(
"p7zip"
"fzf"
"neofetch"
"osync"

View file

@ -23,6 +23,7 @@
(define %my-base-services
(cons*
(service openssh-service-type)
(screen-locker-service i3lock "i3lock")
(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

View file

@ -0,0 +1,136 @@
;; [[file:../../../Guix.org::*eminence][eminence: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)
(screen-locker-service i3lock "i3lock")
(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 "d3c5eea0cbfe3e5bfbcf1fe15bc916fefacc624f"))
(channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(commit "cf88c967afbf15c58efb0ba37d6638f1be9a0481"))))
(inferior
(inferior-for-channels channels)))
(first (lookup-inferior-packages inferior "linux" "5.12.9"))))
;; (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 "eminence")
(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 "f93cf3f6-7ee7-42ec-8ee2-f3d896fdf9b5")))
(file-systems
(cons* (file-system
(mount-point "/")
(device
(uuid "1d937704-bbeb-43b5-bc63-453886c426af"
'ext4))
(type "ext4"))
(file-system
(mount-point "/boot/efi")
(device (uuid "0031-3784" 'fat32))
(type "vfat"))
%base-file-systems))
;; eminence:1 ends here

View file

@ -1,3 +0,0 @@
c.ConsoleWidget.font_size = 12
c.JupyterWidget.syntax_style = 'inkpot'
c.ConsoleWidget.paging = 'vsplit'

View file

@ -39,17 +39,21 @@ fi
# Guix settings:3 ends here
# [[file:Console.org::*Guix settings][Guix settings:4]]
export GUIX_PACKAGE_PATH=~/guix-packages
export JUPYTER_CONFIG_DIR=$HOME/.config/jupyter
# Guix settings:4 ends here
# [[file:Console.org::*Guix settings][Guix settings:5]]
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
export GUIX_PACKAGE_PATH=~/guix-packages
# Guix settings:5 ends here
# [[file:Console.org::*Guix settings][Guix settings:6]]
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share/applications"
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
# Guix settings:6 ends here
# [[file:Console.org::*Guix settings][Guix settings:7]]
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.nix-profile/share/applications"
# Guix settings:7 ends here
# [[file:Console.org::*XResources][XResources:1]]
xrdb ~/.Xresources
# XResources:1 ends here

View file

@ -87,6 +87,11 @@ if [ -d "$HOME/.guix-extra-profiles/desktop" ]; then
fi
#+end_src
Set Jupyter config PATH. It defaults to readonly directory somewhere in Guix profile.
#+begin_src sh
export JUPYTER_CONFIG_DIR=$HOME/.config/jupyter
#+end_src
Set a folder for my packages.
#+begin_src sh
export GUIX_PACKAGE_PATH=~/guix-packages

144
Guix.org
View file

@ -27,8 +27,9 @@ References:
- [[#channels][Channels]]
- [[#systems][Systems]]
- [[#base-configuration][Base configuration]]
- [[#azure][azure]]
- [[#indigo][indigo]]
- [[#eminence][eminence]]
- [[#azure][azure]]
- [[#system-installation][System installation]]
- [[#preparation][Preparation]]
- [[#installation][Installation]]
@ -215,14 +216,14 @@ Inferior in the kernel is used to avoid recompilation. It looks like I can pin t
(list (channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix")
(commit "46c1d8bcca674d3a71cd077c52dde9552a89873d"))
(commit "d3c5eea0cbfe3e5bfbcf1fe15bc916fefacc624f"))
(channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(commit "f463f376e91ccc1fe4ab68d5e822b5d71a1234f5"))))
(commit "cf88c967afbf15c58efb0ba37d6638f1be9a0481"))))
(inferior
(inferior-for-channels channels)))
(first (lookup-inferior-packages inferior "linux" "5.12.8"))))
(first (lookup-inferior-packages inferior "linux" "5.12.9"))))
;; (kernel linux)
(initrd microcode-initrd)
(firmware (list linux-firmware))
@ -294,6 +295,103 @@ Default services for each machine:
#+end_src
** indigo
=indigo= is my desktop PC.
#+begin_src scheme :noweb yes :tangle ~/.config/guix/systems/indigo.scm
<<system-common>>
(operating-system
<<system-base>>
(host-name "indigo")
(services (cons*
(set-xorg-configuration
(xorg-configuration
(keyboard-layout keyboard-layout)))
%my-base-services))
(bootloader
(bootloader-configuration
(bootloader grub-efi-bootloader)
(target "/boot/efi")
(keyboard-layout keyboard-layout)))
(swap-devices
(list (uuid "059a2c26-8f70-4986-adf0-1a2e7b511404")))
(file-systems
(cons* (file-system
(mount-point "/")
(device (file-system-label "my-root"))
(type "ext4"))
(file-system
(mount-point "/boot/efi")
(device "/dev/sda1")
(type "vfat"))
%base-file-systems)))
#+end_src
** eminence
=eminence= is a HP 15s 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/eminence.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 "eminence")
(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 "f93cf3f6-7ee7-42ec-8ee2-f3d896fdf9b5")))
(file-systems
(cons* (file-system
(mount-point "/")
(device
(uuid "1d937704-bbeb-43b5-bc63-453886c426af"
'ext4))
(type "ext4"))
(file-system
(mount-point "/boot/efi")
(device (uuid "0031-3784" 'fat32))
(type "vfat"))
%base-file-systems))
#+end_src
** azure
=azure= is a Lenovo Ideapad 330 laptop.
@ -349,42 +447,6 @@ Default services for each machine:
%base-file-systems)))
#+end_src
** indigo
=indigo= is my desktop PC.
#+begin_src scheme :noweb yes :tangle ~/.config/guix/systems/indigo.scm
<<system-common>>
(operating-system
<<system-base>>
(host-name "indigo")
(services (cons*
(set-xorg-configuration
(xorg-configuration
(keyboard-layout keyboard-layout)))
%my-base-services))
(bootloader
(bootloader-configuration
(bootloader grub-efi-bootloader)
(target "/boot/efi")
(keyboard-layout keyboard-layout)))
(swap-devices
(list (uuid "059a2c26-8f70-4986-adf0-1a2e7b511404")))
(file-systems
(cons* (file-system
(mount-point "/")
(device (file-system-label "my-root"))
(type "ext4"))
(file-system
(mount-point "/boot/efi")
(device "/dev/sda1")
(type "vfat"))
%base-file-systems)))
#+end_src
* System installation
** Preparation
In my case, the provided ISO doesn't work because of the Libre kernel.
@ -462,7 +524,7 @@ I'm currently using CyberGhost VPN. =~/.vpn= folder stores its OpenVPN config (=
#+end_src
- run [[https://github.com/alfredopalhares/openvpn-update-resolv-conf][openvpn-update-resolv-conf]] script to fix DNS. =openvpn-update-resolve-conf= originates in my [[https://github.com/SqrtMinusOne/channel-q][channel-q]].
#+begin_src conf-space :tangle no
setenv PATH /home/pavel/.guix-extra-profiles/system/system/bin:/home/pavel/.guix-extra-profiles/system/system/sbin:/home/pavel/.guix-extra-profiles/console/console/bin:/run/current-system/profile/bi:n/run/current-system/profile/sbin
setenv PATH /home/pavel/.guix-extra-profiles/system/system/bin:/home/pavel/.guix-extra-profiles/system/system/sbin:/home/pavel/.guix-extra-profiles/console/console/bin:/run/current-system/profile/bin:/run/current-system/profile/sbin
up /home/pavel/.guix-extra-profiles/system/system/bin/update-resolv-conf.sh
down /home/pavel/.guix-extra-profiles/system/system/bin/update-resolv-conf.sh

View file

@ -1,5 +1,5 @@
#!/bin/sh
# [[file:../../Guix.org::*VPN][VPN:5]]
# [[file:../../Guix.org::*VPN][VPN:6]]
echo "Adding default route to $route_vpn_gateway with /0 mask..."
IP=/run/current-system/profile/sbin/ip
@ -9,4 +9,4 @@ $IP route add default via $route_vpn_gateway
echo "Removing /1 routes..."
$IP route del 0.0.0.0/1 via $route_vpn_gateway
$IP route del 128.0.0.0/1 via $route_vpn_gateway
# VPN:5 ends here
# VPN:6 ends here

View file

@ -4,7 +4,7 @@ CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME|br-.*|veth.*
echo "Connection: $CONN"
nmcli con modify "$CONN" ipv6.method ignore
sudo nmcli con modify "$CONN" ipv6.method ignore
nmcli connection up "$CONN"
sudo openvpn --config ~/.vpn/openvpn.ovpn
# vpn-start:1 ends here