linode-locke-lamora-current-config.scm 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. ;; this was the original file that I used to create my remote linode
  2. (add-to-load-path (dirname (current-filename)))
  3. (use-modules (gnu)
  4. (guix modules)
  5. (secret nginx)
  6. )
  7. (use-service-modules certbot
  8. messaging
  9. networking
  10. ssh
  11. web)
  12. (use-package-modules admin
  13. certs
  14. package-management
  15. ssh
  16. tls)
  17. (define %nginx-deploy-hook
  18. (program-file
  19. "nginx-deploy-hook"
  20. #~(let ((pid (call-with-input-file "/var/run/nginx/pid" read)))
  21. (kill pid SIGHUP))))
  22. (define %user "joshua")
  23. (operating-system
  24. (host-name "locke-lamora")
  25. (timezone "America/Chicago")
  26. (locale "en_US.UTF-8")
  27. ;; This goofy code will generate the grub.cfg
  28. ;; without installing the grub bootloader on disk.
  29. (bootloader (bootloader-configuration
  30. (bootloader
  31. (bootloader
  32. (inherit grub-bootloader)
  33. (installer #~(const #t))))))
  34. (file-systems (cons (file-system
  35. (device "/dev/sda")
  36. (mount-point "/")
  37. (type "ext4"))
  38. %base-file-systems))
  39. (swap-devices (list "/dev/sdb"))
  40. (initrd-modules (cons "virtio_scsi" ; Needed to find the disk
  41. %base-initrd-modules))
  42. (users (cons (user-account
  43. (name %user)
  44. (group "users")
  45. ;; Adding the account to the "wheel" group
  46. ;; makes it a sudoer.
  47. (supplementary-groups '("wheel"))
  48. (home-directory (string-append "/home/" %user)))
  49. %base-user-accounts))
  50. (sudoers-file
  51. (plain-file "sudoers"
  52. (string-append (plain-file-content %sudoers-specification)
  53. (format #f "~a ALL = NOPASSWD: ALL~%"
  54. %user))))
  55. (packages (cons* nss-certs ;for HTTPS access
  56. openssh-sans-x
  57. %base-packages))
  58. (services (cons*
  59. (service dhcp-client-service-type)
  60. (service certbot-service-type
  61. (certbot-configuration
  62. (email "jbranso@dismail.de")
  63. (webroot "/srv/www")
  64. (certificates
  65. (list
  66. (certificate-configuration
  67. (name "gnucode.me")
  68. (domains '("gnucode.me" "www.gnucode.me"))
  69. (deploy-hook %nginx-deploy-hook))
  70. (certificate-configuration
  71. (name "gnu-hurd.com")
  72. (domains '("gnu-hurd.com" "www.gnu-hurd.com"))
  73. (deploy-hook %nginx-deploy-hook))
  74. ))))
  75. (service nginx-service-type
  76. (nginx-configuration
  77. (server-blocks
  78. (list
  79. (nginx-server-configuration
  80. (server-name '("gnucode.me"))
  81. (listen '("80" "443 ssl"))
  82. (root "/srv/www/html/gnucode.me/site/")
  83. ;; tell browsers my site supports HTTPS, and tell them that it will
  84. ;; at least work for 1/2 hour. Gradually, I will increase this number.
  85. (raw-content (list "add_header Strict-Transport-Security max-age=1800;"))
  86. (ssl-certificate "/etc/letsencrypt/live/gnucode.me/fullchain.pem")
  87. (ssl-certificate-key "/etc/letsencrypt/live/gnucode.me/privkey.pem")
  88. (locations
  89. (list
  90. (nginx-location-configuration ;certbot
  91. (uri "/.well-known")
  92. (body (list "root /srv/www;")))
  93. %gnucode-location
  94. )))
  95. (nginx-server-configuration
  96. (server-name '("gnu-hurd.com"))
  97. (listen '("80" "443 ssl"))
  98. (root "/srv/www/html/gnu-hurd.com/")
  99. (ssl-certificate "/etc/letsencrypt/live/gnu-hurd.com/fullchain.pem")
  100. (ssl-certificate-key "/etc/letsencrypt/live/gnu-hurd.com/privkey.pem")
  101. ;; tell browsers my site supports HTTPS, and tell them that it will
  102. ;; at least work for 1/2 hour. Gradually, I will increase this number.
  103. (raw-content (list "add_header Strict-Transport-Security max-age=1800;"))
  104. (locations
  105. (list
  106. (nginx-location-configuration ;certbot
  107. (uri "/.well-known")
  108. (body (list "root /srv/www;"))))))
  109. ))))
  110. (service openssh-service-type
  111. (openssh-configuration
  112. (openssh openssh-sans-x)
  113. (password-authentication? #f)
  114. (authorized-keys
  115. `((%user ,(local-file
  116. (string-append
  117. "/home/" %user "/linode-guix-system-configuration/id_rsa.pub")))
  118. ("root" ,(local-file
  119. (string-append
  120. "/home/" %user "/linode-guix-system-configuration/id_rsa.pub")))))))
  121. ;; I've created the prosody admin user, and I imported the cert...
  122. ;; but pidgin tells me that I the XMPP server at gnucode.me does not support encryption.
  123. (service prosody-service-type
  124. (prosody-configuration
  125. (admins '("jbranso@dismail.de"))
  126. (virtualhosts
  127. (list
  128. (virtualhost-configuration
  129. (domain "gnucode.me"))))))
  130. %base-services)))