config/guix/system: Init laptop-sasasa.

Move mirror.brielmaier.net.pub to system dir to make it easier to share the
whole setup.

Centralize laptop common configs to default.scm.
master
Pierre Neidhardt 2020-12-20 12:11:44 +01:00
parent 5065c5ba5e
commit a36dc9bb51
4 changed files with 183 additions and 107 deletions

View File

@ -4,7 +4,8 @@
#:use-module (srfi srfi-1)
#:use-module (gnu)
#:use-module (gnu system nss)
#:use-module (gnu system mapped-devices))
#:use-module (gnu system mapped-devices)
#:use-module (guix packages))
(use-service-modules
desktop
@ -13,6 +14,7 @@
(use-package-modules
certs ; nss-certs
gnome ; For gnome-minimal
linux ; ntfs-3g
mtools ; exfat
nano ; To remove nano.
@ -30,6 +32,30 @@
"69-cdemu-vhba.rules"
(string-append "KERNEL==\"vhba_ctl\", SUBSYSTEM==\"misc\", TAG+=\"uaccess\"")))
(define-public %ambrevar/xorg-touchpad
"Section \"InputClass\"
Identifier \"Touchpads\"
Driver \"libinput\"
MatchDevicePath \"/dev/input/event*\"
MatchIsTouchpad \"on\"
Option \"DisableWhileTyping\" \"on\"
Option \"MiddleEmulation\" \"on\"
Option \"ClickMethod\" \"clickfinger\"
Option \"ScrollMethod\" \"twofinger\"
Option \"NaturalScrolling\" \"true\"
EndSection")
(define-public %ambrevar/backlight-udev-rule
;; Allow members of the "video" group to change the screen brightness.
(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\"")))
;; Mount Nitrokey
;; TODO: Check if plugdev works instead of users. If not, report to Nitrokey.
;; https://www.nitrokey.com/sites/default/files/41-nitrokey.rules
@ -78,7 +104,7 @@ StrictNodes 1")
(authorized-keys (append
%default-authorized-guix-keys
(list (local-file
(format #f "~a/.config/guix/mirror.brielmaier.net.pub" (getenv "HOME"))))))))
(format #f "~a/.config/guix/system/mirror.brielmaier.net.pub" (getenv "HOME"))))))))
(udev-service-type config =>
(udev-configuration
(inherit config)
@ -86,6 +112,46 @@ StrictNodes 1")
(list ;; %nitrokey-udev-rule
%ambrevar/cdemu-vhba-udev-rule))))))))
(define-public gnome-minimal
(package
(inherit gnome)
(name "gnome-minimal")
(propagated-inputs
;; Keep nautilus.
(fold alist-delete (package-propagated-inputs gnome)
'(;; GNOME-Core-Shell
"gnome-backgrounds"
"gnome-themes-extra"
"gnome-getting-started-docs"
"gnome-user-docs"
;; GNOME-Core-Utilities
"baobab"
"cheese"
"eog"
"epiphany"
"evince" ; TODO: Remains pulled in with gnome-default-applications.
"file-roller"
"gedit"
"gnome-boxes"
"gnome-calculator"
"gnome-calendar"
"gnome-characters"
"gnome-clocks"
"gnome-contacts"
"gnome-disk-utility"
"gnome-font-viewer"
"gnome-maps"
;; "gnome-music"
;; "gnome-photos"
"gnome-screenshot"
;; "gnome-system-monitor" ; TODO: Needed for gnome-polkit-settings: edit package to no break when gnome-system-monitor is missing.
"gnome-terminal"
"gnome-weather"
"simple-scan"
"totem"
;; Others
"gnome-online-accounts")))))
(define-public %ambrevar/packages
(cons* nss-certs ; for HTTPS access
;; gvfs ; TODO: For user mounts?

View File

@ -48,37 +48,13 @@
;; >> echo 'auto' > '/sys/bus/pci/devices/0000:02:00.0/power/control';
))
(define %mimimi/xorg-touchpad
"Section \"InputClass\"
Identifier \"Touchpads\"
Driver \"libinput\"
MatchDevicePath \"/dev/input/event*\"
MatchIsTouchpad \"on\"
Option \"DisableWhileTyping\" \"on\"
Option \"MiddleEmulation\" \"on\"
Option \"ClickMethod\" \"clickfinger\"
Option \"ScrollMethod\" \"twofinger\"
Option \"NaturalScrolling\" \"true\"
EndSection")
(define %mimimi/backlight-udev-rule
;; Allow members of the "video" group to change the screen brightness.
(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\"")))
(define %mimimi/xorg-minimal-config
(xorg-configuration
(modules (list xf86-video-vesa
xf86-video-intel
;; xf86-video-nouveau ; Make sure this is on if the 'nouveau' kernel module is loaded.
xf86-input-libinput))
(extra-config (list %mimimi/xorg-touchpad))))
(extra-config (list %ambrevar/xorg-touchpad))))
(define %mimimi/services
(cons*
@ -106,47 +82,7 @@ EndSection")
(udev-configuration
(inherit config)
(rules (append (udev-configuration-rules config)
(list %mimimi/backlight-udev-rule))))))))
(define-public gnome-minimal
(package
(inherit gnome)
(name "gnome-minimal")
(propagated-inputs
;; Keep nautilus.
(fold alist-delete (package-propagated-inputs gnome)
'(;; GNOME-Core-Shell
"gnome-backgrounds"
"gnome-themes-extra"
"gnome-getting-started-docs"
"gnome-user-docs"
;; GNOME-Core-Utilities
"baobab"
"cheese"
"eog"
"epiphany"
"evince" ; TODO: Remains pulled in with gnome-default-applications.
"file-roller"
"gedit"
"gnome-boxes"
"gnome-calculator"
"gnome-calendar"
"gnome-characters"
"gnome-clocks"
"gnome-contacts"
"gnome-disk-utility"
"gnome-font-viewer"
"gnome-maps"
;; "gnome-music"
;; "gnome-photos"
"gnome-screenshot"
;; "gnome-system-monitor" ; TODO: Needed for gnome-polkit-settings: edit package to no break when gnome-system-monitor is missing.
"gnome-terminal"
"gnome-weather"
"simple-scan"
"totem"
;; Others
"gnome-online-accounts")))))
(list %ambrevar/backlight-udev-rule))))))))
(define drive-mapping
(list (mapped-device
@ -163,47 +99,50 @@ EndSection")
(options "subvol=rootfs,compress=zstd")
(dependencies drive-mapping)))
(operating-system
(inherit %ambrevar/default-os)
(host-name "mimimi")
(define-public %ambrevar/laptop-os
(operating-system
(inherit %ambrevar/default-os)
(host-name "mimimi")
(kernel linux)
;; (kernel linux-xiaomi-air-13)
;; To disable the Nvidia, first make sure nouveau is not loaded then call
;; sudo tee /proc/acpi/bbswitch <<<OFF
;; Check the result with
;; sudo dmesg | grep bbswitch
;; It saves about 1h of battery.
;; TODO: Automate the bbswitch command when the Guix package is merged.
(kernel-arguments '("modprobe.blacklist=nouveau"))
(kernel linux)
;; (kernel linux-xiaomi-air-13)
;; To disable the Nvidia, first make sure nouveau is not loaded then call
;; sudo tee /proc/acpi/bbswitch <<<OFF
;; Check the result with
;; sudo dmesg | grep bbswitch
;; It saves about 1h of battery.
;; TODO: Automate the bbswitch command when the Guix package is merged.
(kernel-arguments '("modprobe.blacklist=nouveau"))
(mapped-devices drive-mapping)
(mapped-devices drive-mapping)
(firmware (append (list iwlwifi-firmware)
%ambrevar/firmware))
(firmware (append (list iwlwifi-firmware)
%ambrevar/firmware))
(file-systems (cons* root-partition
;; TODO: Separate boot partition (to avoid double LUKS
;; password prompt) does not work:
;; (file-system
;; (device (file-system-label "boot"))
;; (mount-point "/boot")
;; (type "ext4")
;; ;; (needed-for-boot? #t)
;; (dependencies (list root-partition))
;; )
(file-system
(device (uuid "4E30-891F" 'fat))
(mount-point "/boot/efi")
(type "vfat"))
(file-system
(mount-point "/tmp")
(device "none")
(type "tmpfs")
(check? #f))
%base-file-systems))
(file-systems (cons* root-partition
;; TODO: Separate boot partition (to avoid double LUKS
;; password prompt) does not work:
;; (file-system
;; (device (file-system-label "boot"))
;; (mount-point "/boot")
;; (type "ext4")
;; ;; (needed-for-boot? #t)
;; (dependencies (list root-partition))
;; )
(file-system
(device (uuid "4E30-891F" 'fat))
(mount-point "/boot/efi")
(type "vfat"))
(file-system
(mount-point "/tmp")
(device "none")
(type "tmpfs")
(check? #f))
%base-file-systems))
(services (cons* (service gnome-desktop-service-type
(gnome-desktop-configuration
(gnome gnome-minimal)))
%mimimi/services)))
(services (cons* (service gnome-desktop-service-type
(gnome-desktop-configuration
(gnome gnome-minimal)))
%mimimi/services))))
%ambrevar/laptop-os

View File

@ -0,0 +1,71 @@
;; With Eshell:
;; *sudo -E guix system -L ~/.config/guix/system reconfigure ~/.config/guix/system/laptop-sasasa.scm
(define-module (laptop-sasasa)
#:use-module (srfi srfi-1)
#:use-module (default)
#:use-module (nongnu packages linux)
#:use-module (gnu)
#:use-module (gnu system))
(use-service-modules
desktop ; GNOME
;; GDM:
xorg)
(use-package-modules
emacs-xyz ; For exwm config.
;; For Xorg modules:
xorg)
(define %sasasa/services
(cons*
;; TODO: How can I choose which display to focus by default? Order seems not
;; to matter.
(service slim-service-type
(slim-configuration
(display ":0")
(vt "vt7")))
(service slim-service-type
(slim-configuration
(display ":1")
(vt "vt8")
(auto-login? #f)
(default-user "ambrevar")
(auto-login-session (file-append emacs-exwm-no-x-toolkit
"/bin/exwm"))))
(modify-services
(remove (lambda (service)
(eq? (service-kind service) gdm-service-type))
%ambrevar/services)
(udev-service-type config =>
(udev-configuration
(inherit config)
(rules (append (udev-configuration-rules config)
(list %ambrevar/backlight-udev-rule))))))))
(operating-system
(inherit %ambrevar/default-os)
(host-name "sasasa")
(kernel linux)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
(timeout 1)
(target "/dev/sda")))
(file-systems (cons* (file-system
(device (file-system-label "guix"))
(mount-point "/")
(type "btrfs")
(options "subvol=rootfs,compress=zstd"))
(file-system
(mount-point "/tmp")
(device "none")
(type "tmpfs")
(check? #f))
%base-file-systems))
(services (cons* (service gnome-desktop-service-type
(gnome-desktop-configuration
(gnome gnome-minimal)))
%sasasa/services)))