Skip to content

Instantly share code, notes, and snippets.

@jespada
Created January 21, 2023 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jespada/87284be94404e2001be4799f0c4e2a82 to your computer and use it in GitHub Desktop.
Save jespada/87284be94404e2001be4799f0c4e2a82 to your computer and use it in GitHub Desktop.
guix config basic
;; This is an operating system configuration generated
;; by the graphical installer.
;;
;; Once installation is complete, you can learn and modify
;; this file to tweak the system configuration, and pass it
;; to the 'guix system reconfigure' command to effect your
;; changes.
;; Indicate which modules to import to access the variables
;; used in this configuration.
(use-modules
(gnu)
;;(gnu packages)
(gnu system setuid)
(srfi srfi-1)
(nongnu packages linux)
(nongnu packages firmware)
(nongnu system linux-initrd))
(use-package-modules
admin
android
certs
compression
cups
curl
display-managers
emacs
emacs-xyz
file
fonts
gnome
gnupg
linux
package-management
password-utils
security-token
shells
version-control
vim
virtualization
wget
wm
)
(use-service-modules
authentication
cups
desktop
docker
linux
networking
nix
pm
;; sddm
security-token
ssh
syncthing
virtualization
xorg
)
(operating-system
(locale "en_GB.utf8")
(timezone "Europe/London")
(keyboard-layout (keyboard-layout "us"))
(host-name "bia")
(kernel linux)
(kernel-arguments '("mem_sleep_default=deep nvme.noacpi=1 i915.enable_psr=1 modprobe.blacklist=hid_sensor_hub"))
;;(kernel-arguments '("acpi_backlight=video thinkpad_acpi.debug=0xffff pcie_aspm=force i915.enable_rc6=1 i915.enable_fbc=1"))
;;(kernel-arguments '("acpi_backlight=video thinkpad_acpi.debug=0xffff pcie_aspm=force"))
;; (initrd microcode-initrd)
;; (firmware (cons* iwlwifi-firmware
;; %base-firmware))
(firmware
(list linux-firmware))
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
(targets (list "/boot/efi"))
(keyboard-layout keyboard-layout)))
(mapped-devices (list (mapped-device
(source (uuid
"292c9c86-ee16-4a9d-bdc7-4cccbfd58089"))
(target "cryptroot")
(type luks-device-mapping))))
;; The list of file systems that get "mounted". The unique
;; file system identifiers there ("UUIDs") can be obtained
;; by running 'blkid' in a terminal.
(file-systems (cons* (file-system
(mount-point "/boot/efi")
(device (uuid "F2DF-2C55"
'fat32))
(type "vfat"))
(file-system
(mount-point "/")
(device "/dev/mapper/cryptroot")
(type "ext4")
(dependencies mapped-devices)) %base-file-systems))
;; Groups
;; plugdev group, udev support for hardware key
(groups (cons
(user-group
(name "plugdev")
(system? #t))
%base-groups))
;; Users
(users (cons* (user-account
(name "jespada")
(comment "Jorge Espada")
(group "users")
(home-directory "/home/jespada")
(supplementary-groups
'("wheel" "netdev" "audio" "video" ; base groups from docs
"lp" ; for printing
"dialout" ; access to serial devices
"plugdev" ; hardware security keys
"libvirt" ; administer VMs
"kvm" ; access hardware virtualization features
"docker" ; run containers without being root
"adbusers" ; interact with android devices
))
(shell #~(string-append #$zsh "/bin/zsh"))
)
%base-user-accounts))
(packages (append (list
;; Desktop environment
sway light
;;guix-simplyblack-sddm-theme
;; HTTPS access
nss-certs
;; for user mounts
gvfs
;; nix offers some missing packages in guix
nix
;; others, maybe add them in machine specific manifest
dconf
dmidecode
emacs
emacs-guix
file
font-fira-code
font-awesome
font-ibm-plex
fwupd-nonfree
git
gnome-tweaks
gnupg
gsettings-desktop-schemas
inetutils
vim
nss-certs
pfetch
pinentry
unzip
zip
zsh
)
%base-packages))
(setuid-programs (append (list
(setuid-program (program (file-append light "/bin/light")))
(setuid-program (program (file-append swaylock "/bin/swaylock"))))
%setuid-programs))
;; SDDM, Gnome, Bluetooth, Printing
(services (append (list
;; SDDM
;; (service sddm-service-type
;; (sddm-configuration
;; (display-server "wayland")
;; (session-command (local-file
;; "./wayland-session"
;; #:recursive? #t))
;; (theme "guix-simplyblack-sddm")))
;; Bluetooth
(bluetooth-service #:auto-enable? #t)
;; Gnome and its keyring
(service gnome-desktop-service-type)
(service gnome-keyring-service-type)
;; ;; fingerprint
;; (service fprintd-service-type)
;; hardware key
(service pcscd-service-type)
(service syncthing-service-type
(syncthing-configuration
(user "jespada")))
;; Printing
(service cups-service-type)
;; Power management
;;(service tlp-service-type)
;; Make scripts with /usr/bin/env work
(extra-special-file "/usr/bin/env"
(file-append coreutils "/bin/env"))
;; Have qemu around to build packages for other
;; architectures
(service qemu-binfmt-service-type
(qemu-binfmt-configuration
(platforms (lookup-qemu-platforms "arm" "aarch64" "mips64el"))))
;; Docker
(service docker-service-type)
;; Kill memory hogs early, before the system starts looking
;; for swap
(service earlyoom-service-type)
;; nix build daemon
(service nix-service-type)
;;(shepherd-service
;; (documentation "Configure dconf for Wayland.")
;; (requirement '(user-processes))
;; (one-shot #t)
;; (start #~(if [ -z "$(dconf read /org/gnome/mutter/experimental-features)" ]; then dconf write /org/gnome/mutter/experimental-features "['scale-monitor-framebuffer']"; fi)))
;; libvirt for VMs
(service libvirt-service-type
(libvirt-configuration
(unix-sock-group "libvirt")
(listen-tls? #f)
(listen-tcp? #f)
(min-workers 1)))
(service virtlog-service-type
(virtlog-configuration))
;; acpi_call kernel module for battery control
(service kernel-module-loader-service-type
'("acpi_call"))
;; allow members of adbusers to interact with android
;; devices without root permissions
(udev-rules-service 'android android-udev-rules
#:groups '("adbusers")))
(modify-services
%desktop-services
;; ;; No need for GDM
;; (remove (lambda (service)
;; (member (service-kind service)
;; (list gdm-service-type modem-manager-service-type)))
;; %desktop-services)
;; Use substitutes:
;; Enable substitute for nonguix - should help with large packages, i.e. linux, firefox
;; - nonguix provided by https://substitutes.nonguix.org/
;; - guix-science provided by https://substitutes.guix.psychnotebook.org/
(guix-service-type
config =>
(guix-configuration
(inherit config)
(substitute-urls
(append
%default-substitute-urls
(list "https://substitutes.nonguix.org"
"https://substitutes.guix.psychnotebook.org"
)))
(authorized-keys
(append
%default-authorized-guix-keys
(list
(plain-file "substitutes.nonguix.org.pub" "
(public-key
(ecc
(curve Ed25519)
(q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#)
)
)")
(plain-file "substitutes.guix.psychnotebook.org.pub" "
(public-key
(ecc
(curve Ed25519)
(q #D4E1CAFAB105581122B326E89804E3546EF905C0D9B39F161BBD8ABB4B11D14A#)
)
)")
)))))
;; enable wayland for gdm, gnome
(gdm-service-type config =>
(gdm-configuration
(inherit config)
(wayland? #t)))
;; ;; hardware key support
;; (udev-service-type config =>
;; (udev-configuration
;; (inherit config)
;; (rules (cons libu2f-host
;; (udev-configuration-rules config)))))
)))
;; Be able to load the acpi_call kernel module
(kernel-loadable-modules (list acpi-call-linux-module))
;; Allow resolution of '.local' host names with mDNS.
(name-service-switch %mdns-host-lookup-nss))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment