ambevar-dotfiles/.config/guix/system/laptop-mimimi.scm

174 lines
6.1 KiB
Scheme
Raw Normal View History

;; With Eshell:
2019-06-06 11:47:41 +02:00
;; *sudo -E guix system -L ~/.config/guix/system reconfigure ~/.config/guix/system/laptop-mimimi.scm
(define-module (laptop-mimimi)
#:use-module (srfi srfi-1)
2019-06-06 11:47:41 +02:00
#:use-module (default)
#:use-module (nongnu packages linux)
#:use-module ((guix licenses) #:prefix license:)
2020-03-18 09:14:21 +01:00
#:use-module (gnu)
#:use-module (gnu system)
2020-03-18 09:14:21 +01:00
#:use-module (gnu services)
#:use-module (guix download) ; For linux-xiaomi-air-13
#:use-module ((guix utils) :prefix guix-utils:)
#:use-module (guix packages))
(use-service-modules
desktop ; GNOME
;; GDM:
xorg)
(use-package-modules
gnome ; gnome-minimal
2020-03-18 09:14:21 +01:00
linux ; For custom kernel.
;; For Xorg modules:
xorg)
(define linux-xiaomi-air-13
(package
(inherit linux)
(name "linux-xiaomi-air-13")
;; To build a custom kernel, pass it an alternate "kconfig":
(native-inputs
`(("kconfig" ,(local-file "./linux-laptop.conf"))
,@(alist-delete "kconfig" (package-native-inputs linux-libre))))))
(define %mimimi/power-tweaks
;; TODO: The following service starts too soon and results in a kernel panic
;; because /sys/... is not found.
(simple-service
'my-/sys-tweaks activation-service-type
;; >> echo '1' > '/sys/module/snd_hda_intel/parameters/power_save';
#~(call-with-output-file "/sys/module/snd_hda_intel/parameters/power_save"
(lambda (port)
(display "1" port)))
;; >> echo 'auto' > '/sys/bus/usb/devices/1-6/power/control';
;; >> echo 'auto' > '/sys/bus/usb/devices/1-7/power/control';
;; >> echo 'auto' > '/sys/bus/i2c/devices/i2c-2/device/power/control';
;; >> 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/services
(cons*
;; %ambrevar/power-tweaks
(modify-services
%ambrevar/services
(udev-service-type config =>
(udev-configuration
(inherit config)
(rules (append (udev-configuration-rules config)
(list %mimimi/backlight-udev-rule)))))
(gdm-service-type config =>
(gdm-configuration
(inherit config)
(default-user "ambrevar")
;; (auto-login? #t)
(xorg-configuration
(xorg-configuration
(modules (list xf86-video-vesa
xf86-video-fbdev
xf86-video-intel
;; xf86-video-nouveau
))
(extra-config (list %mimimi/xorg-touchpad)))))))))
(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" ; REVIEW: Keep for 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" ; Needed for gnome-polkit-settings
"gnome-terminal"
"gnome-weather"
"simple-scan"
"totem"
;; Others
"gnome-online-accounts")))))
(operating-system
(inherit %ambrevar/default-os)
(host-name "mimimi")
(kernel linux)
;; The UUID is that returned by 'cryptsetup luksUUID'.
(mapped-devices
(list (mapped-device
(source (uuid "b29cb68b-b154-4228-a131-34e9c474b0bd"))
(target "guix")
(type luks-device-mapping))))
(firmware (append (list iwlwifi-firmware)
%ambrevar/firmware))
(file-systems (cons* (file-system
(device (file-system-label "guix"))
(mount-point "/")
(type "ext4")
(dependencies mapped-devices))
(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)))