hurd.scm 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
  3. ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (gnu system images hurd)
  20. #:use-module (guix gexp)
  21. #:use-module (gnu bootloader)
  22. #:use-module (gnu bootloader grub)
  23. #:use-module (gnu image)
  24. #:use-module (gnu packages ssh)
  25. #:use-module (gnu services)
  26. #:use-module (gnu services ssh)
  27. #:use-module (gnu system)
  28. #:use-module (gnu system file-systems)
  29. #:use-module (gnu system hurd)
  30. #:use-module (gnu system image)
  31. #:use-module (srfi srfi-26)
  32. #:export (hurd-barebones-os
  33. hurd-disk-image
  34. hurd-image-type
  35. hurd-qcow2-image-type
  36. hurd-barebones-disk-image
  37. hurd-barebones-qcow2-image))
  38. (define hurd-barebones-os
  39. (operating-system
  40. (inherit %hurd-default-operating-system)
  41. (bootloader (bootloader-configuration
  42. (bootloader grub-minimal-bootloader)
  43. (target "/dev/sdX")))
  44. (file-systems (cons (file-system
  45. (device (file-system-label "my-root"))
  46. (mount-point "/")
  47. (type "ext2"))
  48. %base-file-systems))
  49. (host-name "guixygnu")
  50. (timezone "Europe/Amsterdam")
  51. (packages (cons openssh-sans-x %base-packages/hurd))
  52. (services (cons (service openssh-service-type
  53. (openssh-configuration
  54. (openssh openssh-sans-x)
  55. (use-pam? #f)
  56. (port-number 2222)
  57. (permit-root-login #t)
  58. (allow-empty-passwords? #t)
  59. (password-authentication? #t)))
  60. %base-services/hurd))))
  61. (define hurd-initialize-root-partition
  62. #~(lambda* (#:rest args)
  63. (apply initialize-root-partition
  64. (append args
  65. (list #:make-device-nodes make-hurd-device-nodes
  66. ;; XXX Creating a db.sqlite with journal_mode=WAL
  67. ;; yields "unable to open database file" on GNU/Hurd
  68. ;; for an sqlite with the hurd-locking-mode.patch;
  69. ;; see <https://bugs.gnu.org/42151>.
  70. #:wal-mode? #f)))))
  71. (define hurd-disk-image
  72. (image
  73. (format 'disk-image)
  74. (target "i586-pc-gnu")
  75. (partitions
  76. (list (partition
  77. (size 'guess)
  78. (offset root-offset)
  79. (label root-label)
  80. (file-system "ext2")
  81. (file-system-options '("-o" "hurd" "-O" "ext_attr"))
  82. (flags '(boot))
  83. (initializer hurd-initialize-root-partition))))))
  84. (define hurd-image-type
  85. (image-type
  86. (name 'hurd-raw)
  87. (constructor (cut image-with-os hurd-disk-image <>))))
  88. (define hurd-qcow2-image-type
  89. (image-type
  90. (name 'hurd-qcow2)
  91. (constructor (lambda (os)
  92. (image
  93. (inherit hurd-disk-image)
  94. (format 'compressed-qcow2)
  95. (operating-system os))))))
  96. (define hurd-barebones-disk-image
  97. (image
  98. (inherit
  99. (os->image hurd-barebones-os #:type hurd-image-type))
  100. (name 'hurd-barebones-disk-image)))
  101. (define hurd-barebones-qcow2-image
  102. (image
  103. (inherit
  104. (os->image hurd-barebones-os #:type hurd-qcow2-image-type))
  105. (name 'hurd-barebones.qcow2)))