Skip to content

Instantly share code, notes, and snippets.

@zamfofex
Last active November 11, 2021 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamfofex/bc7279a5bddd25e8603c84c799d835dd to your computer and use it in GitHub Desktop.
Save zamfofex/bc7279a5bddd25e8603c84c799d835dd to your computer and use it in GitHub Desktop.

updating Guix packages for the Hurd

I have been meaning to try to run the Hurd one of my computers to try to do nontrivial work for a while now.

The problem I was facing is that the bultin networking drivers on GNU Mach weren’t quite enough for my hardware, so I had to resort to using DDE.

However, it appears as if there is some form of versioning mismatch that prevents the existent netdde package from functioning correctly. I took it upon myself to aim to fix that, and I have been working on bringing the Hurd packages on Guix to their latest version, in hope that it ends up working out well.

My current efforts are summarized into two files:

  • latest.scm bumps the versions of the relevant packages.
  • system.scm brings everything together cohesively into an operating system declaration.

current status

You are currently able to run guix system image system.scm to generate a new system image for the Hurd with the updated packages!

However, it is still not enough to use the netdde package. Trying it out in a QEMU VM, it still fails with the same errors as before.

Any form of help is appreciated!

coding style

You might find weirdnesses in the Scheme coding style. If anything looks strange, it’s likely simply because I don’t know better! I’m not particularly familiar with Scheme, so it’s very likely that I took weird approaches to certain issues.

diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 1e6af1029f..620a99c25b 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Rene Saavedra <pacoon@protonmail.com>
+;;; Copyright © 2021 zamfofex <zamfofex@twdb.moe>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -67,8 +68,8 @@ (define (hurd-source-url version)
version ".tar.gz"))
(define-public gnumach-headers
- (let ((commit "097f9cf735ffa1212b828682ad92f0f6c5f1c552")
- (revision "1"))
+ (let ((commit "7c107da5f0b7397eea37f5fb77d4afac8f6e93c7")
+ (revision "2"))
(package
(name "gnumach-headers")
(version (git-version "1.8" revision commit))
@@ -81,7 +82,7 @@ (define-public gnumach-headers
(file-name (git-file-name "gnumach" version))
(sha256
(base32
- "0q36z7k02bykrld90zaxbhyzxlmwlqqs4divgir6ix38zsp6icqk"))))
+ "1wwpa6hsp51bqzb0zdbvdfjffy252jj4kx66jj4zj0r385a37n6c"))))
(build-system gnu-build-system)
(arguments
`(#:phases
@@ -166,8 +167,8 @@ (define-public mig/32-bit
(define-public hurd-headers
;; Resort to a post-0.9 snapshot that provides the 'file_utimens' and
;; 'file_exec_paths' RPCs that glibc 2.28 expects.
- (let ((revision "1")
- (commit "91a51672ff4cfe1f1a0712b4c542ded3081c825b"))
+ (let ((revision "2")
+ (commit "77cdd08a2faf08afd13610f11db694856a7ce44c"))
(package
(name "hurd-headers")
(version (git-version "0.9" revision commit))
@@ -178,7 +179,8 @@ (define-public hurd-headers
(commit commit)))
(sha256
(base32
- "16k9wkahz9wasviijz53n6i13nmiwa9fs64ikf1jqh8rl60hw7cz"))
+ "0xjb40j1n0yj11gfw70lmppg1hvcl2n0yip30hlxx52s3yqdgzpw"))
+ (patches (search-patches "hurd-configure.patch"))
(file-name (git-file-name name version))))
(build-system gnu-build-system)
(native-inputs
@@ -337,7 +339,7 @@ (define unifont
(define dde-sources
;; This is the current tip of the dde branch
- (let ((commit "ac1c7eb7a8b24b7469bed5365be38a968d59a136"))
+ (let ((commit "3c12bd85cbc32d96f866ef19fa5173069b42130d"))
(origin
(method git-fetch)
(uri (git-reference
@@ -345,31 +347,29 @@ (define dde-sources
(commit commit)))
(sha256
(base32
- "1vryinbg75xpydfrv9dbgfnds6knlh8l8bk2rxp32y9dc58z0692"))
+ "09wvwnldv95i5xhl3jljhbxsnzjh6lw7kip5sl8wnxdgfphl5qj7"))
(file-name (git-file-name "dde" commit)))))
(define-public hurd
(package
(name "hurd")
(version (package-version hurd-headers))
- (source (origin (inherit (package-source hurd-headers))
- (patches (search-patches "hurd-cross.patch"
- "hurd-xattr.patch"))))
+ (source (package-source hurd-headers))
(arguments
`(#:phases
(modify-phases %standard-phases
(add-after 'unpack 'prepare-dde
(lambda* (#:key native-inputs inputs #:allow-other-keys)
(substitute* "Makefile"
- (("libbpf ")
- "libbpf libmachdev libmachdevdde libddekit"))
+ (("libmachdev ")
+ "libmachdev libmachdevdde libddekit "))
(for-each make-file-writable (find-files "."))
(let ((dde (or (assoc-ref inputs "dde-sources")
(assoc-ref native-inputs "dde-sources"))))
(for-each (lambda (dir)
(copy-recursively
- (string-append dde "/" dir ) dir))
- '("libmachdev" "libmachdevdde" "libddekit")))
+ (string-append dde "/" dir) dir))
+ '("libmachdevdde" "libddekit")))
#t))
(add-after 'unpack 'find-tirpc
(lambda* (#:key inputs #:allow-other-keys)
@@ -562,8 +562,8 @@ (define-public hurd
(license gpl2+)))
(define-public netdde
- (let ((commit "4a1016f130b6f2065d3f088325e5fb0b2997ae12")
- (revision "1"))
+ (let ((commit "e67c284ac113d939b10b4578334f27dab29d5b08")
+ (revision "2"))
(package
(name "netdde")
;; The version prefix corresponds to the version of Linux from which the
@@ -576,7 +576,7 @@ (define-public netdde
(commit commit)))
(sha256
(base32
- "1njv9dszq4lj05yq4v9j5v247hfghpzvvz4hzy0khjjr35mw7hr8"))
+ "0vnkls7sr7srzib5mnw6gybzl5qa8c5a4zf3h08w6gdr7zqbndh0"))
(file-name (git-file-name name commit))))
(build-system gnu-build-system)
(arguments
diff --git a/gnu/packages/patches/hurd-configure.patch b/gnu/packages/patches/hurd-configure.patch
new file mode 100644
index 0000000000..b06eae2ebb
--- /dev/null
+++ b/gnu/packages/patches/hurd-configure.patch
@@ -0,0 +1,4 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -0,1 +0,0 @@
+-AC_CHECK_FUNCS(_hurd_libc_proc_init)
(use-modules
(guix packages)
(guix git-download)
(gnu packages hurd)
(gnu packages bootloaders)
(gnu packages package-management)
(gnu system hurd)
(ice-9 optargs)
(guix gexp)
(gnu bootloader)
(gnu bootloader grub))
(define commit "96a673a4b0b7da004b7ffe6460894e94f57cd14a")
(define version (git-version "0.9" "2" commit))
(define url "https://git.savannah.gnu.org/git/hurd/hurd.git")
(define hash "12qb08zkf0y9ylsc9k7z84447hpxgy2jcmrvala936iv20kw97ya")
(define source
(origin
(method git-fetch)
(uri (git-reference (url url) (commit commit)))
(sha256 (base32 hash))))
(define latest (lambda* (outdated)
(package (inherit outdated)
(version version)
(source source))))
(define hurd-headers-x (latest hurd-headers))
(define hurd-minimal-x (latest hurd-minimal))
(define hurd-x
(package (inherit (latest hurd))
(arguments
`(#:phases
(modify-phases ,(let-keywords (package-arguments (latest hurd)) #t ((phases %standard-phases)) phases)
(replace 'prepare-dde
(lambda* (#:key native-inputs inputs #:allow-other-keys)
(substitute* "Makefile"
(("libmachdev ")
"libmachdev libmachdevdde libddekit "))
(for-each make-file-writable (find-files "."))
(let ((dde (or (assoc-ref inputs "dde-sources") (assoc-ref native-inputs "dde-sources"))))
(for-each
(lambda (dir)
(copy-recursively
(string-append dde "/" dir ) dir))
'("libmachdevdde" "libddekit")))
#t)))
#:configure-flags ,(let-keywords (package-arguments (latest hurd)) #t ((configure-flags #f)) configure-flags)))))
(define mach-commit "7c107da5f0b7397eea37f5fb77d4afac8f6e93c7")
(define mach-version (git-version "1.8" "2" mach-commit))
(define mach-url "https://git.savannah.gnu.org/git/hurd/gnumach.git")
(define mach-hash "1wwpa6hsp51bqzb0zdbvdfjffy252jj4kx66jj4zj0r385a37n6c")
(define mach-source
(origin
(method git-fetch)
(uri (git-reference (url mach-url) (commit mach-commit)))
(sha256 (base32 mach-hash))))
(define mach-latest (lambda* (outdated)
(package (inherit outdated)
(version mach-version)
(source mach-source))))
(define gnumach-headers-latest (mach-latest gnumach-headers))
(define gnumach-x (mach-latest gnumach))
(define netdde-commit "e67c284ac113d939b10b4578334f27dab29d5b08")
(define netdde-latest
(package (inherit netdde)
(version (git-version "2.6.32.65" "2" netdde-commit))
(source
(origin
(method git-fetch)
(uri (git-reference (url "https://git.savannah.gnu.org/git/hurd/incubator.git") (commit netdde-commit)))
(sha256 (base32 "0vnkls7sr7srzib5mnw6gybzl5qa8c5a4zf3h08w6gdr7zqbndh0"))))))
(define package-latest-mach-headers (package-input-rewriting/spec `(("gnumach-headers" . ,(const gnumach-headers-latest)))))
(define hurd-headers-latest (package-latest-mach-headers hurd-headers-x))
(define package-latest-hurd-headers (package-input-rewriting/spec `(("hurd-headers" . ,(const hurd-headers-latest)))))
(define gnumach-latest (package-latest-mach-headers gnumach-x))
(define hurd-latest (package-latest-hurd-headers (package-latest-mach-headers hurd-x)))
(define hurd-minimal-latest (package-latest-hurd-headers (package-latest-mach-headers hurd-minimal-x)))
(define gnumach-latest-x
(if (hurd-system?)
gnumach-latest
(with-parameters ((%current-system "i686-linux") (%current-target-system #f)) gnumach-latest)))
(define package-latest
(package-input-rewriting/spec
`(("gnumach-headers" . ,(const gnumach-headers-latest))
("gnumach" . ,(const gnumach-latest))
("hurd-headers" . ,(const hurd-headers-latest))
("hurd" . ,(const hurd-latest))
("hurd-minimal" . ,(const hurd-minimal-latest)))))
(define hurd-packages-x (append %base-packages/hurd (list netdde-latest)))
(define hurd-packages-latest (map package-latest hurd-packages-x))
(define guix-latest (package-latest guix))
(define grub-minimal-bootloader-latest
(bootloader (inherit grub-minimal-bootloader)
(package (package-latest grub-minimal))))
(use-modules
(srfi srfi-1)
(gnu image)
(gnu system)
(gnu system accounts)
(gnu system image)
(gnu system images hurd)
(gnu services)
(gnu services hurd)
(gnu services base)
(gnu services shepherd)
(gnu packages bash)
(gnu packages base)
(gnu bootloader)
(gnu bootloader grub))
(include "latest.scm")
(define (find-latest name) (find (lambda* (pkg) (equal? (package-name pkg) name)) hurd-packages-latest))
(define hurd-base-services-latest
(list
(service hurd-console-service-type
(hurd-console-configuration (hurd hurd-latest)))
(service hurd-getty-service-type
(hurd-getty-configuration
(hurd hurd-latest)
(tty "tty1")))
(service hurd-getty-service-type
(hurd-getty-configuration
(hurd hurd-latest)
(tty "tty2")))
(service static-networking-service-type
(list (static-networking
(interface "lo")
(ip "127.0.0.1")
(requirement '())
(provision '(loopback networking))
(name-servers '("1.1.1.1" "1.0.0.1")))))
(syslog-service)
(service guix-service-type
(guix-configuration
(guix guix-latest)
(extra-options
'("--disable-chroot"
"--disable-deduplication"))))
(service
special-files-service-type
`(("/bin/sh" ,(file-append (find-latest "bash") "/bin/sh"))
("/usr/bin/env" ,(file-append (find-latest "coreutils") "/bin/env"))))))
(define hurd-os-latest
(operating-system (inherit hurd-barebones-os)
(host-name "hurd")
(hurd hurd-latest)
(kernel gnumach-latest-x)
(bootloader
(bootloader-configuration
(bootloader grub-minimal-bootloader-latest)
(targets '("/dev/vda"))))
(timezone "Europe/Paris")
(users
(list
(user-account
(name "zam")
(comment "zamfofex")
(group "users")
(supplementary-groups '("wheel" "netdev" "audio" "video" "input" "dialout")))))
(essential-services
(modify-services (hurd-default-essential-services this-operating-system)
(shepherd-root-service-type config =>
(shepherd-configuration (inherit config)
(shepherd (find-latest "shepherd"))))))
(services hurd-base-services-latest)
(packages hurd-packages-latest)))
(define hurd-image-latest
(image (inherit (os->image hurd-os-latest #:type hurd-image-type))
(name 'hurd-image)))
hurd-image-latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment