hurd.scm 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 platforms hurd)
  26. #:use-module (gnu services)
  27. #:use-module (gnu services ssh)
  28. #:use-module (gnu system)
  29. #:use-module (gnu system file-systems)
  30. #:use-module (gnu system hurd)
  31. #:use-module (gnu system image)
  32. #:use-module (srfi srfi-26)
  33. #:export (hurd-barebones-os
  34. hurd-disk-image
  35. hurd-image-type
  36. hurd-qcow2-image-type
  37. hurd-barebones-disk-image
  38. hurd-barebones-qcow2-image))
  39. (define hurd-barebones-os
  40. (operating-system
  41. (inherit %hurd-default-operating-system)
  42. (bootloader (bootloader-configuration
  43. (bootloader grub-minimal-bootloader)
  44. (targets '("/dev/sdX"))))
  45. (file-systems (cons (file-system
  46. (device (file-system-label "my-root"))
  47. (mount-point "/")
  48. (type "ext2"))
  49. %base-file-systems))
  50. (host-name "guixygnu")
  51. (timezone "Europe/Amsterdam")
  52. (packages (cons openssh-sans-x %base-packages/hurd))
  53. (services (cons (service openssh-service-type
  54. (openssh-configuration
  55. (openssh openssh-sans-x)
  56. (use-pam? #f)
  57. (port-number 2222)
  58. (permit-root-login #t)
  59. (allow-empty-passwords? #t)
  60. (password-authentication? #t)))
  61. %base-services/hurd))))
  62. (define hurd-initialize-root-partition
  63. #~(lambda* (#:rest args)
  64. (apply initialize-root-partition
  65. (append args
  66. (list #:make-device-nodes make-hurd-device-nodes
  67. ;; XXX Creating a db.sqlite with journal_mode=WAL
  68. ;; yields "unable to open database file" on GNU/Hurd
  69. ;; for an sqlite with the hurd-locking-mode.patch;
  70. ;; see <https://bugs.gnu.org/42151>.
  71. #:wal-mode? #f)))))
  72. (define hurd-disk-image
  73. (image
  74. (format 'disk-image)
  75. (platform hurd)
  76. (partitions
  77. (list (partition
  78. (size 'guess)
  79. (offset root-offset)
  80. (label root-label)
  81. (file-system "ext2")
  82. (file-system-options '("-o" "hurd" "-O" "ext_attr"))
  83. (flags '(boot))
  84. (initializer hurd-initialize-root-partition))))))
  85. (define hurd-image-type
  86. (image-type
  87. (name 'hurd-raw)
  88. (constructor (cut image-with-os hurd-disk-image <>))))
  89. (define hurd-qcow2-image-type
  90. (image-type
  91. (name 'hurd-qcow2)
  92. (constructor (lambda (os)
  93. (image
  94. (inherit hurd-disk-image)
  95. (format 'compressed-qcow2)
  96. (operating-system os))))))
  97. (define hurd-barebones-disk-image
  98. (image
  99. (inherit
  100. (os+platform->image hurd-barebones-os hurd
  101. #:type hurd-image-type))
  102. (name 'hurd-barebones-disk-image)))
  103. (define hurd-barebones-qcow2-image
  104. (image
  105. (inherit
  106. (os+platform->image hurd-barebones-os hurd
  107. #:type hurd-qcow2-image-type))
  108. (name 'hurd-barebones.qcow2)))
  109. ;; Return the default image.
  110. hurd-barebones-qcow2-image