bare-bones-with-autologin.scm 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ;; Copyright © 2021, 2022 Joshua Branson <jbranso@dismail.de>
  2. (use-modules (gnu))
  3. (use-service-modules networking
  4. ssh)
  5. (use-package-modules ssh)
  6. (define (auto-login-to-tty config tty user)
  7. (if (string=? tty (mingetty-configuration-tty config))
  8. (mingetty-configuration
  9. (inherit config)
  10. (auto-login user))
  11. config))
  12. ;; add an autologin to tty for a tty 2 - 4.
  13. ;; When you run this vm, only one will be auto-logged in.
  14. (define %my-base-services
  15. (modify-services %base-services
  16. (mingetty-service-type config =>
  17. (auto-login-to-tty config "tty1" "joshua"))
  18. (mingetty-service-type config =>
  19. (auto-login-to-tty config "tty2" "joshua"))
  20. (mingetty-service-type config =>
  21. (auto-login-to-tty config "tty3" "joshua"))
  22. (mingetty-service-type config =>
  23. (auto-login-to-tty config "tty4" "joshua"))))
  24. (operating-system
  25. (host-name "autologin")
  26. (timezone "America/Indianapolis")
  27. (locale "en_US.utf8")
  28. (bootloader (bootloader-configuration
  29. (bootloader grub-bootloader)
  30. (targets (list "/dev/sda"))))
  31. (file-systems
  32. (cons*
  33. (file-system
  34. (mount-point "/")
  35. (device "/dev/sda")
  36. (type "ext4"))
  37. %base-file-systems))
  38. (users (cons* (user-account
  39. (name "joshua")
  40. (comment "Joshua Branson")
  41. (group "users")
  42. (home-directory "/home/joshua")
  43. (supplementary-groups
  44. '("kvm" "netdev" "wheel")))
  45. %base-user-accounts))
  46. (packages %base-packages)
  47. ;; Add services to the baseline: a DHCP client and
  48. ;; an SSH server.
  49. (services
  50. (cons*
  51. (service dhcp-client-service-type)
  52. (service openssh-service-type
  53. (openssh-configuration
  54. (openssh openssh-sans-x)
  55. (port-number 2222)))
  56. %my-base-services)))