144 lines
5.3 KiB
Scheme
144 lines
5.3 KiB
Scheme
;; With Eshell:
|
|
;; *sudo -E guix system -L ~/.config/guix/system reconfigure ~/.config/guix/system/laptop-mimimi.scm
|
|
(define-module (laptop-mimimi)
|
|
#:use-module (default)
|
|
#:use-module (nongnu packages linux)
|
|
#:use-module ((guix licenses) #:prefix license:)
|
|
#:use-module (gnu bootloader grub)
|
|
#:use-module (gnu bootloader)
|
|
#:use-module (gnu packages linux)
|
|
#:use-module (gnu system mapped-devices)
|
|
#:use-module (gnu system file-systems)
|
|
#:use-module (gnu system)
|
|
#:use-module (guix build-system trivial)
|
|
#:use-module (guix download)
|
|
#:use-module (guix gexp)
|
|
#:use-module (guix git-download)
|
|
#:use-module (guix packages)
|
|
#:use-module (guix utils)
|
|
#:use-module (srfi srfi-1)
|
|
#:use-module (gnu services)
|
|
#:use-module (gnu services base)
|
|
#:use-module (gnu services xorg)
|
|
#:use-module (gnu packages xorg))
|
|
|
|
(define linux-xiaomi-air-13
|
|
(package
|
|
(inherit linux-libre)
|
|
(name "linux-xiaomi-air-13")
|
|
;; (version "5.1.1")
|
|
;; To follow linux-libre version, we can use the following, but this will
|
|
;; break if we don't immediately update the checksum.
|
|
(version (package-version linux-libre))
|
|
(source
|
|
(origin
|
|
(method url-fetch)
|
|
(uri
|
|
(string-append
|
|
"https://www.kernel.org/pub/linux/kernel/v"
|
|
(version-major version)
|
|
".x/linux-" version ".tar.xz"))
|
|
(sha256
|
|
(base32
|
|
"00j8sdrmmppqf38vl50a4zas5gy7yv37n43b61f8472k45773jf6"))))
|
|
(home-page "https://www.kernel.org/")
|
|
(synopsis "Vanilla Linux kernel")
|
|
(description "Vanilla Linux kernel which allows for non-free kernel modules / firmware.")
|
|
;; 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-modules
|
|
;; Everything but Nouveau.
|
|
(delete xf86-video-nouveau %default-xorg-modules))
|
|
|
|
(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 %mimimi/xorg-modules)
|
|
(extra-config (list %mimimi/xorg-touchpad)))))))))
|
|
|
|
(operating-system
|
|
(inherit default-operating-system)
|
|
(host-name "mimimi")
|
|
(kernel linux-xiaomi-air-13)
|
|
|
|
;; 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))))
|
|
|
|
(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 %mimimi/services))
|