hurd.scm 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2020-2022 Ludovic Courtès <ludo@gnu.org>
  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 hurd)
  20. #:use-module (guix gexp)
  21. #:use-module (guix profiles)
  22. #:use-module (guix utils)
  23. #:use-module (gnu bootloader)
  24. #:use-module (gnu bootloader grub)
  25. #:use-module (gnu packages admin)
  26. #:use-module (gnu packages base)
  27. #:use-module (gnu packages bash)
  28. #:use-module (gnu packages compression)
  29. #:use-module (gnu packages cross-base)
  30. #:use-module (gnu packages file)
  31. #:use-module (gnu packages gawk)
  32. #:use-module (gnu packages guile)
  33. #:use-module (gnu packages guile-xyz)
  34. #:use-module (gnu packages hurd)
  35. #:use-module (gnu packages less)
  36. #:use-module (gnu packages texinfo)
  37. #:use-module (gnu services)
  38. #:use-module (gnu services base)
  39. #:use-module (gnu services hurd)
  40. #:use-module (gnu services shepherd)
  41. #:use-module (gnu system)
  42. #:use-module (gnu system setuid)
  43. #:use-module (gnu system shadow)
  44. #:use-module (gnu system vm)
  45. #:export (%base-packages/hurd
  46. %base-services/hurd
  47. %hurd-default-operating-system
  48. %hurd-default-operating-system-kernel
  49. %setuid-programs/hurd))
  50. ;;; Commentary:
  51. ;;;
  52. ;;; This module provides system-specifics for the GNU/Hurd operating system
  53. ;;; and virtual machine.
  54. ;;;
  55. ;;; Code:
  56. (define %hurd-default-operating-system-kernel
  57. (if (hurd-system?)
  58. gnumach
  59. ;; A cross-built GNUmach does not work
  60. (with-parameters ((%current-system "i686-linux")
  61. (%current-target-system #f))
  62. gnumach)))
  63. (define %base-packages/hurd
  64. ;; Note: the Shepherd comes before the Hurd, not just because its duty is to
  65. ;; shepherd the herd, but also because we want its 'halt' and 'reboot'
  66. ;; commands to take precedence.
  67. (list shepherd hurd bash coreutils file findutils grep sed
  68. diffutils patch gawk tar gzip bzip2 xz lzip
  69. guile-3.0-latest guile-colorized guile-readline
  70. net-base inetutils less shadow sudo which
  71. info-reader))
  72. (define %base-services/hurd
  73. (list (service hurd-console-service-type
  74. (hurd-console-configuration (hurd hurd)))
  75. (service hurd-getty-service-type (hurd-getty-configuration
  76. (tty "tty1")))
  77. (service hurd-getty-service-type (hurd-getty-configuration
  78. (tty "tty2")))
  79. (service static-networking-service-type
  80. (list %loopback-static-networking
  81. ;; QEMU user-mode networking. To get "eth0", you need
  82. ;; QEMU to emulate a device for which Mach has an
  83. ;; in-kernel driver, for instance with:
  84. ;; --device rtl8139,netdev=net0 --netdev user,id=net0
  85. %qemu-static-networking))
  86. (syslog-service)
  87. (service guix-service-type
  88. (guix-configuration
  89. (extra-options '("--disable-chroot"
  90. "--disable-deduplication"))))
  91. (service special-files-service-type
  92. `(("/bin/sh" ,(file-append bash "/bin/sh"))
  93. ("/usr/bin/env" ,(file-append coreutils "/bin/env"))))))
  94. (define %setuid-programs/hurd
  95. ;; Default set of setuid-root programs.
  96. (map file-like->setuid-program
  97. (list (file-append shadow "/bin/passwd")
  98. (file-append shadow "/bin/sg")
  99. (file-append shadow "/bin/su")
  100. (file-append shadow "/bin/newgrp")
  101. (file-append shadow "/bin/newuidmap")
  102. (file-append shadow "/bin/newgidmap")
  103. (file-append sudo "/bin/sudo")
  104. (file-append sudo "/bin/sudoedit"))))
  105. (define %hurd-default-operating-system
  106. (operating-system
  107. (kernel %hurd-default-operating-system-kernel)
  108. (kernel-arguments '())
  109. (hurd hurd)
  110. (bootloader (bootloader-configuration
  111. (bootloader grub-minimal-bootloader)
  112. (targets '("/dev/vda"))))
  113. (initrd #f)
  114. (initrd-modules '())
  115. (firmware '())
  116. (host-name "guixygnu")
  117. (file-systems '())
  118. (packages %base-packages/hurd)
  119. (timezone "GNUrope")
  120. (name-service-switch #f)
  121. (essential-services (hurd-default-essential-services this-operating-system))
  122. (setuid-programs %setuid-programs/hurd)))