2018-03-27 07:25:07 +02:00
|
|
|
;; This is an operating system configuration template
|
|
|
|
;; for a "desktop" setup without full-blown desktop
|
|
|
|
;; environments.
|
|
|
|
|
|
|
|
(use-modules (gnu)
|
|
|
|
(gnu packages linux)
|
|
|
|
(gnu packages tls)
|
|
|
|
(gnu system nss)
|
|
|
|
(guix build-system trivial)
|
|
|
|
(guix download)
|
|
|
|
(guix git-download)
|
|
|
|
(gnu services xorg)
|
2018-04-01 14:20:30 +02:00
|
|
|
(gnu services networking)
|
2018-07-20 14:48:22 +02:00
|
|
|
(gnu services cups)
|
2018-04-01 14:20:30 +02:00
|
|
|
(gnu packages admin)
|
2018-05-03 07:42:40 +02:00
|
|
|
(gnu packages xorg)
|
2018-07-20 14:48:22 +02:00
|
|
|
(guix build-system gnu)
|
|
|
|
(gnu packages pkg-config)
|
|
|
|
(gnu packages libusb)
|
|
|
|
(gnu packages gnupg)
|
|
|
|
(gnu packages cups)
|
|
|
|
(gnu packages emacs)
|
|
|
|
(gnu packages version-control)
|
2018-03-27 07:25:07 +02:00
|
|
|
((guix licenses) #:prefix license:)
|
|
|
|
(guix packages)
|
|
|
|
(srfi srfi-1))
|
|
|
|
|
|
|
|
(use-service-modules desktop)
|
2018-04-13 08:08:21 +02:00
|
|
|
(use-package-modules bootloaders certs suckless ;; xorg
|
|
|
|
)
|
2018-03-27 07:25:07 +02:00
|
|
|
|
|
|
|
(define (linux-nonfree-urls version)
|
|
|
|
"Return a list of URLs for Linux-Nonfree VERSION."
|
|
|
|
(list (string-append
|
|
|
|
"https://www.kernel.org/pub/linux/kernel/v4.x/"
|
|
|
|
"linux-" version ".tar.xz")))
|
|
|
|
|
|
|
|
(define-public linux-nonfree
|
|
|
|
(package
|
|
|
|
(inherit linux-libre)
|
|
|
|
(name "linux-nonfree")
|
2018-05-03 07:42:40 +02:00
|
|
|
(version "4.14.33")
|
2018-03-27 07:25:07 +02:00
|
|
|
(source
|
2018-04-13 08:08:38 +02:00
|
|
|
(origin
|
|
|
|
(method url-fetch)
|
2018-05-01 21:48:55 +02:00
|
|
|
(uri (linux-nonfree-urls
|
2018-05-03 07:42:40 +02:00
|
|
|
version
|
|
|
|
;; (package-version linux-libre)
|
|
|
|
))
|
2018-04-13 08:08:38 +02:00
|
|
|
(sha256
|
2018-05-01 21:48:55 +02:00
|
|
|
(base32
|
2018-05-03 07:42:40 +02:00
|
|
|
"0c88p5vly63jsz62ff7971zl6vqzzbv5q519gi8z17ld66sf5063" ; 4.14.33
|
|
|
|
;; "0jwa2r3gpn4ahy38730b7g4xzavfqwxxwgyfhpn5ssvzsc4934gs" ; 4.16.6
|
2018-04-13 08:08:38 +02:00
|
|
|
))))))
|
2018-03-27 07:25:07 +02:00
|
|
|
|
|
|
|
(define-public linux-nonfree-firmware
|
|
|
|
(let ((version "0.0.0")
|
|
|
|
(commit "6d5131107f2ba67a13f469ac770a55f101ba654d"))
|
|
|
|
(package
|
|
|
|
(name "linux-nonfree-firmware")
|
|
|
|
(version version)
|
|
|
|
(source (origin
|
|
|
|
(method git-fetch)
|
|
|
|
(uri (git-reference
|
|
|
|
(url "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git")
|
|
|
|
(commit commit)))
|
|
|
|
(sha256
|
|
|
|
(base32
|
|
|
|
"0nql7rqkx064lsw5bh6n29yfdxmp3hl4nqgp1fxdb4ys76awchg3"))))
|
|
|
|
(build-system trivial-build-system)
|
|
|
|
(arguments
|
|
|
|
`(#:modules ((guix build utils))
|
|
|
|
#:builder (begin
|
|
|
|
(use-modules (guix build utils))
|
|
|
|
(let ((source (assoc-ref %build-inputs "source"))
|
|
|
|
(destination (string-append %output "/lib/firmware")))
|
|
|
|
(mkdir-p destination)
|
|
|
|
(copy-recursively source destination #:follow-symlinks? #t)
|
|
|
|
#t))))
|
|
|
|
(home-page "")
|
|
|
|
(synopsis "Non-free firmware for the Linux kernel")
|
|
|
|
(description "Non-free firmware for the Linux kernel")
|
|
|
|
(license #f))))
|
|
|
|
|
2018-03-27 12:29:03 +02:00
|
|
|
;; Allow members of the "video" group to change the screen brightness.
|
|
|
|
(define %backlight-udev-rule
|
|
|
|
(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\"")))
|
|
|
|
|
2018-07-20 14:48:22 +02:00
|
|
|
;; 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
|
|
|
|
;; (define %nitrokey-udev-rule
|
|
|
|
;; (udev-rule
|
|
|
|
;; "41-nitrokey.rules"
|
|
|
|
;; (string-append "ACTION==\"add\", SUBSYSTEM==\"usb\", "
|
|
|
|
;; "ATTR{idVendor}==\"20a0\", ATTR{idProduct}==\"4211\", "
|
|
|
|
;; "ENV{ID_SMARTCARD_READER}=\"1\", ENV{ID_SMARTCARD_READER_DRIVER}=\"gnupg\", GROUP+=\"users\", MODE=\"0666\"")))
|
|
|
|
;; (define %nitrokey-udev-rule
|
|
|
|
;; (file->udev-rule
|
|
|
|
;; "41-nitrokey.rules"
|
|
|
|
;; (let ((version "20170910"))
|
|
|
|
;; (origin
|
|
|
|
;; (method url-fetch)
|
|
|
|
;; (uri "https://www.nitrokey.com/sites/default/files/41-nitrokey.rules")
|
|
|
|
;; (sha256
|
|
|
|
;; (base32 "127nghkfd4dl5mkf5xl1mij2ylxhkgg08nlh912xwrrjyjv4y9sa"))))))
|
|
|
|
|
2018-05-03 07:43:55 +02:00
|
|
|
(define my-xorg-modules
|
|
|
|
;; Everything but Nouveau.
|
|
|
|
(delete xf86-video-nouveau %default-xorg-modules))
|
2018-04-13 08:08:21 +02:00
|
|
|
|
2018-03-27 07:25:07 +02:00
|
|
|
;; Use the "desktop" services, which include the X11
|
|
|
|
;; log-in service, networking with Wicd, and more.
|
|
|
|
(define %my-services
|
|
|
|
(modify-services
|
2018-07-30 11:02:39 +02:00
|
|
|
%desktop-services
|
|
|
|
(guix-service-type config =>
|
|
|
|
(guix-configuration
|
|
|
|
(inherit config)
|
|
|
|
;; Don't clean build deps.
|
|
|
|
;; See (info "(guix) Invoking guix-daemon").
|
|
|
|
(extra-options '("--gc-keep-outputs"))))
|
|
|
|
(udev-service-type config =>
|
|
|
|
(udev-configuration
|
|
|
|
(inherit config)
|
|
|
|
(rules (append (udev-configuration-rules config)
|
|
|
|
(list ;; %nitrokey-udev-rule
|
|
|
|
%backlight-udev-rule)))))
|
|
|
|
(slim-service-type config =>
|
|
|
|
(slim-configuration
|
|
|
|
(inherit config)
|
|
|
|
(auto-login? #f)
|
|
|
|
(startx (xorg-start-command #:modules my-xorg-modules))
|
|
|
|
;; TODO: Can't slim pre-fill the username?
|
|
|
|
(default-user "ambrevar")))))
|
2018-03-27 07:25:07 +02:00
|
|
|
|
|
|
|
(operating-system
|
|
|
|
(host-name "mimimi")
|
2018-05-01 21:48:55 +02:00
|
|
|
(timezone "Europe/Paris")
|
2018-03-27 07:25:07 +02:00
|
|
|
(locale "en_US.utf8")
|
|
|
|
|
|
|
|
;; Use the UEFI variant of GRUB with the EFI System
|
|
|
|
;; Partition mounted on /boot/efi.
|
|
|
|
(bootloader (bootloader-configuration
|
|
|
|
(bootloader grub-efi-bootloader)
|
2018-03-27 12:00:56 +02:00
|
|
|
(timeout 1)
|
2018-03-27 07:25:07 +02:00
|
|
|
(target "/boot/efi")))
|
2018-07-20 14:48:22 +02:00
|
|
|
;; If generating an image to a USB stick, use -bios- instead.
|
|
|
|
;; (bootloader (bootloader-configuration
|
|
|
|
;; (bootloader grub-bootloader)
|
|
|
|
;; (target "/dev/sda")))
|
2018-03-27 07:25:07 +02:00
|
|
|
|
|
|
|
(kernel linux-nonfree)
|
2018-05-03 07:43:55 +02:00
|
|
|
;; (kernel-arguments '("modprobe.blacklist=pcspkr"))
|
2018-04-13 08:08:21 +02:00
|
|
|
;; (kernel-arguments '("modprobe.blacklist=nouveau"))
|
|
|
|
;; (kernel-arguments '("pcie_port_pm=off"))
|
2018-03-27 07:25:07 +02:00
|
|
|
(firmware (cons* linux-nonfree-firmware %base-firmware))
|
|
|
|
|
|
|
|
(initrd-modules (append (list "shpchp")
|
|
|
|
%base-initrd-modules))
|
|
|
|
|
|
|
|
;; Assume the target root file system is labelled "guixsd",
|
|
|
|
;; and the EFI System Partition is specified by its UUID.
|
|
|
|
(file-systems (cons* (file-system
|
2018-07-20 14:48:22 +02:00
|
|
|
(device (file-system-label "guixsd"))
|
|
|
|
(mount-point "/")
|
2018-03-27 07:25:07 +02:00
|
|
|
(type "ext4"))
|
|
|
|
(file-system
|
2018-07-20 14:48:22 +02:00
|
|
|
(device (file-system-label "home"))
|
|
|
|
(mount-point "/home")
|
2018-03-27 07:25:07 +02:00
|
|
|
(type "ext4"))
|
|
|
|
(file-system
|
|
|
|
(device (uuid "8AC2-4252" 'fat))
|
|
|
|
(mount-point "/boot/efi")
|
|
|
|
(type "vfat"))
|
2018-05-18 11:26:40 +02:00
|
|
|
(file-system
|
|
|
|
(mount-point "/tmp")
|
|
|
|
(device "none")
|
|
|
|
(type "tmpfs")
|
|
|
|
(check? #f))
|
2018-03-27 07:25:07 +02:00
|
|
|
%base-file-systems))
|
|
|
|
|
2018-07-20 14:48:22 +02:00
|
|
|
;; (groups (cons* (user-group
|
|
|
|
;; (name "plugdev")
|
|
|
|
;; (system? #t))
|
|
|
|
;; %base-groups))
|
2018-03-27 07:25:07 +02:00
|
|
|
(users (cons* (user-account
|
|
|
|
(name "ambrevar")
|
|
|
|
(group "users")
|
|
|
|
(supplementary-groups '("wheel" "netdev" ; netdev is needed for networking.
|
2018-07-20 14:48:22 +02:00
|
|
|
;; "plugdev" ; nitrokey?
|
2018-06-19 18:55:58 +02:00
|
|
|
;; "audio"
|
|
|
|
"lp" ; for bluetooth
|
|
|
|
"video"))
|
2018-03-27 07:25:07 +02:00
|
|
|
(home-directory "/home/ambrevar"))
|
|
|
|
%base-user-accounts))
|
|
|
|
|
2018-03-27 08:47:54 +02:00
|
|
|
(packages (cons* nss-certs ;for HTTPS access
|
2018-06-01 10:55:18 +02:00
|
|
|
ntfs-3g
|
2018-07-20 14:48:22 +02:00
|
|
|
;; emacs
|
|
|
|
;; git
|
|
|
|
;; gnupg
|
2018-03-27 07:25:07 +02:00
|
|
|
%base-packages))
|
|
|
|
|
2018-04-24 12:51:27 +02:00
|
|
|
(services (cons*
|
|
|
|
;; 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';
|
|
|
|
;; )
|
2018-06-19 18:55:58 +02:00
|
|
|
(bluetooth-service)
|
2018-07-20 14:48:22 +02:00
|
|
|
(service cups-service-type
|
|
|
|
(cups-configuration
|
|
|
|
(web-interface? #t)
|
|
|
|
(extensions
|
2018-07-23 15:23:21 +02:00
|
|
|
(list cups-filters escpr hplip))))
|
|
|
|
(tor-service)
|
2018-04-24 12:51:27 +02:00
|
|
|
%my-services))
|
2018-03-27 07:25:07 +02:00
|
|
|
|
|
|
|
;; Allow resolution of '.local' host names with mDNS.
|
|
|
|
(name-service-switch %mdns-host-lookup-nss))
|