os-main.scm 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. (use-modules
  2. (srfi srfi-1)
  3. (gnu)
  4. (gnu system locale)
  5. (gnu services networking)
  6. (gnu services dbus)
  7. (gnu services desktop)
  8. (gnu services ssh)
  9. (gnu packages base) ; for 'canonical-package'
  10. (al places)
  11. (al files)
  12. (al utils)
  13. (al guix packages)
  14. (al guix services linux)
  15. (al guix utils))
  16. (define %user-name "al")
  17. (define %group-name "users")
  18. (define %host-name "leviafan")
  19. (define %extra-linux-modules
  20. '("fuse" ; for sshfs
  21. "nbd" ; to mount qcow2 images
  22. "sata_nv" ; for my HDD to be recognized
  23. "snd-seq" ; for MIDI-keyboard
  24. ))
  25. (define %redundant-linux-modules
  26. '("pcspkr" "snd_pcsp"))
  27. (define %redundant-packages
  28. '("info-reader"
  29. "iw"
  30. "nano"
  31. "net-tools"
  32. "wireless-tools"
  33. "zile"))
  34. (define fake-installer
  35. #~(lambda _ #t))
  36. (define* (fake-configuration-file #:rest _)
  37. (define builder
  38. #~(call-with-output-file #$output
  39. (lambda (port)
  40. (format port "# This file is generated by my 'os-main.scm'."))))
  41. (computed-file "fake.cfg" builder
  42. #:options '(#:local-build? #t
  43. #:substitutable? #f)))
  44. (define os
  45. (operating-system
  46. ;; (locale-libcs
  47. ;; (cons (guix-package base glibc-2.23)
  48. ;; %default-locale-libcs))
  49. (host-name %host-name)
  50. (timezone "Europe/Moscow")
  51. (locale "en_US.utf8")
  52. (locale-definitions
  53. (list (locale-definition (source "en_US")
  54. (name "en_US.utf8"))
  55. (locale-definition (source "de_DE")
  56. (name "de_DE.utf8"))
  57. (locale-definition (source "ru_RU")
  58. (name "ru_RU.utf8"))))
  59. (bootloader
  60. ;; Since I always use "guix system build --no-bootloader", I don't
  61. ;; want to build grub, its configuration file, etc. but guix wants
  62. ;; to do it anyway (it is done by 'perform-action' procedure in
  63. ;; (guix scripts system) module). So here, I insist on avoiding
  64. ;; any bootloader.
  65. (bootloader-configuration
  66. (bootloader (bootloader
  67. (name 'fake-bootloader)
  68. (package (my-package misc empty-package))
  69. (installer fake-installer)
  70. (disk-image-installer fake-installer)
  71. (configuration-file "fake")
  72. (configuration-file-generator fake-configuration-file)))
  73. (target "/dev/sda")))
  74. (kernel-arguments
  75. (list (string-append "modprobe.blacklist="
  76. (apply comma-separated
  77. %redundant-linux-modules))))
  78. (initrd-modules (append %extra-linux-modules %base-initrd-modules))
  79. (file-systems
  80. (cons* (file-system
  81. (device (file-system-label "guix"))
  82. (type "ext4")
  83. (mount-point "/"))
  84. (file-system
  85. (device (file-system-label "storage"))
  86. (type "ext4")
  87. (mount-point "/mnt/storage")
  88. (create-mount-point? #t)
  89. (check? #f))
  90. (file-system
  91. (device (file-system-label "arch"))
  92. (type "ext4")
  93. (mount-point "/mnt/arch")
  94. (create-mount-point? #t)
  95. (check? #f))
  96. (file-system
  97. (device (file-system-label "boot"))
  98. (type "ext4")
  99. (mount-point "/mnt/boot")
  100. (create-mount-point? #t)
  101. (check? #f))
  102. (file-system
  103. (device "/dev/sr0")
  104. (type "iso9660")
  105. (mount-point "/mnt/cdrom")
  106. (mount? #f)
  107. (create-mount-point? #t)
  108. (check? #f)
  109. (options (comma-separated "ro" "user" "noauto")))
  110. (file-system
  111. (device (file-system-label "teXet"))
  112. (type "vfat")
  113. (mount-point "/mnt/texet")
  114. (mount? #f)
  115. (create-mount-point? #t)
  116. (check? #f)
  117. (options (comma-separated
  118. "rw" "user" "noauto" "utf8" "umask=0002"
  119. (string-append "gid=" %group-name))))
  120. %base-file-systems))
  121. (users
  122. (cons* (user-account
  123. (name %user-name)
  124. (uid 1000)
  125. (comment "Alex Kost")
  126. (home-directory (string-append "/home/" %user-name))
  127. (group %group-name)
  128. (supplementary-groups
  129. ;; "input" and "tty" are needed to start X server without
  130. ;; root permissions: "input" - to access "/dev/input"
  131. ;; devices, "tty" - to access "/dev/ttyN".
  132. '("wheel" "kvm" "audio" "video" "input" "tty" "lp" "cdrom")))
  133. %base-user-accounts))
  134. (groups
  135. ;; Use ID 100 for "users" group. Actually, this wouldn't change ID
  136. ;; of an existing group, because the following command (called by
  137. ;; 'add-group' in (gnu build activation) module):
  138. ;;
  139. ;; groupadd -g 100 --system users
  140. ;;
  141. ;; fails telling: "group 'users' already exists".
  142. (replace (lambda (group)
  143. (string=? "users" (user-group-name group)))
  144. (user-group (name "users")
  145. (id 100)
  146. (system? #t))
  147. %base-groups))
  148. (sudoers-file (local-file (config-file "etc/sudoers")))
  149. (hosts-file (local-file (config-file "etc/hosts")))
  150. (issue "Guix is Great! Ave Guix!! Ave!!!\n\n")
  151. (packages
  152. (append (specifications->packages
  153. "nss-certs" "iptables")
  154. (my-packages
  155. (misc suspend))
  156. xorg-packages
  157. (remove-packages %redundant-packages
  158. %base-packages)))
  159. (services
  160. (list
  161. (service virtual-terminal-service-type)
  162. (service console-font-service-type
  163. (map (lambda (tty)
  164. (cons tty %default-console-font))
  165. '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6")))
  166. (service agetty-service-type
  167. (agetty-configuration
  168. (extra-options '("-L"))
  169. (term "vt100")
  170. (tty #f)))
  171. (service mingetty-service-type
  172. (mingetty-configuration (tty "tty1")
  173. (auto-login %user-name)))
  174. (service mingetty-service-type
  175. (mingetty-configuration (tty "tty2")))
  176. (service mingetty-service-type
  177. (mingetty-configuration (tty "tty3")))
  178. (service mingetty-service-type
  179. (mingetty-configuration (tty "tty4")))
  180. (service mingetty-service-type
  181. (mingetty-configuration (tty "tty5")))
  182. (service mingetty-service-type
  183. (mingetty-configuration (tty "tty6")))
  184. (service login-service-type
  185. (login-configuration
  186. (motd (plain-file "motd" "\
  187. Welcome to Hyksos! I mean GuixOS!\n\n"))))
  188. (service loadkeys-service-type
  189. (local-file (config-file "kbd/dvorak-alt.map")))
  190. (service keycodes-from-file-service-type
  191. (local-file (config-file "kbd/scancodes-msmult")))
  192. (service tor-service-type)
  193. (service dhcp-client-service-type)
  194. (service static-networking-service-type
  195. (list ;; (static-networking (interface "enp0s7")
  196. ;; (ip "192.168.1.32")
  197. ;; (gateway "192.168.1.1")
  198. ;; (name-servers '("77.88.8.8")))
  199. (static-networking (interface "lo")
  200. (ip "127.0.0.1")
  201. (provision '(loopback)))))
  202. (udisks-service)
  203. (service polkit-service-type)
  204. (service elogind-service-type
  205. (elogind-configuration
  206. (handle-suspend-key 'ignore)))
  207. (dbus-service)
  208. (service openssh-service-type (openssh-configuration))
  209. (syslog-service (syslog-configuration
  210. (config-file (local-file
  211. (config-file "syslog/syslog.conf")))))
  212. (service urandom-seed-service-type)
  213. (service guix-service-type)
  214. (service nscd-service-type)
  215. (service udev-service-type
  216. (udev-configuration
  217. (rules (specifications->packages
  218. "alsa-utils" "fuse"))))
  219. (service special-files-service-type
  220. ;; Using 'canonical-package' as bash and coreutils
  221. ;; canonical packages are already a part of
  222. ;; '%base-packages'.
  223. `(("/bin/sh"
  224. ,(file-append (canonical-package
  225. (guix-package bash bash))
  226. "/bin/bash"))
  227. ("/bin/bash"
  228. ,(file-append (canonical-package
  229. (guix-package bash bash))
  230. "/bin/bash"))
  231. ("/usr/bin/env"
  232. ,(file-append (canonical-package
  233. (guix-package base coreutils))
  234. "/bin/env"))))))))
  235. os