projects/guix·blob python-team · refs

144 lines · 5.5 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2020-2025 Ludovic Courtès <[email protected]>
3;;; Copyright © 2020, 2023, 2024, 2026 Janneke Nieuwenhuizen <[email protected]>
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
20;;; Commentary:
21;;;
22;;; This module provides system-specifics for the GNU/Hurd operating system
23;;; and virtual machine.
24;;;
25;;; Code:
26
27(define-module (gnu system hurd)
28 #:use-module (ice-9 match)
29 #:use-module (guix gexp)
30 #:use-module (guix profiles)
31 #:use-module (guix utils)
32 #:use-module (gnu bootloader)
33 #:use-module (gnu bootloader grub)
34 #:use-module (gnu packages admin)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages bash)
37 #:use-module (gnu packages nss)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages cross-base)
40 #:use-module (gnu packages file)
41 #:use-module (gnu packages gawk)
42 #:use-module (gnu packages guile)
43 #:use-module (gnu packages guile-xyz)
44 #:use-module (gnu packages hurd)
45 #:use-module (gnu packages less)
46 #:use-module (gnu packages linux)
47 #:use-module (gnu packages pciutils)
48 #:use-module (gnu packages texinfo)
49 #:use-module (gnu services)
50 #:use-module (gnu services base)
51 #:use-module (gnu services hurd)
52 #:use-module (gnu services shepherd)
53 #:use-module (gnu system)
54 #:use-module (gnu system setuid)
55 #:use-module (gnu system shadow)
56 #:use-module (gnu system vm)
57 #:export (%base-packages/hurd
58 %base-services/hurd
59 %base-services+qemu-networking/hurd
60 %desktop-services/hurd
61 %hurd-default-operating-system
62 %hurd-default-operating-system-kernel
63 %setuid-programs/hurd))
64
65(define %hurd-default-operating-system-kernel
66 gnumach)
67
68(define %base-packages/hurd
69 ;; Note: the Shepherd comes before the Hurd, not just because its duty is to
70 ;; shepherd the herd, but also because we want its 'halt' and 'reboot'
71 ;; commands to take precedence.
72 (list shepherd-1.0 hurd netdde bash coreutils file findutils grep sed
73 diffutils patch gawk tar gzip bzip2 xz lzip zstd
74 guile-3.0-latest guile-colorized guile-readline
75 net-base nss-certs inetutils less procps shadow sudo which
76 info-reader e2fsprogs pciutils))
77
78(define %base-services/hurd
79 (append (list (service hurd-console-service-type
80 (hurd-console-configuration (hurd hurd)))
81 (service guix-service-type
82 (guix-configuration
83 (extra-options '("--disable-chroot"
84 "--disable-deduplication"))))
85 (service special-files-service-type
86 `(("/bin/sh" ,(file-append bash "/bin/sh"))
87 ("/usr/bin/env" ,(file-append coreutils
88 "/bin/env"))))
89 (service shepherd-system-log-service-type)
90 (service hurd-login-service-type))
91 (map (lambda (n)
92 (service hurd-getty-service-type
93 (hurd-getty-configuration
94 (tty (string-append "tty" (number->string n))))))
95 (iota 6 1))))
96
97(define %base-services+qemu-networking/hurd
98 (cons
99 (service static-networking-service-type
100 (list %loopback-static-networking
101
102 ;; QEMU user-mode networking. To get "eth0", you need
103 ;; QEMU to emulate a device for which Mach has an
104 ;; in-kernel driver, for instance with:
105 ;; --device rtl8139,netdev=net0 --netdev user,id=net0
106 %qemu-static-networking))
107 %base-services/hurd))
108
109(define %desktop-services/hurd %base-services/hurd)
110
111(define %setuid-programs/hurd
112 ;; Default set of setuid-root programs.
113 (map file-like->setuid-program
114 (list (file-append shadow "/bin/passwd")
115 (file-append shadow "/bin/sg")
116 (file-append shadow "/bin/su")
117 (file-append shadow "/bin/newgrp")
118 (file-append shadow "/bin/newuidmap")
119 (file-append shadow "/bin/newgidmap")
120 (file-append sudo "/bin/sudo")
121 (file-append sudo "/bin/sudoedit"))))
122
123(define %hurd-default-operating-system
124 (operating-system
125 (kernel %hurd-default-operating-system-kernel)
126 (kernel-arguments '())
127 (hurd hurd)
128 (bootloader (bootloader-configuration
129 (bootloader grub-minimal-bootloader)
130 (targets '("/dev/vda"))))
131 (initrd #f)
132 (initrd-modules '())
133 (firmware '())
134 (host-name "guixygnu")
135 (file-systems '())
136 (packages %base-packages/hurd)
137 (timezone "GNUrope")
138 (locale-libcs (list glibc/hurd))
139 (name-service-switch #f)
140 (essential-services (hurd-default-essential-services this-operating-system))
141 (privileged-programs '())
142 (setuid-programs %setuid-programs/hurd)))
143
144