default.scm 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. ;; To collect the size of a system:
  2. ;; guix size $(guix system -L ~/.config/guix/system build ~/.config/guix/system/default.scm)
  3. (define-module (default)
  4. #:use-module (srfi srfi-1)
  5. #:use-module (gnu)
  6. #:use-module (gnu system nss)
  7. #:use-module (gnu system mapped-devices))
  8. (use-service-modules
  9. desktop
  10. ;; For tor
  11. networking)
  12. (use-package-modules
  13. certs ; nss-certs
  14. linux ; ntfs-3g
  15. mtools ; exfat
  16. nano ; To remove nano.
  17. emacs ; For emacs-no-x-toolkit
  18. emacs-xyz ; EXWM
  19. xorg ; For emacs-no-x-toolkit
  20. ;; To remove zile:
  21. zile)
  22. (define %ambrevar/cdemu-vhba-udev-rule
  23. ;; For the "uaccess" tag to be applied properly, the rule must be executed
  24. ;; before the uaccess rule
  25. ;; (/run/current-system/profile/lib/udev/rules.d/70-uaccess.rules).
  26. (udev-rule
  27. "69-cdemu-vhba.rules"
  28. (string-append "KERNEL==\"vhba_ctl\", SUBSYSTEM==\"misc\", TAG+=\"uaccess\"")))
  29. ;; Mount Nitrokey
  30. ;; TODO: Check if plugdev works instead of users. If not, report to Nitrokey.
  31. ;; https://www.nitrokey.com/sites/default/files/41-nitrokey.rules
  32. (define %nitrokey-udev-rule
  33. (udev-rule
  34. "41-nitrokey.rules"
  35. (string-append "ACTION==\"add\", SUBSYSTEM==\"usb\", "
  36. "ATTR{idVendor}==\"20a0\", ATTR{idProduct}==\"4211\", "
  37. "ENV{ID_SMARTCARD_READER}=\"1\", ENV{ID_SMARTCARD_READER_DRIVER}=\"gnupg\", GROUP+=\"users\", MODE=\"0666\"")))
  38. ;; (define %nitrokey-udev-rule
  39. ;; (file->udev-rule
  40. ;; "41-nitrokey.rules"
  41. ;; (let ((version "20170910"))
  42. ;; (origin
  43. ;; (method url-fetch)
  44. ;; (uri "https://www.nitrokey.com/sites/default/files/41-nitrokey.rules")
  45. ;; (sha256
  46. ;; (base32 "127nghkfd4dl5mkf5xl1mij2ylxhkgg08nlh912xwrrjyjv4y9sa"))))))
  47. (define-public %ambrevar/tor-config
  48. "ExitNodes {se},{nl},{fr},{ee},{no},{dk},{fi}
  49. StrictNodes 1")
  50. (define-public %ambrevar/services
  51. (cons*
  52. (service tor-service-type
  53. (tor-configuration
  54. (config-file (plain-file "tor.conf" %ambrevar/tor-config))))
  55. ;; Use the "desktop" services, which include the X11 log-in service, networking
  56. ;; with Wicd, and more.
  57. (modify-services
  58. %desktop-services
  59. (guix-service-type config =>
  60. (guix-configuration
  61. (inherit config)
  62. ;; Don't clean build deps.
  63. ;; See (info "(guix) Invoking guix-daemon").
  64. ;; WARNING: This tends to yield an ever-growing store.
  65. ;; (extra-options '("--gc-keep-outputs"))
  66. (substitute-urls (append
  67. (@@ (guix scripts substitute) %default-substitute-urls)
  68. ;; TODO: Does not work?
  69. ;; Nonguix:
  70. (list "https://mirror.brielmaier.net")))
  71. (authorized-keys (append
  72. %default-authorized-guix-keys
  73. (list (local-file
  74. (format #f "~a/.config/guix/mirror.brielmaier.net.pub" (getenv "HOME"))))))))
  75. (udev-service-type config =>
  76. (udev-configuration
  77. (inherit config)
  78. (rules (append (udev-configuration-rules config)
  79. (list ;; %nitrokey-udev-rule
  80. %ambrevar/cdemu-vhba-udev-rule))))))))
  81. (define-public %ambrevar/packages
  82. (cons* nss-certs ; for HTTPS access
  83. ;; gvfs ; TODO: For user mounts?
  84. ntfs-3g
  85. ;; exfat-utils ; TODO: Needed for macOS drives? Does not seem to work.
  86. fuse-exfat
  87. emacs-exwm-no-x-toolkit ; Still needs emacs-exwm / emacs-exwm-no-x-toolkit installed in a user profile.
  88. vhba-module ; For CDEmu.
  89. (fold (lambda (package l) (delete package l))
  90. %base-packages
  91. (list nano zile
  92. ;; wireless-tools is deprecated in favour of iw.
  93. wireless-tools))))
  94. (define-public %ambrevar/firmware
  95. %base-firmware)
  96. (define-public %ambrevar/user
  97. (user-account
  98. (name "ambrevar")
  99. (group "users")
  100. (supplementary-groups '("wheel" "netdev" ; netdev is needed for networking.
  101. "kvm" ; For QEMU (and maybe libvirt)
  102. ;; "plugdev" ; TODO: Needed for nitrokey?
  103. "lp" ; TODO: Needed for bluetooth?
  104. "video"))
  105. ;; TODO: Can we default to name?
  106. (home-directory "/home/ambrevar")))
  107. (define-public %ambrevar/default-os
  108. (operating-system
  109. (host-name "ambrevar-system")
  110. (timezone "Europe/Paris")
  111. (locale "en_US.utf8")
  112. ;; Use the UEFI variant of GRUB with the EFI System
  113. ;; Partition mounted on /boot/efi.
  114. (bootloader (bootloader-configuration
  115. (bootloader grub-efi-bootloader)
  116. (timeout 1)
  117. (target "/boot/efi")))
  118. (firmware %ambrevar/firmware)
  119. ;; TODO: Remove all virtio modules?
  120. ;; (initrd-modules (delete "virtio-rng" %base-initrd-modules))
  121. (file-systems (cons*
  122. (file-system
  123. (device (file-system-label "guix"))
  124. (mount-point "/")
  125. (type "ext4"))
  126. %base-file-systems))
  127. (users (cons* %ambrevar/user
  128. %base-user-accounts))
  129. (packages %ambrevar/packages)
  130. (services %ambrevar/services)
  131. ;; Allow resolution of '.local' host names with mDNS.
  132. (name-service-switch %mdns-host-lookup-nss)))
  133. %ambrevar/default-os