2019-01-18 15:28:13 +01:00
|
|
|
;; 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)
|
2020-06-09 14:33:55 +02:00
|
|
|
#:use-module (srfi srfi-1)
|
2019-06-06 11:47:41 +02:00
|
|
|
#:use-module (default)
|
2019-06-15 11:19:21 +02:00
|
|
|
#:use-module (nongnu packages linux)
|
2019-05-18 10:53:24 +02:00
|
|
|
#:use-module ((guix licenses) #:prefix license:)
|
2020-03-18 09:14:21 +01:00
|
|
|
#:use-module (gnu)
|
2019-05-18 10:53:24 +02:00
|
|
|
#: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:)
|
2020-03-11 13:22:16 +01:00
|
|
|
#:use-module (guix packages))
|
|
|
|
|
|
|
|
(use-service-modules
|
|
|
|
desktop ; GNOME
|
2020-06-08 19:33:16 +02:00
|
|
|
;; GDM:
|
2020-03-22 16:31:58 +01:00
|
|
|
xorg)
|
2020-03-11 13:22:16 +01:00
|
|
|
|
|
|
|
(use-package-modules
|
2020-12-18 17:03:23 +01:00
|
|
|
emacs-xyz ; For exwm config.
|
2020-06-09 14:33:55 +02:00
|
|
|
gnome ; gnome-minimal
|
2020-03-18 09:14:21 +01:00
|
|
|
linux ; For custom kernel.
|
2020-06-08 19:33:16 +02:00
|
|
|
;; For Xorg modules:
|
2020-03-11 13:22:16 +01:00
|
|
|
xorg)
|
2019-01-18 15:28:13 +01:00
|
|
|
|
2019-05-18 10:53:24 +02:00
|
|
|
(define linux-xiaomi-air-13
|
|
|
|
(package
|
2020-06-08 19:33:16 +02:00
|
|
|
(inherit linux)
|
2019-05-18 10:53:24 +02:00
|
|
|
(name "linux-xiaomi-air-13")
|
|
|
|
;; To build a custom kernel, pass it an alternate "kconfig":
|
2020-06-08 19:33:16 +02:00
|
|
|
(native-inputs
|
|
|
|
`(("kconfig" ,(local-file "./linux-laptop.conf"))
|
|
|
|
,@(alist-delete "kconfig" (package-native-inputs linux-libre))))))
|
2019-10-21 19:05:32 +02:00
|
|
|
|
|
|
|
(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';
|
|
|
|
))
|
|
|
|
|
2020-12-18 17:03:23 +01:00
|
|
|
(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))
|
2020-12-20 12:11:44 +01:00
|
|
|
(extra-config (list %ambrevar/xorg-touchpad))))
|
2020-12-18 17:03:23 +01:00
|
|
|
|
2019-10-21 19:05:32 +02:00
|
|
|
(define %mimimi/services
|
|
|
|
(cons*
|
2020-12-18 17:03:23 +01:00
|
|
|
;; TODO: How can I choose which display to focus by default? Order seems not
|
|
|
|
;; to matter.
|
2020-12-18 13:55:38 +01:00
|
|
|
(service slim-service-type
|
|
|
|
(slim-configuration
|
|
|
|
(display ":0")
|
|
|
|
(vt "vt7")
|
2020-12-18 17:03:23 +01:00
|
|
|
(xorg-configuration %mimimi/xorg-minimal-config)))
|
|
|
|
(service slim-service-type
|
|
|
|
(slim-configuration
|
|
|
|
(display ":1")
|
|
|
|
(vt "vt8")
|
2020-12-18 17:06:35 +01:00
|
|
|
(auto-login? #t)
|
2020-12-18 17:03:23 +01:00
|
|
|
(default-user "ambrevar")
|
|
|
|
(auto-login-session (file-append emacs-exwm-no-x-toolkit
|
|
|
|
"/bin/exwm"))
|
|
|
|
(xorg-configuration %mimimi/xorg-minimal-config)))
|
2019-10-21 19:05:32 +02:00
|
|
|
(modify-services
|
2020-12-18 13:55:38 +01:00
|
|
|
(remove (lambda (service)
|
|
|
|
(eq? (service-kind service) gdm-service-type))
|
|
|
|
%ambrevar/services)
|
2019-10-21 19:05:32 +02:00
|
|
|
(udev-service-type config =>
|
|
|
|
(udev-configuration
|
|
|
|
(inherit config)
|
|
|
|
(rules (append (udev-configuration-rules config)
|
2020-12-20 12:11:44 +01:00
|
|
|
(list %ambrevar/backlight-udev-rule))))))))
|
2020-06-09 14:33:55 +02:00
|
|
|
|
2020-06-10 08:22:02 +02:00
|
|
|
(define drive-mapping
|
|
|
|
(list (mapped-device
|
|
|
|
;; The UUID is that returned by 'cryptsetup luksUUID'.
|
|
|
|
(source (uuid "17d4df8c-04dc-43aa-b017-f69cd3bc5a7d"))
|
|
|
|
(target "guix")
|
|
|
|
(type luks-device-mapping))))
|
|
|
|
|
|
|
|
(define root-partition
|
|
|
|
(file-system
|
|
|
|
(device (file-system-label "guix"))
|
|
|
|
(mount-point "/")
|
|
|
|
(type "btrfs")
|
|
|
|
(options "subvol=rootfs,compress=zstd")
|
|
|
|
(dependencies drive-mapping)))
|
|
|
|
|
2020-12-20 12:11:44 +01:00
|
|
|
(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"))
|
|
|
|
|
|
|
|
(mapped-devices drive-mapping)
|
|
|
|
|
|
|
|
(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))
|
|
|
|
|
|
|
|
(services (cons* (service gnome-desktop-service-type
|
|
|
|
(gnome-desktop-configuration
|
|
|
|
(gnome gnome-minimal)))
|
|
|
|
%mimimi/services))))
|
|
|
|
|
|
|
|
%ambrevar/laptop-os
|