endlessh-virtual-machine-config.scm 4.0 KB

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