vm-image.tmpl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. ;; This is an operating system configuration for a VM image.
  2. ;; Modify it as you see fit and instantiate the changes by running:
  3. ;;
  4. ;; guix system reconfigure /etc/config.scm
  5. ;;
  6. (use-modules (gnu) (guix) (srfi srfi-1))
  7. (use-service-modules desktop networking ssh xorg)
  8. (use-package-modules bootloaders certs fonts nvi
  9. package-management wget xorg)
  10. (define vm-image-motd (plain-file "motd" "
  11. \x1b[1;37mThis is the GNU system. Welcome!\x1b[0m
  12. This instance of Guix is a template for virtualized environments.
  13. You can reconfigure the whole system by adjusting /etc/config.scm
  14. and running:
  15. guix system reconfigure /etc/config.scm
  16. Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation.
  17. \x1b[1;33mConsider setting a password for the 'root' and 'guest' \
  18. accounts.\x1b[0m
  19. "))
  20. (operating-system
  21. (host-name "gnu")
  22. (timezone "Etc/UTC")
  23. (locale "en_US.utf8")
  24. (keyboard-layout (keyboard-layout "us" "altgr-intl"))
  25. ;; Label for the GRUB boot menu.
  26. (label (string-append "GNU Guix " (package-version guix)))
  27. (firmware '())
  28. ;; Below we assume /dev/vda is the VM's hard disk.
  29. ;; Adjust as needed.
  30. (bootloader (bootloader-configuration
  31. (bootloader grub-bootloader)
  32. (target "/dev/vda")
  33. (terminal-outputs '(console))))
  34. (file-systems (cons (file-system
  35. (mount-point "/")
  36. (device "/dev/vda1")
  37. (type "ext4"))
  38. %base-file-systems))
  39. (users (cons (user-account
  40. (name "guest")
  41. (comment "GNU Guix Live")
  42. (password "") ;no password
  43. (group "users")
  44. (supplementary-groups '("wheel" "netdev"
  45. "audio" "video")))
  46. %base-user-accounts))
  47. ;; Our /etc/sudoers file. Since 'guest' initially has an empty password,
  48. ;; allow for password-less sudo.
  49. (sudoers-file (plain-file "sudoers" "\
  50. root ALL=(ALL) ALL
  51. %wheel ALL=NOPASSWD: ALL\n"))
  52. (packages (append (list font-bitstream-vera nss-certs nvi wget)
  53. %base-packages))
  54. (services
  55. (append (list (service xfce-desktop-service-type)
  56. ;; Choose SLiM, which is lighter than the default GDM.
  57. (service slim-service-type
  58. (slim-configuration
  59. (auto-login? #t)
  60. (default-user "guest")
  61. (xorg-configuration
  62. (xorg-configuration
  63. (keyboard-layout keyboard-layout)))))
  64. ;; Uncomment the line below to add an SSH server.
  65. ;;(service openssh-service-type)
  66. ;; Use the DHCP client service rather than NetworkManager.
  67. (service dhcp-client-service-type))
  68. ;; Remove GDM, ModemManager, NetworkManager, and wpa-supplicant,
  69. ;; which don't make sense in a VM.
  70. (remove (lambda (service)
  71. (let ((type (service-kind service)))
  72. (or (memq type
  73. (list gdm-service-type
  74. wpa-supplicant-service-type
  75. cups-pk-helper-service-type
  76. network-manager-service-type
  77. modem-manager-service-type))
  78. (eq? 'network-manager-applet
  79. (service-type-name type)))))
  80. (modify-services %desktop-services
  81. (login-service-type config =>
  82. (login-configuration
  83. (inherit config)
  84. (motd vm-image-motd)))))))
  85. ;; Allow resolution of '.local' host names with mDNS.
  86. (name-service-switch %mdns-host-lookup-nss))