unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
@ 2021-11-10 12:35 Zhu Zihao
       [not found] ` <handler.51747.B.16365478179399.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2021-11-10 12:35 UTC (permalink / raw)
  To: 51747


[-- Attachment #1.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Attachment #2: 0001-gnu-Add-lowdown.patch --]
[-- Type: text/x-patch, Size: 2587 bytes --]

From 935afdd36fee52fe3930991245ac67e48c0a00ff Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 19:21:45 +0800
Subject: [PATCH 1/3] gnu: Add lowdown.

* gnu/packages/markup.scm(lowdown): New variables.
---
 gnu/packages/markup.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 368976bfde..4ec606f892 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 EuAndreh <eu@euandre.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
+;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -36,6 +37,7 @@ (define-module (gnu packages markup)
   #:use-module (guix utils)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -324,3 +326,35 @@ (define-public python-mistletoe
 swap out renderers for different output formats, without touching any of the
 core components.")
     (license expat)))
+
+(define-public lowdown
+  (package
+    (name "lowdown")
+    (version "0.10.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://kristaps.bsd.lv/lowdown/snapshots/lowdown-"
+                           version ".tar.gz"))
+       (sha256
+        (base32 "15v2kk4ffqw3n6y6n9plch4qcib3ynnhw0ih8wn2v9qgn4jssp5p"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ;No test
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (invoke "./configure"
+                       (string-append "PREFIX=" out)
+                       (string-append "MANDIR=" out "/share/man"))))))
+       ;; the shared library of nix is linked with lowdown.
+       #:make-flags '("CFLAGS=-fPIC")))
+    (native-inputs
+     `(("which" ,which)))
+    (home-page "https://kristaps.bsd.lv/lowdown")
+    (synopsis "Simple Markdown translator")
+    (description "Lowdown is a Markdown translator producing HTML5,
+roff documents in the ms and man formats, LaTeX, gemini, and terminal output.")
+    (license isc)))
-- 
2.33.1


[-- Attachment #3: 0002-gnu-Add-libcpuid.patch --]
[-- Type: text/x-patch, Size: 1824 bytes --]

From d38e131913a006d47d611ce6ebabfb1823d804b8 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 19:31:28 +0800
Subject: [PATCH 2/3] gnu: Add libcpuid.

gnu/packages/hardware.scm(libcpuid): New variable.
---
 gnu/packages/hardware.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 2bf3576d5a..df7fb4b716 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -834,3 +835,22 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public libcpuid
+  (package
+    (name "libcpuid")
+    (version "0.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/anrieff/libcpuid/releases/download/v"
+                           version "/libcpuid-" version ".tar.gz"))
+       (sha256
+        (base32 "1nksdqk2w1c56lkrjcvh3nss9vq454j81j3yq14lwdn4x8bvmwfr"))))
+    (build-system gnu-build-system)
+    (supported-systems '("x86_64-linux" "i686-linux"))
+    (home-page "https://libcpuid.sourceforge.net/")
+    (synopsis "A small library for x86 CPU detection and feature extraction")
+    (description "Libcpuid is a small C library to get vendor, model, branding
+string, code name and other information from x86 CPU.")
+    (license license:bsd-2)))
-- 
2.33.1


[-- Attachment #4: 0003-gnu-nix-Update-to-2.4.patch --]
[-- Type: text/x-patch, Size: 7176 bytes --]

From 51a7de78cebf893ebd15169f6af154b04b734e31 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 19:36:01 +0800
Subject: [PATCH 3/3] gnu: nix: Update to 2.4.

* gnu/packages/package-management.scm(nix): Update to 2.4.

[source]: Switch to Github repository since upstream no longer provides
tarball.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, flex, gcc,
googletest, jq, libtool
[inputs]: Add libarchive, libcpuid, lowdown, zlib.

* gnu/packages/patches/nix-dont-build-html-doc.diff: New file.
* gnu/local.mk(dist_patch_DATA): Add corresponding entry.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/package-management.scm           | 67 +++++++++++++------
 .../patches/nix-dont-build-html-doc.diff      | 26 +++++++
 3 files changed, 74 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/nix-dont-build-html-doc.diff

diff --git a/gnu/local.mk b/gnu/local.mk
index 3a849ed2b0..28c01a02ca 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1529,6 +1529,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch	\
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch	\
+  %D%/packages/patches/nix-dont-build-html-doc.diff		\
   %D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch	\
   %D%/packages/patches/ngircd-handle-zombies.patch		\
   %D%/packages/patches/ngless-unliftio.patch		\
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 3c9d4da941..f45d09db78 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -19,6 +19,7 @@
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -60,6 +61,8 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -68,12 +71,14 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
+  #:use-module (gnu packages hardware)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages less)
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
@@ -596,14 +601,18 @@ (define-public current-guix
 (define-public nix
   (package
     (name "nix")
-    (version "2.3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "https://releases.nixos.org/nix/nix-"
-                                 version "/nix-" version ".tar.xz"))
-             (sha256
-              (base32
-               "1g5aqavr6i3c1xln53w1pdh1kvlxrpnknb105m4jbd85kyv83rky"))))
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "http://github.com/NixOS/nix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+       (patches
+        (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
@@ -619,18 +628,36 @@ (define-public nix
                       (string-append "sysconfdir=" etc)
                       (string-append "profiledir=" etc "/profile.d")
                       make-flags)))))))
-    (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("boost" ,boost)
-              ("brotli" ,brotli)
-              ("bzip2" ,bzip2)
-              ("curl" ,curl)
-              ("editline" ,editline)
-              ("libgc" ,libgc)
-              ("libseccomp" ,libseccomp)
-              ("libsodium" ,libsodium)
-              ("openssl" ,openssl)
-              ("sqlite" ,sqlite)
-              ("xz" ,xz)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("bison" ,bison)
+       ("flex" ,flex)
+       ("gcc" ,gcc-9)                   ;non-trivial designated initializers
+       ("googletest" ,googletest)
+       ("jq" ,jq)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("boost" ,boost)
+       ("brotli" ,brotli)
+       ("bzip2" ,bzip2)
+       ("curl" ,curl)
+       ("editline" ,editline)
+       ("libarchive" ,libarchive)
+       ,@(if (string-prefix? "x86_64" (or (%current-target-system)
+                                          (%current-system)))
+             `(("libcpuid" ,libcpuid))
+             '())
+       ("libgc" ,libgc)
+       ("libseccomp" ,libseccomp)
+       ("libsodium" ,libsodium)
+       ("lowdown" ,lowdown)
+       ("openssl" ,openssl)
+       ("sqlite" ,sqlite)
+       ("xz" ,xz)
+       ("zlib" ,zlib)))
     (home-page "https://nixos.org/nix/")
     (synopsis "The Nix package manager")
     (description
diff --git a/gnu/packages/patches/nix-dont-build-html-doc.diff b/gnu/packages/patches/nix-dont-build-html-doc.diff
new file mode 100644
index 0000000000..79142bc215
--- /dev/null
+++ b/gnu/packages/patches/nix-dont-build-html-doc.diff
@@ -0,0 +1,26 @@
+"--enable-doc-gen" configure flag will enable HTML document generation that requires mdbook.
+We can't simply disable it because we need manpages.
+
+Author: Zhu Zihao <all_but_last@163.com>
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index e43d9f2fb..c323d1847 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -69,8 +69,6 @@ $(d)/builtins.json: $(bindir)/nix
+ 	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-# Generate the HTML manual.
+-install: $(docdir)/manual/index.html
+ 
+ # Generate 'nix' manpages.
+ install: $(mandir)/man1/nix3-manpages
+@@ -94,7 +92,5 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
+ 	done
+ 	@touch $@
+ 
+-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(call rwildcard, $(d)/src, *.md)
+-	$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
+ 
+ endif
-- 
2.33.1


[-- Attachment #5: Type: text/plain, Size: 100 bytes --]


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#51747] Acknowledgement ([PATCH]: gnu: nix: Update to 2.4. )
       [not found] ` <handler.51747.B.16365478179399.ack@debbugs.gnu.org>
@ 2021-11-10 13:53   ` Zhu Zihao
  2021-11-10 15:47     ` Zhu Zihao
  0 siblings, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2021-11-10 13:53 UTC (permalink / raw)
  To: 51747


[-- Attachment #1.1: Type: text/plain, Size: 14 bytes --]


little fix.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Attachment #2: 0001-gnu-Add-lowdown.patch --]
[-- Type: text/x-patch, Size: 2604 bytes --]

From 073f513e233470da443b8ee71350e546110fd953 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 19:21:45 +0800
Subject: [PATCH 1/3] gnu: Add lowdown.

* gnu/packages/markup.scm (lowdown): New variable.
---
 gnu/packages/markup.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 368976bfde..35a4513432 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 EuAndreh <eu@euandre.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
+;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -36,6 +37,7 @@ (define-module (gnu packages markup)
   #:use-module (guix utils)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -324,3 +326,35 @@ (define-public python-mistletoe
 swap out renderers for different output formats, without touching any of the
 core components.")
     (license expat)))
+
+(define-public lowdown
+  (package
+    (name "lowdown")
+    (version "0.10.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://kristaps.bsd.lv/lowdown/snapshots/lowdown-"
+                           version ".tar.gz"))
+       (sha256
+        (base32 "15v2kk4ffqw3n6y6n9plch4qcib3ynnhw0ih8wn2v9qgn4jssp5p"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ;no test
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (invoke "./configure"
+                       (string-append "PREFIX=" out)
+                       (string-append "MANDIR=" out "/share/man"))))))
+       ;; The shared library of nix is linked with lowdown's static archive.
+       #:make-flags '("CFLAGS=-fPIC")))
+    (native-inputs
+     `(("which" ,which)))
+    (home-page "https://kristaps.bsd.lv/lowdown")
+    (synopsis "Simple Markdown translator")
+    (description "Lowdown is a Markdown translator producing HTML5,
+roff documents in the ms and man formats, LaTeX, gemini, and terminal output.")
+    (license isc)))
-- 
2.33.1


[-- Attachment #3: 0002-gnu-Add-libcpuid.patch --]
[-- Type: text/x-patch, Size: 1823 bytes --]

From dcc74bc2cd71b84530bcba8353294c4851eab714 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 19:31:28 +0800
Subject: [PATCH 2/3] gnu: Add libcpuid.

gnu/packages/hardware.scm (libcpuid): New variable.
---
 gnu/packages/hardware.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 2bf3576d5a..fd7de013ef 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -834,3 +835,22 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public libcpuid
+  (package
+    (name "libcpuid")
+    (version "0.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/anrieff/libcpuid/releases/download/v"
+                           version "/libcpuid-" version ".tar.gz"))
+       (sha256
+        (base32 "1nksdqk2w1c56lkrjcvh3nss9vq454j81j3yq14lwdn4x8bvmwfr"))))
+    (build-system gnu-build-system)
+    (supported-systems '("x86_64-linux" "i686-linux"))
+    (home-page "https://libcpuid.sourceforge.net/")
+    (synopsis "Small library for x86 CPU detection and feature extraction")
+    (description "Libcpuid is a small C library to get vendor, model, branding
+string, code name and other information from x86 CPU.")
+    (license license:bsd-2)))
-- 
2.33.1


[-- Attachment #4: 0003-gnu-nix-Update-to-2.4.patch --]
[-- Type: text/x-patch, Size: 7177 bytes --]

From 84799f061205f8e0627a2a553f113b6c85af6021 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 19:36:01 +0800
Subject: [PATCH 3/3] gnu: nix: Update to 2.4.

* gnu/packages/package-management.scm (nix): Update to 2.4.

[source]: Switch to Github repository since upstream no longer provides
tarball.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, flex, gcc,
googletest, jq, libtool
[inputs]: Add libarchive, libcpuid, lowdown, zlib.

* gnu/packages/patches/nix-dont-build-html-doc.diff: New file.
* gnu/local.mk(dist_patch_DATA): Add corresponding entry.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/package-management.scm           | 67 +++++++++++++------
 .../patches/nix-dont-build-html-doc.diff      | 26 +++++++
 3 files changed, 74 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/nix-dont-build-html-doc.diff

diff --git a/gnu/local.mk b/gnu/local.mk
index 3a849ed2b0..28c01a02ca 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1529,6 +1529,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch	\
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch	\
+  %D%/packages/patches/nix-dont-build-html-doc.diff		\
   %D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch	\
   %D%/packages/patches/ngircd-handle-zombies.patch		\
   %D%/packages/patches/ngless-unliftio.patch		\
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 3c9d4da941..f45d09db78 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -19,6 +19,7 @@
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -60,6 +61,8 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -68,12 +71,14 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
+  #:use-module (gnu packages hardware)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages less)
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
@@ -596,14 +601,18 @@ (define-public current-guix
 (define-public nix
   (package
     (name "nix")
-    (version "2.3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "https://releases.nixos.org/nix/nix-"
-                                 version "/nix-" version ".tar.xz"))
-             (sha256
-              (base32
-               "1g5aqavr6i3c1xln53w1pdh1kvlxrpnknb105m4jbd85kyv83rky"))))
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "http://github.com/NixOS/nix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+       (patches
+        (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
@@ -619,18 +628,36 @@ (define-public nix
                       (string-append "sysconfdir=" etc)
                       (string-append "profiledir=" etc "/profile.d")
                       make-flags)))))))
-    (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("boost" ,boost)
-              ("brotli" ,brotli)
-              ("bzip2" ,bzip2)
-              ("curl" ,curl)
-              ("editline" ,editline)
-              ("libgc" ,libgc)
-              ("libseccomp" ,libseccomp)
-              ("libsodium" ,libsodium)
-              ("openssl" ,openssl)
-              ("sqlite" ,sqlite)
-              ("xz" ,xz)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("bison" ,bison)
+       ("flex" ,flex)
+       ("gcc" ,gcc-9)                   ;non-trivial designated initializers
+       ("googletest" ,googletest)
+       ("jq" ,jq)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("boost" ,boost)
+       ("brotli" ,brotli)
+       ("bzip2" ,bzip2)
+       ("curl" ,curl)
+       ("editline" ,editline)
+       ("libarchive" ,libarchive)
+       ,@(if (string-prefix? "x86_64" (or (%current-target-system)
+                                          (%current-system)))
+             `(("libcpuid" ,libcpuid))
+             '())
+       ("libgc" ,libgc)
+       ("libseccomp" ,libseccomp)
+       ("libsodium" ,libsodium)
+       ("lowdown" ,lowdown)
+       ("openssl" ,openssl)
+       ("sqlite" ,sqlite)
+       ("xz" ,xz)
+       ("zlib" ,zlib)))
     (home-page "https://nixos.org/nix/")
     (synopsis "The Nix package manager")
     (description
diff --git a/gnu/packages/patches/nix-dont-build-html-doc.diff b/gnu/packages/patches/nix-dont-build-html-doc.diff
new file mode 100644
index 0000000000..79142bc215
--- /dev/null
+++ b/gnu/packages/patches/nix-dont-build-html-doc.diff
@@ -0,0 +1,26 @@
+"--enable-doc-gen" configure flag will enable HTML document generation that requires mdbook.
+We can't simply disable it because we need manpages.
+
+Author: Zhu Zihao <all_but_last@163.com>
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index e43d9f2fb..c323d1847 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -69,8 +69,6 @@ $(d)/builtins.json: $(bindir)/nix
+ 	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-# Generate the HTML manual.
+-install: $(docdir)/manual/index.html
+ 
+ # Generate 'nix' manpages.
+ install: $(mandir)/man1/nix3-manpages
+@@ -94,7 +92,5 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
+ 	done
+ 	@touch $@
+ 
+-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(call rwildcard, $(d)/src, *.md)
+-	$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
+ 
+ endif
-- 
2.33.1


[-- Attachment #5: Type: text/plain, Size: 100 bytes --]


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#51747] Acknowledgement ([PATCH]: gnu: nix: Update to 2.4. )
  2021-11-10 13:53   ` [bug#51747] Acknowledgement ([PATCH]: gnu: nix: Update to 2.4. ) Zhu Zihao
@ 2021-11-10 15:47     ` Zhu Zihao
  2021-11-17 11:21       ` Zhu Zihao
  0 siblings, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2021-11-10 15:47 UTC (permalink / raw)
  To: 51747


[-- Attachment #1.1: Type: text/plain, Size: 95 bytes --]


My local source repo is not up-to-date :(, Update to resolve the
conflict with newest master.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-lowdown-Generate-position-independent-code.patch --]
[-- Type: text/x-patch, Size: 1101 bytes --]

From 369b3cc29ac306d3b2ff9df38163be6d31b0b12b Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 23:36:20 +0800
Subject: [PATCH 1/3] gnu: lowdown: Generate position-independent code.

* gnu/packages/markup.scm (lowdown)[arguments]<make-flags>: Use -fPIC.
---
 gnu/packages/markup.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 06e653a1c9..474b5343e9 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -138,7 +138,9 @@ (define-public lowdown
              (let ((out (assoc-ref outputs "out")))
                (invoke "./configure"
                        (string-append "PREFIX=" out)
-                       (string-append "MANDIR=" out "/share/man"))))))))
+                       (string-append "MANDIR=" out "/share/man"))))))
+       ;; The shared library of Nix is linked with lowdown's static archive.
+       #:make-flags '("CFLAGS=-fPIC")))
     (native-inputs
      `(("which" ,which)))
     (home-page "https://kristaps.bsd.lv/lowdown/")
-- 
2.33.1


[-- Attachment #3: 0002-gnu-Add-libcpuid.patch --]
[-- Type: text/x-patch, Size: 1825 bytes --]

From 032740ed0e85dc20f49133358b1206c4a56efcec Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 23:37:24 +0800
Subject: [PATCH 2/3] gnu: Add libcpuid.

* gnu/packages/hardware.scm (libcpuid): New variable.
---
 gnu/packages/hardware.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 2bf3576d5a..fd7de013ef 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -834,3 +835,22 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public libcpuid
+  (package
+    (name "libcpuid")
+    (version "0.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/anrieff/libcpuid/releases/download/v"
+                           version "/libcpuid-" version ".tar.gz"))
+       (sha256
+        (base32 "1nksdqk2w1c56lkrjcvh3nss9vq454j81j3yq14lwdn4x8bvmwfr"))))
+    (build-system gnu-build-system)
+    (supported-systems '("x86_64-linux" "i686-linux"))
+    (home-page "https://libcpuid.sourceforge.net/")
+    (synopsis "Small library for x86 CPU detection and feature extraction")
+    (description "Libcpuid is a small C library to get vendor, model, branding
+string, code name and other information from x86 CPU.")
+    (license license:bsd-2)))
-- 
2.33.1


[-- Attachment #4: 0003-gnu-nix-Update-to-2.4.patch --]
[-- Type: text/x-patch, Size: 7177 bytes --]

From a41118f1b3ddc3d26036f84161a91accd9d98968 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 10 Nov 2021 23:37:53 +0800
Subject: [PATCH 3/3] gnu: nix: Update to 2.4.

* gnu/packages/package-management.scm (nix): Update to 2.4.

[source]: Switch to Github repository since upstream no longer provides
tarball.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, flex, gcc,
googletest, jq, libtool
[inputs]: Add libarchive, libcpuid, lowdown, zlib.

* gnu/packages/patches/nix-dont-build-html-doc.diff: New file.
* gnu/local.mk(dist_patch_DATA): Add corresponding entry.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/package-management.scm           | 67 +++++++++++++------
 .../patches/nix-dont-build-html-doc.diff      | 26 +++++++
 3 files changed, 74 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/nix-dont-build-html-doc.diff

diff --git a/gnu/local.mk b/gnu/local.mk
index 05258ac054..c32d2ba297 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1527,6 +1527,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch	\
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch	\
+  %D%/packages/patches/nix-dont-build-html-doc.diff		\
   %D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch	\
   %D%/packages/patches/ngircd-handle-zombies.patch		\
   %D%/packages/patches/ngless-unliftio.patch		\
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 12c689e9e2..a30eea4d62 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -19,6 +19,7 @@
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -60,6 +61,8 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -68,12 +71,14 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
+  #:use-module (gnu packages hardware)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages less)
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
@@ -593,14 +598,18 @@ (define-public current-guix
 (define-public nix
   (package
     (name "nix")
-    (version "2.3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "https://releases.nixos.org/nix/nix-"
-                                 version "/nix-" version ".tar.xz"))
-             (sha256
-              (base32
-               "1g5aqavr6i3c1xln53w1pdh1kvlxrpnknb105m4jbd85kyv83rky"))))
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "http://github.com/NixOS/nix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+       (patches
+        (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
@@ -616,18 +625,36 @@ (define-public nix
                       (string-append "sysconfdir=" etc)
                       (string-append "profiledir=" etc "/profile.d")
                       make-flags)))))))
-    (native-inputs `(("pkg-config" ,pkg-config)))
-    (inputs `(("boost" ,boost)
-              ("brotli" ,brotli)
-              ("bzip2" ,bzip2)
-              ("curl" ,curl)
-              ("editline" ,editline)
-              ("libgc" ,libgc)
-              ("libseccomp" ,libseccomp)
-              ("libsodium" ,libsodium)
-              ("openssl" ,openssl)
-              ("sqlite" ,sqlite)
-              ("xz" ,xz)))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("autoconf-archive" ,autoconf-archive)
+       ("automake" ,automake)
+       ("bison" ,bison)
+       ("flex" ,flex)
+       ("gcc" ,gcc-9)                   ;non-trivial designated initializers
+       ("googletest" ,googletest)
+       ("jq" ,jq)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("boost" ,boost)
+       ("brotli" ,brotli)
+       ("bzip2" ,bzip2)
+       ("curl" ,curl)
+       ("editline" ,editline)
+       ("libarchive" ,libarchive)
+       ,@(if (string-prefix? "x86_64" (or (%current-target-system)
+                                          (%current-system)))
+             `(("libcpuid" ,libcpuid))
+             '())
+       ("libgc" ,libgc)
+       ("libseccomp" ,libseccomp)
+       ("libsodium" ,libsodium)
+       ("lowdown" ,lowdown)
+       ("openssl" ,openssl)
+       ("sqlite" ,sqlite)
+       ("xz" ,xz)
+       ("zlib" ,zlib)))
     (home-page "https://nixos.org/nix/")
     (synopsis "The Nix package manager")
     (description
diff --git a/gnu/packages/patches/nix-dont-build-html-doc.diff b/gnu/packages/patches/nix-dont-build-html-doc.diff
new file mode 100644
index 0000000000..79142bc215
--- /dev/null
+++ b/gnu/packages/patches/nix-dont-build-html-doc.diff
@@ -0,0 +1,26 @@
+"--enable-doc-gen" configure flag will enable HTML document generation that requires mdbook.
+We can't simply disable it because we need manpages.
+
+Author: Zhu Zihao <all_but_last@163.com>
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index e43d9f2fb..c323d1847 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -69,8 +69,6 @@ $(d)/builtins.json: $(bindir)/nix
+ 	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-# Generate the HTML manual.
+-install: $(docdir)/manual/index.html
+ 
+ # Generate 'nix' manpages.
+ install: $(mandir)/man1/nix3-manpages
+@@ -94,7 +92,5 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
+ 	done
+ 	@touch $@
+ 
+-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(call rwildcard, $(d)/src, *.md)
+-	$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
+ 
+ endif
-- 
2.33.1


[-- Attachment #5: Type: text/plain, Size: 100 bytes --]


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#51747] Acknowledgement ([PATCH]: gnu: nix: Update to 2.4. )
  2021-11-10 15:47     ` Zhu Zihao
@ 2021-11-17 11:21       ` Zhu Zihao
  2021-12-04 15:28         ` Zhu Zihao
  0 siblings, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2021-11-17 11:21 UTC (permalink / raw)
  To: 51747

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]


ping.
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] Acknowledgement ([PATCH]: gnu: nix: Update to 2.4. )
  2021-11-17 11:21       ` Zhu Zihao
@ 2021-12-04 15:28         ` Zhu Zihao
  2022-01-11  8:23           ` [bug#51747] [PATCH]: gnu: nix: Update to 2.4 Oleg Pykhalov
  0 siblings, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2021-12-04 15:28 UTC (permalink / raw)
  To: 51747

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]


Ping again.

I know you guys are hard working on core-updates-frozen branch. But I
can't see a deadline for merging it into master.

Does it really worth abandoning non-trivial patches for master branch? IDK....

Zhu Zihao <all_but_last@163.com> writes:

> [[PGP Signed Part:Undecided]]
>
> ping.


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2021-12-04 15:28         ` Zhu Zihao
@ 2022-01-11  8:23           ` Oleg Pykhalov
  2022-01-11  9:46             ` Zhu Zihao
                               ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Oleg Pykhalov @ 2022-01-11  8:23 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 51747


[-- Attachment #1.1: Type: text/plain, Size: 522 bytes --]

Hi, apologies for the slow response.

Zhu Zihao <all_but_last@163.com> writes:

> Ping again.
>
> I know you guys are hard working on core-updates-frozen branch. But I
> can't see a deadline for merging it into master.
>
> Does it really worth abandoning non-trivial patches for master branch? IDK....

I tried to apply patches, but it does not build on the current
origin/master 537f4a1ef1cc385526b0662b2a9a1754319e1020

Updated patches on 537f4a1e and build log attached.

If you know what's the issue, please respond.


[-- Attachment #1.2: 0001-gnu-Add-libcpuid.patch --]
[-- Type: text/x-patch, Size: 1839 bytes --]

From 3ec635be703c947b0b031eb79136037d07eeedd1 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 10:07:17 +0300
Subject: [PATCH 1/2] gnu: Add libcpuid.

* gnu/packages/hardware.scm (libcpuid): New variable.
---
 gnu/packages/hardware.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 8727f0f20a..a2708e6b90 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2021, 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -953,3 +954,22 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public libcpuid
+  (package
+    (name "libcpuid")
+    (version "0.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/anrieff/libcpuid/releases/download/v"
+                           version "/libcpuid-" version ".tar.gz"))
+       (sha256
+        (base32 "1nksdqk2w1c56lkrjcvh3nss9vq454j81j3yq14lwdn4x8bvmwfr"))))
+    (build-system gnu-build-system)
+    (supported-systems '("x86_64-linux" "i686-linux"))
+    (home-page "https://libcpuid.sourceforge.net/")
+    (synopsis "Small library for x86 CPU detection and feature extraction")
+    (description "Libcpuid is a small C library to get vendor, model, branding
+string, code name and other information from x86 CPU.")
+    (license license:bsd-2)))
-- 
2.34.0


[-- Attachment #1.3: 0002-gnu-nix-Update-to-2.4.patch --]
[-- Type: text/x-patch, Size: 7527 bytes --]

From 00cc1e637a8b3a5a4b508673733c94b9f2bdcb40 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust@gmail.com>
Date: Tue, 11 Jan 2022 10:25:09 +0300
Subject: [PATCH 2/2] gnu: nix: Update to 2.4.

* gnu/packages/package-management.scm (nix): Update to 2.4.
[source]: Switch to Github repository since upstream no longer provides
tarball.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, flex, gcc,
googletest, jq, libtool.
[inputs]: Add libarchive, libcpuid, lowdown, zlib.
* gnu/packages/patches/nix-dont-build-html-doc.patch: New file.
* gnu/local.mk(dist_patch_DATA): Add corresponding entry.
---
 gnu/local.mk                                  |  2 +
 gnu/packages/package-management.scm           | 66 +++++++++++++------
 .../patches/nix-dont-build-html-doc.patch     | 26 ++++++++
 3 files changed, 74 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/nix-dont-build-html-doc.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d5e19adea6..95c0e34e57 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -47,6 +47,7 @@
 # Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz>
 # Copyright © 2021 Andrew Tropin <andrew@trop.in>
 # Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+# Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 #
 # This file is part of GNU Guix.
 #
@@ -1511,6 +1512,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch	\
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch	\
+  %D%/packages/patches/nix-dont-build-html-doc.patch		\
   %D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch	\
   %D%/packages/patches/ngircd-handle-zombies.patch		\
   %D%/packages/patches/ngless-unliftio.patch		\
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 265763cc74..4b41c01dff 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,8 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -70,6 +73,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
+  #:use-module (gnu packages hardware)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages less)
@@ -77,6 +81,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
@@ -657,14 +662,18 @@ (define-public guix-icons
 (define-public nix
   (package
     (name "nix")
-    (version "2.3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "https://releases.nixos.org/nix/nix-"
-                                 version "/nix-" version ".tar.xz"))
-             (sha256
-              (base32
-               "1g5aqavr6i3c1xln53w1pdh1kvlxrpnknb105m4jbd85kyv83rky"))))
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "http://github.com/NixOS/nix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+       (patches
+        (search-patches "nix-dont-build-html-doc.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
@@ -680,18 +689,35 @@ (define-public nix
                       (string-append "sysconfdir=" etc)
                       (string-append "profiledir=" etc "/profile.d")
                       make-flags)))))))
-    (native-inputs (list pkg-config))
-    (inputs (list boost
-                  brotli
-                  bzip2
-                  curl
-                  editline
-                  libgc
-                  libseccomp
-                  libsodium
-                  openssl
-                  sqlite
-                  xz))
+    (native-inputs (list autoconf
+                         autoconf-archive
+                         automake
+                         bison
+                         flex
+                         gcc-9 ;non-trivial designated initializers
+                         googletest
+                         jq
+                         libtool
+                         pkg-config))
+    (inputs (append
+                (list boost
+                      brotli
+                      bzip2
+                      curl
+                      editline
+                      libarchive
+                      libgc
+                      libseccomp
+                      libsodium
+                      lowdown
+                      openssl
+                      sqlite
+                      xz
+                      zlib)
+                (if (string-prefix? "x86_64" (or (%current-target-system)
+                                                 (%current-system)))
+                    (list libcpuid)
+                    '())))
     (home-page "https://nixos.org/nix/")
     (synopsis "The Nix package manager")
     (description
diff --git a/gnu/packages/patches/nix-dont-build-html-doc.patch b/gnu/packages/patches/nix-dont-build-html-doc.patch
new file mode 100644
index 0000000000..79142bc215
--- /dev/null
+++ b/gnu/packages/patches/nix-dont-build-html-doc.patch
@@ -0,0 +1,26 @@
+"--enable-doc-gen" configure flag will enable HTML document generation that requires mdbook.
+We can't simply disable it because we need manpages.
+
+Author: Zhu Zihao <all_but_last@163.com>
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index e43d9f2fb..c323d1847 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -69,8 +69,6 @@ $(d)/builtins.json: $(bindir)/nix
+ 	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-# Generate the HTML manual.
+-install: $(docdir)/manual/index.html
+ 
+ # Generate 'nix' manpages.
+ install: $(mandir)/man1/nix3-manpages
+@@ -94,7 +92,5 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
+ 	done
+ 	@touch $@
+ 
+-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(call rwildcard, $(d)/src, *.md)
+-	$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
+ 
+ endif
-- 
2.34.0


[-- Attachment #1.4: y9ipph0dhrbvliwacg8jl01j63c4r2-nix-2.4.drv.bz2 --]
[-- Type: application/octet-stream, Size: 14322 bytes --]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-11  8:23           ` [bug#51747] [PATCH]: gnu: nix: Update to 2.4 Oleg Pykhalov
@ 2022-01-11  9:46             ` Zhu Zihao
  2022-01-11 17:19             ` Zhu Zihao
  2022-01-14  9:31             ` Zhu Zihao
  2 siblings, 0 replies; 27+ messages in thread
From: Zhu Zihao @ 2022-01-11  9:46 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 51747

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]


Oleg Pykhalov <go.wigust@gmail.com> writes:

> [[PGP Signed Part:Undecided]]
> Hi, apologies for the slow response.

Thanks for your review!

The problem is lowdown only provides a static archive.(compile without
-fPIC). But nix tries to link with it. I see the build system of Lowdown
on master now produce a shared library. But I haven't check whether they
have a new release now.

Anyway, I' ll update these patches later, move these code to label-less
style and fix the compile error.

-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-11  8:23           ` [bug#51747] [PATCH]: gnu: nix: Update to 2.4 Oleg Pykhalov
  2022-01-11  9:46             ` Zhu Zihao
@ 2022-01-11 17:19             ` Zhu Zihao
  2022-01-11 19:04               ` Maxime Devos
  2022-01-11 19:05               ` Maxime Devos
  2022-01-14  9:31             ` Zhu Zihao
  2 siblings, 2 replies; 27+ messages in thread
From: Zhu Zihao @ 2022-01-11 17:19 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 51747


[-- Attachment #1.1: Type: text/plain, Size: 19 bytes --]


Patches updated.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Attachment #2: 0001-gnu-Add-libcpuid.patch --]
[-- Type: text/x-patch, Size: 1839 bytes --]

From 71bb95c5d9e446ecb7e395f21e6677bcba5c11e9 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 22:56:14 +0800
Subject: [PATCH 1/5] gnu: Add libcpuid.

* gnu/packages/hardware.scm (libcpuid): New variable.
---
 gnu/packages/hardware.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 8727f0f20a..a2708e6b90 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2021, 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -953,3 +954,22 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public libcpuid
+  (package
+    (name "libcpuid")
+    (version "0.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/anrieff/libcpuid/releases/download/v"
+                           version "/libcpuid-" version ".tar.gz"))
+       (sha256
+        (base32 "1nksdqk2w1c56lkrjcvh3nss9vq454j81j3yq14lwdn4x8bvmwfr"))))
+    (build-system gnu-build-system)
+    (supported-systems '("x86_64-linux" "i686-linux"))
+    (home-page "https://libcpuid.sourceforge.net/")
+    (synopsis "Small library for x86 CPU detection and feature extraction")
+    (description "Libcpuid is a small C library to get vendor, model, branding
+string, code name and other information from x86 CPU.")
+    (license license:bsd-2)))
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-lowdown-Update-to-0.10.0-1-1de10c1.patch --]
[-- Type: text/x-patch, Size: 3137 bytes --]

From 0455cf022615c356eea487876b318774820270a7 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 23:01:38 +0800
Subject: [PATCH 2/5] gnu: lowdown: Update to 0.10.0-1-1de10c1.

* gnu/packages/markup.scm (lowdown): Update to 0.10.0-1-1de10c1.
---
 gnu/packages/markup.scm | 60 ++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 27 deletions(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 5f2f525cd2..563ad1e8e1 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -119,34 +119,40 @@ (define-public markdown
                                    "See License.text in the distribution."))))
 
 (define-public lowdown
-  (package
-    (name "lowdown")
-    (version "0.10.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://kristaps.bsd.lv/lowdown/snapshots/lowdown-"
-                           version ".tar.gz"))
-       (sha256
-        (base32 "15v2kk4ffqw3n6y6n9plch4qcib3ynnhw0ih8wn2v9qgn4jssp5p"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:test-target "regress"
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (invoke "./configure"
-                       (string-append "PREFIX=" out)
-                       (string-append "MANDIR=" out "/share/man"))))))))
-    (native-inputs
-     (list which))
-    (home-page "https://kristaps.bsd.lv/lowdown/")
-    (synopsis "Simple Markdown translator")
-    (description "Lowdown is a Markdown translator producing HTML5,
+  (let ((commit "1de10c1d71bfb4348ae0beaec8b1547d5e114969")
+        (revision "1"))
+    (package
+      (name "lowdown")
+      (version (git-version "0.10.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/kristapsdz/lowdown")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:test-target "regress"
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (invoke "./configure"
+                         (string-append "PREFIX=" out)
+                         (string-append "MANDIR=" out "/share/man"))))))
+         #:make-flags '("CFLAGS=-fPIC"))))
+
+      (native-inputs
+       (list which))
+      (home-page "https://kristaps.bsd.lv/lowdown/")
+      (synopsis "Simple Markdown translator")
+      (description "Lowdown is a Markdown translator producing HTML5,
 roff documents in the ms and man formats, LaTeX, gemini, and terminal output.")
-    (license license:isc)))
+      (license license:isc))))
 
 (define-public discount
   (package
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-lowdown-Use-G-expression.patch --]
[-- Type: text/x-patch, Size: 1997 bytes --]

From a62fb3b6a1b27ab0242ee61b6decba37959b008c Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:52:25 +0800
Subject: [PATCH 3/5] gnu: lowdown: Use G-expression.

* gnu/packages/markup.scm(lowdown)[arguments]: Convert to G-expression.
---
 gnu/packages/markup.scm | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 563ad1e8e1..7a776b9101 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -29,6 +29,7 @@ (define-module (gnu packages markup)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
@@ -135,17 +136,16 @@ (define-public lowdown
           (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
       (build-system gnu-build-system)
       (arguments
-       `(#:test-target "regress"
-         #:phases
-         (modify-phases %standard-phases
-           (replace 'configure
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (invoke "./configure"
-                         (string-append "PREFIX=" out)
-                         (string-append "MANDIR=" out "/share/man"))))))
-         #:make-flags '("CFLAGS=-fPIC"))))
-
+       (list
+        #:test-target "regress"
+        #:phases
+        #~(modify-phases %standard-phases
+            (replace 'configure
+              (lambda _
+                (invoke "./configure"
+                        (string-append "PREFIX=" #$output)
+                        (string-append "MANDIR=" #$output "/share/man")))))
+        #:make-flags #~(list "CFLAGS=-fPIC")))
       (native-inputs
        (list which))
       (home-page "https://kristaps.bsd.lv/lowdown/")
-- 
2.34.0


[-- Attachment #5: 0004-gnu-nix-Update-to-2.4.patch --]
[-- Type: text/x-patch, Size: 6925 bytes --]

From 048c1a0fbc42d9aeb06e7f8b7f2b0d9fcbcb1e59 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 23:10:01 +0800
Subject: [PATCH 4/5] gnu: nix: Update to 2.4.

* gnu/packages/package-management.scm (nix): Update to 2.4.

[source]: Switch to Github repository since upstream no longer provides
tarball.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, flex, gcc,
googletest, jq, libtool.
[inputs]: Add libarchive, libcpuid, lowdown, zlib.

* gnu/packages/patches/nix-dont-build-html-doc.diff: New file.
* gnu/local.mk(dist_patch_DATA): Add corresponding entry.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/package-management.scm           | 66 +++++++++++++------
 .../patches/nix-dont-build-html-doc.diff      | 26 ++++++++
 3 files changed, 73 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/nix-dont-build-html-doc.diff

diff --git a/gnu/local.mk b/gnu/local.mk
index feadac4bad..9284212f01 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1515,6 +1515,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch	\
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch	\
+  %D%/packages/patches/nix-dont-build-html-doc.diff		\
   %D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch	\
   %D%/packages/patches/ngircd-handle-zombies.patch		\
   %D%/packages/patches/ngless-unliftio.patch		\
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 8a4f5155ed..03f741dc2c 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,8 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -70,6 +73,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
+  #:use-module (gnu packages hardware)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages less)
@@ -77,6 +81,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
@@ -657,14 +662,18 @@ (define-public guix-icons
 (define-public nix
   (package
     (name "nix")
-    (version "2.3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "https://releases.nixos.org/nix/nix-"
-                                 version "/nix-" version ".tar.xz"))
-             (sha256
-              (base32
-               "1g5aqavr6i3c1xln53w1pdh1kvlxrpnknb105m4jbd85kyv83rky"))))
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "http://github.com/NixOS/nix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+       (patches
+        (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
@@ -680,18 +689,35 @@ (define-public nix
                       (string-append "sysconfdir=" etc)
                       (string-append "profiledir=" etc "/profile.d")
                       make-flags)))))))
-    (native-inputs (list pkg-config))
-    (inputs (list boost
-                  brotli
-                  bzip2
-                  curl
-                  editline
-                  libgc
-                  libseccomp
-                  libsodium
-                  openssl
-                  sqlite
-                  xz))
+    (native-inputs
+     (list autoconf
+           autoconf-archive
+           automake
+           bison
+           flex
+           googletest
+           jq
+           libtool
+           pkg-config))
+    (inputs
+     (append (list boost
+                   brotli
+                   bzip2
+                   curl
+                   editline
+                   libarchive
+                   libgc
+                   libseccomp
+                   libsodium
+                   lowdown
+                   openssl
+                   sqlite
+                   xz
+                   zlib)
+             (if (or (target-x86-64?)
+                     (target-x86-32?))
+                 (list libcpuid)
+                 '())))
     (home-page "https://nixos.org/nix/")
     (synopsis "The Nix package manager")
     (description
diff --git a/gnu/packages/patches/nix-dont-build-html-doc.diff b/gnu/packages/patches/nix-dont-build-html-doc.diff
new file mode 100644
index 0000000000..79142bc215
--- /dev/null
+++ b/gnu/packages/patches/nix-dont-build-html-doc.diff
@@ -0,0 +1,26 @@
+"--enable-doc-gen" configure flag will enable HTML document generation that requires mdbook.
+We can't simply disable it because we need manpages.
+
+Author: Zhu Zihao <all_but_last@163.com>
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index e43d9f2fb..c323d1847 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -69,8 +69,6 @@ $(d)/builtins.json: $(bindir)/nix
+ 	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-# Generate the HTML manual.
+-install: $(docdir)/manual/index.html
+ 
+ # Generate 'nix' manpages.
+ install: $(mandir)/man1/nix3-manpages
+@@ -94,7 +92,5 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
+ 	done
+ 	@touch $@
+ 
+-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(call rwildcard, $(d)/src, *.md)
+-	$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
+ 
+ endif
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-nix-Use-G-expression.patch --]
[-- Type: text/x-patch, Size: 2156 bytes --]

From e442322866f6edd625ada09573afb7bff51f269e Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:42:32 +0800
Subject: [PATCH 5/5] gnu: nix: Use G-expression.

* gnu/packages/package-management.scm (nix)[arguments]: Convert to G-expression.
---
 gnu/packages/package-management.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 03f741dc2c..594d6e9d4b 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -676,19 +676,19 @@ (define-public nix
         (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'install
-           ;; Don't try & fail to create subdirectories in /etc, but keep them
-           ;; in the output as examples.
-           (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (etc (string-append out "/etc")))
-               (apply invoke "make" "install"
-                      (string-append "sysconfdir=" etc)
-                      (string-append "profiledir=" etc "/profile.d")
-                      make-flags)))))))
+     (list
+      #:configure-flags #~(list "--sysconfdir=/etc" "--enable-gc")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            ;; Don't try & fail to create subdirectories in /etc, but keep them
+            ;; in the output as examples.
+            (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
+              (let ((etc (string-append #$output "/etc")))
+                (apply invoke "make" "install"
+                       (string-append "sysconfdir=" etc)
+                       (string-append "profiledir=" etc "/profile.d")
+                       make-flags)))))))
     (native-inputs
      (list autoconf
            autoconf-archive
-- 
2.34.0


[-- Attachment #7: Type: text/plain, Size: 100 bytes --]


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-11 17:19             ` Zhu Zihao
@ 2022-01-11 19:04               ` Maxime Devos
  2022-01-12  4:21                 ` Zhu Zihao
  2022-01-13  4:54                 ` Zhu Zihao
  2022-01-11 19:05               ` Maxime Devos
  1 sibling, 2 replies; 27+ messages in thread
From: Maxime Devos @ 2022-01-11 19:04 UTC (permalink / raw)
  To: Zhu Zihao, Oleg Pykhalov; +Cc: 51747

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

Zhu Zihao schreef op wo 12-01-2022 om 01:19 [+0800]:
> +    (name "libcpuid") [...]
> +    (supported-systems '("x86_64-linux" "i686-linux"))

Given that 'cpuid' is a CPU instruction, I don't think
this is Linux-specific; presumably it works on the Hurd
as well.  According to the README, it also supports some BSDs,
Mac OS and Windows!

Could you change it to

(filter (lambda (t) (or (x86-64-target? t) (or (x86-32-target? t))))
        %supported-systems)

instead (untested)?

Also, the source code contains a blob
<https://github.com/anrieff/libcpuid/blob/master/libcpuid/msrdriver.c>,
could you remove it in an origin snippet?

There might be more blobs, I didn't look at all files.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-11 17:19             ` Zhu Zihao
  2022-01-11 19:04               ` Maxime Devos
@ 2022-01-11 19:05               ` Maxime Devos
  1 sibling, 0 replies; 27+ messages in thread
From: Maxime Devos @ 2022-01-11 19:05 UTC (permalink / raw)
  To: Zhu Zihao, Oleg Pykhalov; +Cc: 51747

[-- Attachment #1: Type: text/plain, Size: 92 bytes --]

Another two blobs:

<https://github.com/anrieff/libcpuid/blob/master/contrib/MSR Driver>

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-11 19:04               ` Maxime Devos
@ 2022-01-12  4:21                 ` Zhu Zihao
  2022-01-12  5:19                   ` Oleg Pykhalov
  2022-01-12  8:26                   ` Maxime Devos
  2022-01-13  4:54                 ` Zhu Zihao
  1 sibling, 2 replies; 27+ messages in thread
From: Zhu Zihao @ 2022-01-12  4:21 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Oleg Pykhalov, 51747

[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]


Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:Undecided]]
> Zhu Zihao schreef op wo 12-01-2022 om 01:19 [+0800]:
>> +    (name "libcpuid") [...]
>> +    (supported-systems '("x86_64-linux" "i686-linux"))
>
> Given that 'cpuid' is a CPU instruction, I don't think
> this is Linux-specific; presumably it works on the Hurd
> as well.  According to the README, it also supports some BSDs,
> Mac OS and Windows!
>
> Could you change it to
>
> (filter (lambda (t) (or (x86-64-target? t) (or (x86-32-target? t))))
>         %supported-systems)
>
> instead (untested)?
>
> Also, the source code contains a blob
> <https://github.com/anrieff/libcpuid/blob/master/libcpuid/msrdriver.c>,
> could you remove it in an origin snippet?
>
> There might be more blobs, I didn't look at all files.
>
> Greetings,
> Maxime.
>
> [[End of PGP Signed Part]]

Interesting, It looks that these blobs are for Windows system. I don't
care about MS Windows, but blobs are tightly integrated in the source.

The source reports that they're compiled from the source in contrib/MSR
Driver/Kernel. They're PE COFF format, If we want to compile it ourself,
we have to use mingw cross compiler. This increase the complexity of
build script.

AFAIK, nix use libcpuid only in linux context. My idea is replace these
blobs with empty bytes. Maybe leave a note for who want mingw cross build. 

-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-12  4:21                 ` Zhu Zihao
@ 2022-01-12  5:19                   ` Oleg Pykhalov
  2022-01-12  7:08                     ` Zhu Zihao
  2022-01-12  8:26                   ` Maxime Devos
  1 sibling, 1 reply; 27+ messages in thread
From: Oleg Pykhalov @ 2022-01-12  5:19 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 51747, Maxime Devos

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

Zhu Zihao <all_but_last@163.com> writes:

[…]

> Interesting, It looks that these blobs are for Windows system. I don't
> care about MS Windows, but blobs are tightly integrated in the source.
>
> The source reports that they're compiled from the source in contrib/MSR
> Driver/Kernel. They're PE COFF format, If we want to compile it ourself,
> we have to use mingw cross compiler. This increase the complexity of
> build script.
>
> AFAIK, nix use libcpuid only in linux context. My idea is replace these
> blobs with empty bytes. Maybe leave a note for who want mingw cross build. 

Does the current version 2.5.1 https://nixos.org/download.html contains
those blobs?

And in any case, could we update to 2.5.1 instead of 2.4?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-12  5:19                   ` Oleg Pykhalov
@ 2022-01-12  7:08                     ` Zhu Zihao
  0 siblings, 0 replies; 27+ messages in thread
From: Zhu Zihao @ 2022-01-12  7:08 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 51747, Maxime Devos

[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]


Oleg Pykhalov <go.wigust@gmail.com> writes:

> [[PGP Signed Part:Undecided]]
> Zhu Zihao <all_but_last@163.com> writes:
>
> […]
>
>> Interesting, It looks that these blobs are for Windows system. I don't
>> care about MS Windows, but blobs are tightly integrated in the source.
>>
>> The source reports that they're compiled from the source in contrib/MSR
>> Driver/Kernel. They're PE COFF format, If we want to compile it ourself,
>> we have to use mingw cross compiler. This increase the complexity of
>> build script.
>>
>> AFAIK, nix use libcpuid only in linux context. My idea is replace these
>> blobs with empty bytes. Maybe leave a note for who want mingw cross build. 
>
> Does the current version 2.5.1 https://nixos.org/download.html contains
> those blobs?
>
> And in any case, could we update to 2.5.1 instead of 2.4?
>
> [[End of PGP Signed Part]]

Thank you for remind me the release of 2.5.1. We should update to 2.5.1

But the blob is contained in libcpuid, Nix 2.5.1 still use libcpuid for
x86 machine.

-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-12  4:21                 ` Zhu Zihao
  2022-01-12  5:19                   ` Oleg Pykhalov
@ 2022-01-12  8:26                   ` Maxime Devos
  1 sibling, 0 replies; 27+ messages in thread
From: Maxime Devos @ 2022-01-12  8:26 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: Oleg Pykhalov, 51747

[-- Attachment #1: Type: text/plain, Size: 982 bytes --]

Zhu Zihao schreef op wo 12-01-2022 om 12:21 [+0800]:
> [
> ...]
> Interesting, It looks that these blobs are for Windows system. I don't
> care about MS Windows, but blobs are tightly integrated in the source.
> 
> The source reports that they're compiled from the source in contrib/MSR
> Driver/Kernel. They're PE COFF format, If we want to compile it ourself,
> we have to use mingw cross compiler. This increase the complexity of
> build script.
> 
> AFAIK, nix use libcpuid only in linux context. My idea is replace these
> blobs with empty bytes. Maybe leave a note for who want mingw cross build. 

Often (but not always, cf. rust), when software has files for specific
architectures or operating systems, they will only be compiled if they
match the architecture and operating system the software is compiled
for.  As such, there's a good chance the build will succeed (at least
for Linux, for Hurd, ...) if they are simply deleted.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-11 19:04               ` Maxime Devos
  2022-01-12  4:21                 ` Zhu Zihao
@ 2022-01-13  4:54                 ` Zhu Zihao
  2022-01-13  7:54                   ` Zhu Zihao
  2022-01-14 13:06                   ` Maxime Devos
  1 sibling, 2 replies; 27+ messages in thread
From: Zhu Zihao @ 2022-01-13  4:54 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Oleg Pykhalov, 51747

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]


Maxime Devos <maximedevos@telenet.be> writes:

> Could you change it to
>
> (filter (lambda (t) (or (x86-64-target? t) (or (x86-32-target? t))))
>         %supported-systems)

I found that it actually only supports Linux & Windows. There're only
code stubs for other platform.

I've created a patch to libcpuid, make it only link with msrdriver.c
on Windows platform. See https://github.com/anrieff/libcpuid/pull/159.

-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-13  4:54                 ` Zhu Zihao
@ 2022-01-13  7:54                   ` Zhu Zihao
  2022-01-14 13:06                   ` Maxime Devos
  1 sibling, 0 replies; 27+ messages in thread
From: Zhu Zihao @ 2022-01-13  7:54 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Oleg Pykhalov, 51747

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]


Zhu Zihao <all_but_last@163.com> writes:

> I found that it actually only supports Linux & Windows. There're only
> code stubs for other platform.

Correction, the MSR detection is limited to Linux & Windows, while other
functionalities are not.

-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-11  8:23           ` [bug#51747] [PATCH]: gnu: nix: Update to 2.4 Oleg Pykhalov
  2022-01-11  9:46             ` Zhu Zihao
  2022-01-11 17:19             ` Zhu Zihao
@ 2022-01-14  9:31             ` Zhu Zihao
  2022-01-14 12:56               ` Maxime Devos
  2 siblings, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2022-01-14  9:31 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 51747


[-- Attachment #1.1: Type: text/plain, Size: 38 bytes --]


Finally solve these issues, I hope.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Attachment #2: 0001-gnu-Add-libcpuid.patch --]
[-- Type: text/x-patch, Size: 2321 bytes --]

From 7ac9e6dd9d327c59d6d90dc0628a65fe26946021 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 22:56:14 +0800
Subject: [PATCH 1/6] gnu: Add libcpuid.

* gnu/packages/hardware.scm (libcpuid): New variable.
---
 gnu/packages/hardware.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 8727f0f20a..230800e44d 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2021, 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -953,3 +954,34 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public libcpuid
+  (let ((commit "2e61160983f32ba840b2246d3c3850c44626ab0d")
+        (revision "1"))
+    (package
+      (name "libcpuid")
+      (version (git-version "0.5.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/anrieff/libcpuid")
+               (commit commit)))
+         (sha256
+          (base32 "1mphvkiqq6z33sq6i490fq27sbyylacwrf8bg7ccvpcjms208sww"))
+         (modules '((guix build utils)))
+         (snippet
+          ;; Remove blobs
+          #~(begin
+              (delete-file "libcpuid/msrdriver.c")
+              (delete-file-recursively "contrib/MSR Driver")))
+         (file-name (git-file-name name version))))
+      (build-system cmake-build-system)
+      (arguments
+       (list #:tests? #f))              ;broken
+      (supported-systems '("x86_64-linux" "i686-linux"))
+      (home-page "https://libcpuid.sourceforge.net/")
+      (synopsis "Small library for x86 CPU detection and feature extraction")
+      (description "Libcpuid is a small C library to get vendor, model, branding
+string, code name and other information from x86 CPU.")
+      (license license:bsd-2))))
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-lowdown-Update-to-0.10.0-1-1de10c1.patch --]
[-- Type: text/x-patch, Size: 3137 bytes --]

From cd5285dabf027faca80c84ba2e656cd77d06ef98 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 23:01:38 +0800
Subject: [PATCH 2/6] gnu: lowdown: Update to 0.10.0-1-1de10c1.

* gnu/packages/markup.scm (lowdown): Update to 0.10.0-1-1de10c1.
---
 gnu/packages/markup.scm | 60 ++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 27 deletions(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 5f2f525cd2..563ad1e8e1 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -119,34 +119,40 @@ (define-public markdown
                                    "See License.text in the distribution."))))
 
 (define-public lowdown
-  (package
-    (name "lowdown")
-    (version "0.10.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://kristaps.bsd.lv/lowdown/snapshots/lowdown-"
-                           version ".tar.gz"))
-       (sha256
-        (base32 "15v2kk4ffqw3n6y6n9plch4qcib3ynnhw0ih8wn2v9qgn4jssp5p"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:test-target "regress"
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (invoke "./configure"
-                       (string-append "PREFIX=" out)
-                       (string-append "MANDIR=" out "/share/man"))))))))
-    (native-inputs
-     (list which))
-    (home-page "https://kristaps.bsd.lv/lowdown/")
-    (synopsis "Simple Markdown translator")
-    (description "Lowdown is a Markdown translator producing HTML5,
+  (let ((commit "1de10c1d71bfb4348ae0beaec8b1547d5e114969")
+        (revision "1"))
+    (package
+      (name "lowdown")
+      (version (git-version "0.10.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/kristapsdz/lowdown")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:test-target "regress"
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (invoke "./configure"
+                         (string-append "PREFIX=" out)
+                         (string-append "MANDIR=" out "/share/man"))))))
+         #:make-flags '("CFLAGS=-fPIC"))))
+
+      (native-inputs
+       (list which))
+      (home-page "https://kristaps.bsd.lv/lowdown/")
+      (synopsis "Simple Markdown translator")
+      (description "Lowdown is a Markdown translator producing HTML5,
 roff documents in the ms and man formats, LaTeX, gemini, and terminal output.")
-    (license license:isc)))
+      (license license:isc))))
 
 (define-public discount
   (package
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-lowdown-Use-G-expression.patch --]
[-- Type: text/x-patch, Size: 1997 bytes --]

From fd2849039d8df0831f2f5e55701f6e7ddf8ea0fe Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:52:25 +0800
Subject: [PATCH 3/6] gnu: lowdown: Use G-expression.

* gnu/packages/markup.scm(lowdown)[arguments]: Convert to G-expression.
---
 gnu/packages/markup.scm | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 563ad1e8e1..7a776b9101 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -29,6 +29,7 @@ (define-module (gnu packages markup)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
@@ -135,17 +136,16 @@ (define-public lowdown
           (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
       (build-system gnu-build-system)
       (arguments
-       `(#:test-target "regress"
-         #:phases
-         (modify-phases %standard-phases
-           (replace 'configure
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (invoke "./configure"
-                         (string-append "PREFIX=" out)
-                         (string-append "MANDIR=" out "/share/man"))))))
-         #:make-flags '("CFLAGS=-fPIC"))))
-
+       (list
+        #:test-target "regress"
+        #:phases
+        #~(modify-phases %standard-phases
+            (replace 'configure
+              (lambda _
+                (invoke "./configure"
+                        (string-append "PREFIX=" #$output)
+                        (string-append "MANDIR=" #$output "/share/man")))))
+        #:make-flags #~(list "CFLAGS=-fPIC")))
       (native-inputs
        (list which))
       (home-page "https://kristaps.bsd.lv/lowdown/")
-- 
2.34.0


[-- Attachment #5: 0004-gnu-nix-Update-to-2.4.patch --]
[-- Type: text/x-patch, Size: 6925 bytes --]

From 7063dd840a9a4cd7960c192d0acb3db869235d11 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 23:10:01 +0800
Subject: [PATCH 4/6] gnu: nix: Update to 2.4.

* gnu/packages/package-management.scm (nix): Update to 2.4.

[source]: Switch to Github repository since upstream no longer provides
tarball.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, flex, gcc,
googletest, jq, libtool.
[inputs]: Add libarchive, libcpuid, lowdown, zlib.

* gnu/packages/patches/nix-dont-build-html-doc.diff: New file.
* gnu/local.mk(dist_patch_DATA): Add corresponding entry.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/package-management.scm           | 66 +++++++++++++------
 .../patches/nix-dont-build-html-doc.diff      | 26 ++++++++
 3 files changed, 73 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/nix-dont-build-html-doc.diff

diff --git a/gnu/local.mk b/gnu/local.mk
index feadac4bad..9284212f01 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1515,6 +1515,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch	\
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch	\
+  %D%/packages/patches/nix-dont-build-html-doc.diff		\
   %D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch	\
   %D%/packages/patches/ngircd-handle-zombies.patch		\
   %D%/packages/patches/ngless-unliftio.patch		\
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 8a4f5155ed..03f741dc2c 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,8 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -70,6 +73,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
+  #:use-module (gnu packages hardware)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages less)
@@ -77,6 +81,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
@@ -657,14 +662,18 @@ (define-public guix-icons
 (define-public nix
   (package
     (name "nix")
-    (version "2.3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "https://releases.nixos.org/nix/nix-"
-                                 version "/nix-" version ".tar.xz"))
-             (sha256
-              (base32
-               "1g5aqavr6i3c1xln53w1pdh1kvlxrpnknb105m4jbd85kyv83rky"))))
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "http://github.com/NixOS/nix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+       (patches
+        (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
@@ -680,18 +689,35 @@ (define-public nix
                       (string-append "sysconfdir=" etc)
                       (string-append "profiledir=" etc "/profile.d")
                       make-flags)))))))
-    (native-inputs (list pkg-config))
-    (inputs (list boost
-                  brotli
-                  bzip2
-                  curl
-                  editline
-                  libgc
-                  libseccomp
-                  libsodium
-                  openssl
-                  sqlite
-                  xz))
+    (native-inputs
+     (list autoconf
+           autoconf-archive
+           automake
+           bison
+           flex
+           googletest
+           jq
+           libtool
+           pkg-config))
+    (inputs
+     (append (list boost
+                   brotli
+                   bzip2
+                   curl
+                   editline
+                   libarchive
+                   libgc
+                   libseccomp
+                   libsodium
+                   lowdown
+                   openssl
+                   sqlite
+                   xz
+                   zlib)
+             (if (or (target-x86-64?)
+                     (target-x86-32?))
+                 (list libcpuid)
+                 '())))
     (home-page "https://nixos.org/nix/")
     (synopsis "The Nix package manager")
     (description
diff --git a/gnu/packages/patches/nix-dont-build-html-doc.diff b/gnu/packages/patches/nix-dont-build-html-doc.diff
new file mode 100644
index 0000000000..79142bc215
--- /dev/null
+++ b/gnu/packages/patches/nix-dont-build-html-doc.diff
@@ -0,0 +1,26 @@
+"--enable-doc-gen" configure flag will enable HTML document generation that requires mdbook.
+We can't simply disable it because we need manpages.
+
+Author: Zhu Zihao <all_but_last@163.com>
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index e43d9f2fb..c323d1847 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -69,8 +69,6 @@ $(d)/builtins.json: $(bindir)/nix
+ 	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-# Generate the HTML manual.
+-install: $(docdir)/manual/index.html
+ 
+ # Generate 'nix' manpages.
+ install: $(mandir)/man1/nix3-manpages
+@@ -94,7 +92,5 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
+ 	done
+ 	@touch $@
+ 
+-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(call rwildcard, $(d)/src, *.md)
+-	$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
+ 
+ endif
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-nix-Use-G-expression.patch --]
[-- Type: text/x-patch, Size: 2156 bytes --]

From 3868c88ed278de703311fe222590b68ee57420e8 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:42:32 +0800
Subject: [PATCH 5/6] gnu: nix: Use G-expression.

* gnu/packages/package-management.scm (nix)[arguments]: Convert to G-expression.
---
 gnu/packages/package-management.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 03f741dc2c..594d6e9d4b 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -676,19 +676,19 @@ (define-public nix
         (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'install
-           ;; Don't try & fail to create subdirectories in /etc, but keep them
-           ;; in the output as examples.
-           (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (etc (string-append out "/etc")))
-               (apply invoke "make" "install"
-                      (string-append "sysconfdir=" etc)
-                      (string-append "profiledir=" etc "/profile.d")
-                      make-flags)))))))
+     (list
+      #:configure-flags #~(list "--sysconfdir=/etc" "--enable-gc")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            ;; Don't try & fail to create subdirectories in /etc, but keep them
+            ;; in the output as examples.
+            (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
+              (let ((etc (string-append #$output "/etc")))
+                (apply invoke "make" "install"
+                       (string-append "sysconfdir=" etc)
+                       (string-append "profiledir=" etc "/profile.d")
+                       make-flags)))))))
     (native-inputs
      (list autoconf
            autoconf-archive
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-nix-Update-to-2.5.1.patch --]
[-- Type: text/x-patch, Size: 1170 bytes --]

From 959060f15cd24e0266d5b106dbefb94c1beeccba Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Fri, 14 Jan 2022 17:30:22 +0800
Subject: [PATCH 6/6] gnu: nix: Update to 2.5.1.

* gnu/packages/package-management.scm(nix): Update to 2.5.1.
---
 gnu/packages/package-management.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 594d6e9d4b..9882f0a411 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -662,7 +662,7 @@ (define-public guix-icons
 (define-public nix
   (package
     (name "nix")
-    (version "2.4")
+    (version "2.5.1")
     (source
      (origin
        (method git-fetch)
@@ -671,7 +671,7 @@ (define-public nix
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+        (base32 "1m8rmv8i6lg83pmalvjlq1fn8mcghn3ngjv3kw1kqsa45ymj5sqq"))
        (patches
         (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
-- 
2.34.0


[-- Attachment #8: Type: text/plain, Size: 100 bytes --]


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-14  9:31             ` Zhu Zihao
@ 2022-01-14 12:56               ` Maxime Devos
  0 siblings, 0 replies; 27+ messages in thread
From: Maxime Devos @ 2022-01-14 12:56 UTC (permalink / raw)
  To: Zhu Zihao, Oleg Pykhalov; +Cc: 51747

[-- Attachment #1: Type: text/plain, Size: 2001 bytes --]

Zhu Zihao schreef op vr 14-01-2022 om 17:31 [+0800]:
> [...]
> +(define-public libcpuid
> +  (let ((commit "2e61160983f32ba840b2246d3c3850c44626ab0d")
> +        (revision "1"))
> +    (package
> +      (name "libcpuid")
> +      (version (git-version "0.5.1" revision commit))

There's a good reason for using an unreleases version here,
but this should ideally be documented with a comment,
maybe

  ;; See <https://github.com/anrieff/libcpuid/pull/159>

> +      (source
> +       (origin
> +         (method git-fetch)
> +         (uri (git-reference
> +               (url "https://github.com/anrieff/libcpuid")
> +               (commit commit)))
> +         (sha256
> +          (base32
> "1mphvkiqq6z33sq6i490fq27sbyylacwrf8bg7ccvpcjms208sww"))
> +         (modules '((guix build utils)))
> +         (snippet
> +          ;; Remove blobs
> +          #~(begin
> +              (delete-file "libcpuid/msrdriver.c")
> +              (delete-file-recursively "contrib/MSR Driver")))
> +         (file-name (git-file-name name version))))
> +      (build-system cmake-build-system)
> +      (arguments
> +       (list #:tests? #f))              ;broken

In which manner are they broken?  Maybe they can be fised.

> +      (supported-systems '("x86_64-linux" "i686-linux"))

See my e-mail about target-x86-64? and the Hurd.

> +      (home-page "https://libcpuid.sourceforge.net/")
> +      (synopsis "Small library for x86 CPU detection and feature
> extraction")
> +      (description "Libcpuid is a small C library to get vendor,
> model, branding
> +string, code name and other information from x86 CPU.")

It seems easy to confuse this with the package 'cpuid', maybe you
can mention 'cpuid' and 'libcpuid' are unrelated packages, albeit
for a similar purpose?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-13  4:54                 ` Zhu Zihao
  2022-01-13  7:54                   ` Zhu Zihao
@ 2022-01-14 13:06                   ` Maxime Devos
  2022-01-14 16:51                     ` Zhu Zihao
  1 sibling, 1 reply; 27+ messages in thread
From: Maxime Devos @ 2022-01-14 13:06 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: Oleg Pykhalov, 51747

[-- Attachment #1: Type: text/plain, Size: 815 bytes --]

Zhu Zihao schreef op do 13-01-2022 om 12:54 [+0800]:
> Maxime Devos <maximedevos@telenet.be> writes:
> 
> > Could you change it to
> > 
> > (filter (lambda (t) (or (x86-64-target? t) (or (x86-32-target? t))))
> >         %supported-systems)
> 
> I found that it actually only supports Linux & Windows. There're only
> code stubs for other platform.

I doubt this, since libcpuid.h mentions FreeBSD and Solaris support,
and 'libcpuid/asm-bits.c' uses 'cpuid' whether it is Linux or Windows
or not.

Possibly there's more information available for Linux and Windows
than for the hurd (see e.g. 'libcpuid/rdmsr.c'), but it would seem that
_some_ usable information is available elsewhere.

Also, 'libcpuid/rdmsr.c' uses 'modprobe', does this need to be
absolutised?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-14 13:06                   ` Maxime Devos
@ 2022-01-14 16:51                     ` Zhu Zihao
  2022-01-14 18:39                       ` Maxime Devos
  0 siblings, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2022-01-14 16:51 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Oleg Pykhalov, 51747


[-- Attachment #1.1: Type: text/plain, Size: 359 bytes --]


Patches updated.

The test is disabled by default, when I tried enable it test it fails,
It looks like that the RPATH of test binary is not complete. Just leave
it disabled.

I have no idea to give user a hint of differnce between cpuid and
libcpuid. Maybe add a comment or add it to description. But I don't
think user can find these hints in first sight.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Attachment #2: 0001-gnu-Add-libcpuid.patch --]
[-- Type: text/x-patch, Size: 3390 bytes --]

From 0de84768a9d5f46d25d9442e8d1fbad4b55674b9 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 22:56:14 +0800
Subject: [PATCH 1/6] gnu: Add libcpuid.

* gnu/packages/hardware.scm (libcpuid): New variable.
---
 gnu/packages/hardware.scm | 49 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 8727f0f20a..e5a2c5c13f 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2021, 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -70,7 +71,8 @@ (define-module (gnu packages hardware)
   #:use-module (guix svn-download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
-  #:use-module (guix utils))
+  #:use-module (guix utils)
+  #:use-module (srfi srfi-1))
 
 ;; This is a module for packages related to physical hardware that don't (yet)
 ;; have a more specific home like gps.scm, security-token.scm, &c.
@@ -953,3 +955,48 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public libcpuid
+  ;; We need to remove blobs from the source, first we have to isolate the blob
+  ;; source in build system.
+  ;; See https://github.com/anrieff/libcpuid/pull/159.
+  (let ((commit "2e61160983f32ba840b2246d3c3850c44626ab0d")
+        (revision "1"))
+    (package
+      (name "libcpuid")
+      (version (git-version "0.5.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/anrieff/libcpuid")
+               (commit commit)))
+         (sha256
+          (base32 "1mphvkiqq6z33sq6i490fq27sbyylacwrf8bg7ccvpcjms208sww"))
+         (modules '((guix build utils)))
+         (snippet
+          ;; Now remove blobs.
+          #~(begin
+              (delete-file "libcpuid/msrdriver.c")
+              (delete-file-recursively "contrib/MSR Driver")))
+         (file-name (git-file-name name version))))
+      (build-system cmake-build-system)
+      (arguments
+       (list
+        #:tests? #f                     ;no test
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'absolutize
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "libcpuid/rdmsr.c"
+                  (("modprobe")
+                   (search-input-file inputs "bin/modprobe"))))))))
+      (inputs (list kmod))
+      (supported-systems
+       (filter (lambda (t) (or (target-x86-64? t) (target-x86-32? t)))
+               %supported-systems))
+      (home-page "https://libcpuid.sourceforge.net/")
+      (synopsis "Small library for x86 CPU detection and feature extraction")
+      (description "Libcpuid is a small C library to get vendor, model, branding
+string, code name and other information from x86 CPU.")
+      (license license:bsd-2))))
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-lowdown-Update-to-0.10.0-1-1de10c1.patch --]
[-- Type: text/x-patch, Size: 3137 bytes --]

From a89d730d8422e703293d4569c15f4e1ede6e0d28 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 23:01:38 +0800
Subject: [PATCH 2/6] gnu: lowdown: Update to 0.10.0-1-1de10c1.

* gnu/packages/markup.scm (lowdown): Update to 0.10.0-1-1de10c1.
---
 gnu/packages/markup.scm | 60 ++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 27 deletions(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 5f2f525cd2..563ad1e8e1 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -119,34 +119,40 @@ (define-public markdown
                                    "See License.text in the distribution."))))
 
 (define-public lowdown
-  (package
-    (name "lowdown")
-    (version "0.10.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://kristaps.bsd.lv/lowdown/snapshots/lowdown-"
-                           version ".tar.gz"))
-       (sha256
-        (base32 "15v2kk4ffqw3n6y6n9plch4qcib3ynnhw0ih8wn2v9qgn4jssp5p"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:test-target "regress"
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (invoke "./configure"
-                       (string-append "PREFIX=" out)
-                       (string-append "MANDIR=" out "/share/man"))))))))
-    (native-inputs
-     (list which))
-    (home-page "https://kristaps.bsd.lv/lowdown/")
-    (synopsis "Simple Markdown translator")
-    (description "Lowdown is a Markdown translator producing HTML5,
+  (let ((commit "1de10c1d71bfb4348ae0beaec8b1547d5e114969")
+        (revision "1"))
+    (package
+      (name "lowdown")
+      (version (git-version "0.10.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/kristapsdz/lowdown")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:test-target "regress"
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (invoke "./configure"
+                         (string-append "PREFIX=" out)
+                         (string-append "MANDIR=" out "/share/man"))))))
+         #:make-flags '("CFLAGS=-fPIC"))))
+
+      (native-inputs
+       (list which))
+      (home-page "https://kristaps.bsd.lv/lowdown/")
+      (synopsis "Simple Markdown translator")
+      (description "Lowdown is a Markdown translator producing HTML5,
 roff documents in the ms and man formats, LaTeX, gemini, and terminal output.")
-    (license license:isc)))
+      (license license:isc))))
 
 (define-public discount
   (package
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-lowdown-Use-G-expression.patch --]
[-- Type: text/x-patch, Size: 1997 bytes --]

From 20f81d5df49aed828453c70bf48f73f46ea243ba Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:52:25 +0800
Subject: [PATCH 3/6] gnu: lowdown: Use G-expression.

* gnu/packages/markup.scm(lowdown)[arguments]: Convert to G-expression.
---
 gnu/packages/markup.scm | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 563ad1e8e1..7a776b9101 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -29,6 +29,7 @@ (define-module (gnu packages markup)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
@@ -135,17 +136,16 @@ (define-public lowdown
           (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
       (build-system gnu-build-system)
       (arguments
-       `(#:test-target "regress"
-         #:phases
-         (modify-phases %standard-phases
-           (replace 'configure
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (invoke "./configure"
-                         (string-append "PREFIX=" out)
-                         (string-append "MANDIR=" out "/share/man"))))))
-         #:make-flags '("CFLAGS=-fPIC"))))
-
+       (list
+        #:test-target "regress"
+        #:phases
+        #~(modify-phases %standard-phases
+            (replace 'configure
+              (lambda _
+                (invoke "./configure"
+                        (string-append "PREFIX=" #$output)
+                        (string-append "MANDIR=" #$output "/share/man")))))
+        #:make-flags #~(list "CFLAGS=-fPIC")))
       (native-inputs
        (list which))
       (home-page "https://kristaps.bsd.lv/lowdown/")
-- 
2.34.0


[-- Attachment #5: 0004-gnu-nix-Update-to-2.4.patch --]
[-- Type: text/x-patch, Size: 6925 bytes --]

From dcabfb785372d0b0af11e75d62896522f42ec359 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 23:10:01 +0800
Subject: [PATCH 4/6] gnu: nix: Update to 2.4.

* gnu/packages/package-management.scm (nix): Update to 2.4.

[source]: Switch to Github repository since upstream no longer provides
tarball.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, flex, gcc,
googletest, jq, libtool.
[inputs]: Add libarchive, libcpuid, lowdown, zlib.

* gnu/packages/patches/nix-dont-build-html-doc.diff: New file.
* gnu/local.mk(dist_patch_DATA): Add corresponding entry.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/package-management.scm           | 66 +++++++++++++------
 .../patches/nix-dont-build-html-doc.diff      | 26 ++++++++
 3 files changed, 73 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/nix-dont-build-html-doc.diff

diff --git a/gnu/local.mk b/gnu/local.mk
index feadac4bad..9284212f01 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1515,6 +1515,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch	\
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch	\
+  %D%/packages/patches/nix-dont-build-html-doc.diff		\
   %D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch	\
   %D%/packages/patches/ngircd-handle-zombies.patch		\
   %D%/packages/patches/ngless-unliftio.patch		\
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 8a4f5155ed..03f741dc2c 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,8 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -70,6 +73,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
+  #:use-module (gnu packages hardware)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages less)
@@ -77,6 +81,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
@@ -657,14 +662,18 @@ (define-public guix-icons
 (define-public nix
   (package
     (name "nix")
-    (version "2.3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "https://releases.nixos.org/nix/nix-"
-                                 version "/nix-" version ".tar.xz"))
-             (sha256
-              (base32
-               "1g5aqavr6i3c1xln53w1pdh1kvlxrpnknb105m4jbd85kyv83rky"))))
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "http://github.com/NixOS/nix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+       (patches
+        (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
@@ -680,18 +689,35 @@ (define-public nix
                       (string-append "sysconfdir=" etc)
                       (string-append "profiledir=" etc "/profile.d")
                       make-flags)))))))
-    (native-inputs (list pkg-config))
-    (inputs (list boost
-                  brotli
-                  bzip2
-                  curl
-                  editline
-                  libgc
-                  libseccomp
-                  libsodium
-                  openssl
-                  sqlite
-                  xz))
+    (native-inputs
+     (list autoconf
+           autoconf-archive
+           automake
+           bison
+           flex
+           googletest
+           jq
+           libtool
+           pkg-config))
+    (inputs
+     (append (list boost
+                   brotli
+                   bzip2
+                   curl
+                   editline
+                   libarchive
+                   libgc
+                   libseccomp
+                   libsodium
+                   lowdown
+                   openssl
+                   sqlite
+                   xz
+                   zlib)
+             (if (or (target-x86-64?)
+                     (target-x86-32?))
+                 (list libcpuid)
+                 '())))
     (home-page "https://nixos.org/nix/")
     (synopsis "The Nix package manager")
     (description
diff --git a/gnu/packages/patches/nix-dont-build-html-doc.diff b/gnu/packages/patches/nix-dont-build-html-doc.diff
new file mode 100644
index 0000000000..79142bc215
--- /dev/null
+++ b/gnu/packages/patches/nix-dont-build-html-doc.diff
@@ -0,0 +1,26 @@
+"--enable-doc-gen" configure flag will enable HTML document generation that requires mdbook.
+We can't simply disable it because we need manpages.
+
+Author: Zhu Zihao <all_but_last@163.com>
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index e43d9f2fb..c323d1847 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -69,8 +69,6 @@ $(d)/builtins.json: $(bindir)/nix
+ 	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-# Generate the HTML manual.
+-install: $(docdir)/manual/index.html
+ 
+ # Generate 'nix' manpages.
+ install: $(mandir)/man1/nix3-manpages
+@@ -94,7 +92,5 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
+ 	done
+ 	@touch $@
+ 
+-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(call rwildcard, $(d)/src, *.md)
+-	$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
+ 
+ endif
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-nix-Use-G-expression.patch --]
[-- Type: text/x-patch, Size: 2156 bytes --]

From 25b4055977e28a3efc8f0ee4af2906e4e923c7d9 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:42:32 +0800
Subject: [PATCH 5/6] gnu: nix: Use G-expression.

* gnu/packages/package-management.scm (nix)[arguments]: Convert to G-expression.
---
 gnu/packages/package-management.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 03f741dc2c..594d6e9d4b 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -676,19 +676,19 @@ (define-public nix
         (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'install
-           ;; Don't try & fail to create subdirectories in /etc, but keep them
-           ;; in the output as examples.
-           (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (etc (string-append out "/etc")))
-               (apply invoke "make" "install"
-                      (string-append "sysconfdir=" etc)
-                      (string-append "profiledir=" etc "/profile.d")
-                      make-flags)))))))
+     (list
+      #:configure-flags #~(list "--sysconfdir=/etc" "--enable-gc")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            ;; Don't try & fail to create subdirectories in /etc, but keep them
+            ;; in the output as examples.
+            (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
+              (let ((etc (string-append #$output "/etc")))
+                (apply invoke "make" "install"
+                       (string-append "sysconfdir=" etc)
+                       (string-append "profiledir=" etc "/profile.d")
+                       make-flags)))))))
     (native-inputs
      (list autoconf
            autoconf-archive
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-nix-Update-to-2.5.1.patch --]
[-- Type: text/x-patch, Size: 1170 bytes --]

From d81e689fa1acd5eb4a2fee325609216a24a9b887 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Fri, 14 Jan 2022 17:30:22 +0800
Subject: [PATCH 6/6] gnu: nix: Update to 2.5.1.

* gnu/packages/package-management.scm(nix): Update to 2.5.1.
---
 gnu/packages/package-management.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 594d6e9d4b..9882f0a411 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -662,7 +662,7 @@ (define-public guix-icons
 (define-public nix
   (package
     (name "nix")
-    (version "2.4")
+    (version "2.5.1")
     (source
      (origin
        (method git-fetch)
@@ -671,7 +671,7 @@ (define-public nix
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+        (base32 "1m8rmv8i6lg83pmalvjlq1fn8mcghn3ngjv3kw1kqsa45ymj5sqq"))
        (patches
         (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
-- 
2.34.0


[-- Attachment #8: Type: text/plain, Size: 101 bytes --]



-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-14 16:51                     ` Zhu Zihao
@ 2022-01-14 18:39                       ` Maxime Devos
  2022-01-15  1:58                         ` Zhu Zihao
  2022-01-15  5:47                         ` Zhu Zihao
  0 siblings, 2 replies; 27+ messages in thread
From: Maxime Devos @ 2022-01-14 18:39 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: Oleg Pykhalov, 51747


[-- Attachment #1.1: Type: text/plain, Size: 1403 bytes --]

Zhu Zihao schreef op za 15-01-2022 om 00:51 [+0800]:
> Patches updated.
> 
> The test is disabled by default, when I tried enable it test it fails,
> It looks like that the RPATH of test binary is not complete. Just leave
> it disabled.

I didn't see anyting RUNPATH (*) related.  It failed to run some python
script though with ‘file does not exist’ (which could maybe indicate
RUNPATH problems, but not in this case), it turned out that the shebang
wasn't patched.  Adding python to the native-inputs appears to fix
things

> I have no idea to gi.ve user a hint of differnce between cpuid and
> libcpuid. Maybe add a comment or add it to description. But I don't
> think user can find these hints in first sight.

See attachement for a variant of the 'libcpuid' package that builds for
me (--system=x86-64-linux, with tests) and cross-builds to
--target=i586-pc-gnu (tests automatically disabled because of cross-
compilation).  'kmod' only exists on Linux, so I modified the inputs
and 'absolutize' to only use it when building for Linux.

I don't think many users look at the description either, but it seems a
logical place to look in case of trouble.  I added a sentence.

I modified the package definition outside emacs and outside a git
checkout, so the indentation probably needs some fixing.

Greetings,
Maxime.

(*) IIRC Guix uses RUNPATH and not RPATH.

[-- Attachment #1.2: stuff.scm --]
[-- Type: text/x-scheme, Size: 2613 bytes --]


(use-modules (guix svn-download)
    ((guix licenses) #:prefix license:)
    (gnu packages linux)
    (gnu packages python)
    (guix packages)
    (guix gexp)
    (guix packages)
    (guix git-download)
    (guix build-system cmake)
    (guix utils)
    (srfi srfi-1))

(define-public libcpuid
  ;; We need to remove blobs from the source, first we have to isolate the blob
  ;; source in build system.
  ;; See <https://github.com/anrieff/libcpuid/pull/159>.
  (let ((commit "2e61160983f32ba840b2246d3c3850c44626ab0d")
        (revision "1"))
    (package
      (name "libcpuid")
      (version (git-version "0.5.1" revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/anrieff/libcpuid")
               (commit commit)))
         (sha256
          (base32 "1mphvkiqq6z33sq6i490fq27sbyylacwrf8bg7ccvpcjms208sww"))
         (modules '((guix build utils)))
         (snippet
          ;; Now remove blobs.
          #~(begin
              (delete-file "libcpuid/msrdriver.c")
              (delete-file-recursively "contrib/MSR Driver")))
         (file-name (git-file-name name version))))
      (build-system cmake-build-system)
      (arguments
       (list
        #:modules '((rnrs exceptions)
                    (guix build cmake-build-system)
                    (guix build utils))
        #:configure-flags #~'("-DLIBCPUID_TESTS=ON") 
        #:phases
        #~(modify-phases %standard-phases
            (add-after 'unpack 'absolutize
              (lambda* (#:key inputs #:allow-other-keys)
                ;; modprobe doesn't exist on the Hurd 
                (guard (c ((search-error? c) (values)))
                  (substitute* "libcpuid/rdmsr.c"
                    (("modprobe")
                     (search-input-file inputs "bin/modprobe")))))))))
      (inputs (if (target-linux?)
                  (list kmod) ; linux-only
                  '()))
      ;; a python from the 3. series is required by tests
      (native-inputs (list python-3))
      (supported-systems
       (filter (lambda (t) (or (target-x86-64? t) (target-x86-32? t)))
               %supported-systems))
      (home-page "https://libcpuid.sourceforge.net/")
      (synopsis "Small library for x86 CPU detection and feature extraction")
      (description "Libcpuid is a small C library to get vendor, model, branding
string, code name and other information from x86 CPU.  This library is not
to be confused with the @code{cpuid} command line utility fromm the
@code{cpuid} package.")
      (license license:bsd-2))))

libcpuid

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-14 18:39                       ` Maxime Devos
@ 2022-01-15  1:58                         ` Zhu Zihao
  2022-01-15  5:47                         ` Zhu Zihao
  1 sibling, 0 replies; 27+ messages in thread
From: Zhu Zihao @ 2022-01-15  1:58 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Oleg Pykhalov, 51747

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]


Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:Undecided]]
> Zhu Zihao schreef op za 15-01-2022 om 00:51 [+0800]:
>> Patches updated.
>> 
>> The test is disabled by default, when I tried enable it test it fails,
>> It looks like that the RPATH of test binary is not complete. Just leave
>> it disabled.
>
> I didn't see anyting RUNPATH (*) related.  It failed to run some python
> script though with ‘file does not exist’ (which could maybe indicate
> RUNPATH problems, but not in this case), it turned out that the shebang
> wasn't patched.  Adding python to the native-inputs appears to fix
> things

I use -K to keep failed build and ldd the test binary found that RUNPATH
is broken, but I miss that we don't add python into inputs.. Penny wise
and pound foolish LOL.

I know Guix use RUNPATH, but RPATH is short to type and we need not to
distinguish between them in our context. 
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-14 18:39                       ` Maxime Devos
  2022-01-15  1:58                         ` Zhu Zihao
@ 2022-01-15  5:47                         ` Zhu Zihao
  2022-01-15 10:52                           ` Maxime Devos
  1 sibling, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2022-01-15  5:47 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Oleg Pykhalov, 51747


[-- Attachment #1.1: Type: text/plain, Size: 64 bytes --]


Do some modification based on your code, and add your credit.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Attachment #2: 0001-gnu-Add-libcpuid.patch --]
[-- Type: text/x-patch, Size: 3727 bytes --]

From 11e87c57046292b754c7d641b587e9eb99e688f7 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 22:56:14 +0800
Subject: [PATCH 1/6] gnu: Add libcpuid.

* gnu/packages/hardware.scm (libcpuid): New variable.
---
 gnu/packages/hardware.scm | 56 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 8727f0f20a..a93db0be3f 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -9,6 +9,8 @@
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2021, 2022 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
+;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -70,7 +72,8 @@ (define-module (gnu packages hardware)
   #:use-module (guix svn-download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
-  #:use-module (guix utils))
+  #:use-module (guix utils)
+  #:use-module (srfi srfi-1))
 
 ;; This is a module for packages related to physical hardware that don't (yet)
 ;; have a more specific home like gps.scm, security-token.scm, &c.
@@ -953,3 +956,54 @@ (define-public tpm2-tss
 libtss2-esys, libtss2-sys, libtss2-mu, libtss2-tcti-device, libtss2-tcti-swtpm
 and libtss2-tcti-mssim.")
     (license license:bsd-2)))
+
+(define-public libcpuid
+  ;; We need to remove blobs from the source, first we have to isolate the blob
+  ;; source in build system.
+  ;; See https://github.com/anrieff/libcpuid/pull/159.
+  (let ((commit "2e61160983f32ba840b2246d3c3850c44626ab0d")
+        (revision "1"))
+    (package
+      (name "libcpuid")
+      (version (git-version "0.5.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/anrieff/libcpuid")
+               (commit commit)))
+         (sha256
+          (base32 "1mphvkiqq6z33sq6i490fq27sbyylacwrf8bg7ccvpcjms208sww"))
+         (modules '((guix build utils)))
+         (snippet
+          ;; Now remove blobs.
+          #~(begin
+              (delete-file "libcpuid/msrdriver.c")
+              (delete-file-recursively "contrib/MSR Driver")))
+         (file-name (git-file-name name version))))
+      (build-system cmake-build-system)
+      (arguments
+       (list
+        #:configure-flags #~(list "-DLIBCPUID_TESTS=ON")
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'absolutize
+              (lambda* (#:key inputs #:allow-other-keys)
+                ;; Linux specific
+                (when #$(target-linux?)
+                  (substitute* "libcpuid/rdmsr.c"
+                    (("modprobe") (which "modprobe")))))))))
+      (inputs
+       (if (target-linux?)
+           (list kmod)
+           '()))
+      (native-inputs (list python-3))   ;required by tests
+      (supported-systems
+       (filter (lambda (t) (or (target-x86-64? t) (target-x86-32? t)))
+               %supported-systems))
+      (home-page "https://libcpuid.sourceforge.net/")
+      (synopsis "Small library for x86 CPU detection and feature extraction")
+      (description "Libcpuid is a small C library to get vendor, model, branding
+string, code name and other information from x86 CPU. This library is not to be
+confused with the @code{cpuid} command line utility from package @code{cpuid}.")
+      (license license:bsd-2))))
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-lowdown-Update-to-0.10.0-1-1de10c1.patch --]
[-- Type: text/x-patch, Size: 3137 bytes --]

From 28913dfe0c3041469ca3e2fbc93a600fb9c07656 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 23:01:38 +0800
Subject: [PATCH 2/6] gnu: lowdown: Update to 0.10.0-1-1de10c1.

* gnu/packages/markup.scm (lowdown): Update to 0.10.0-1-1de10c1.
---
 gnu/packages/markup.scm | 60 ++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 27 deletions(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 5f2f525cd2..563ad1e8e1 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -119,34 +119,40 @@ (define-public markdown
                                    "See License.text in the distribution."))))
 
 (define-public lowdown
-  (package
-    (name "lowdown")
-    (version "0.10.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://kristaps.bsd.lv/lowdown/snapshots/lowdown-"
-                           version ".tar.gz"))
-       (sha256
-        (base32 "15v2kk4ffqw3n6y6n9plch4qcib3ynnhw0ih8wn2v9qgn4jssp5p"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:test-target "regress"
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out")))
-               (invoke "./configure"
-                       (string-append "PREFIX=" out)
-                       (string-append "MANDIR=" out "/share/man"))))))))
-    (native-inputs
-     (list which))
-    (home-page "https://kristaps.bsd.lv/lowdown/")
-    (synopsis "Simple Markdown translator")
-    (description "Lowdown is a Markdown translator producing HTML5,
+  (let ((commit "1de10c1d71bfb4348ae0beaec8b1547d5e114969")
+        (revision "1"))
+    (package
+      (name "lowdown")
+      (version (git-version "0.10.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/kristapsdz/lowdown")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:test-target "regress"
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (invoke "./configure"
+                         (string-append "PREFIX=" out)
+                         (string-append "MANDIR=" out "/share/man"))))))
+         #:make-flags '("CFLAGS=-fPIC"))))
+
+      (native-inputs
+       (list which))
+      (home-page "https://kristaps.bsd.lv/lowdown/")
+      (synopsis "Simple Markdown translator")
+      (description "Lowdown is a Markdown translator producing HTML5,
 roff documents in the ms and man formats, LaTeX, gemini, and terminal output.")
-    (license license:isc)))
+      (license license:isc))))
 
 (define-public discount
   (package
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-lowdown-Use-G-expression.patch --]
[-- Type: text/x-patch, Size: 1997 bytes --]

From 7147a2c254e8010905fa2f02459618d28bdf7a75 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:52:25 +0800
Subject: [PATCH 3/6] gnu: lowdown: Use G-expression.

* gnu/packages/markup.scm(lowdown)[arguments]: Convert to G-expression.
---
 gnu/packages/markup.scm | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 563ad1e8e1..7a776b9101 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -29,6 +29,7 @@ (define-module (gnu packages markup)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
@@ -135,17 +136,16 @@ (define-public lowdown
           (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
       (build-system gnu-build-system)
       (arguments
-       `(#:test-target "regress"
-         #:phases
-         (modify-phases %standard-phases
-           (replace 'configure
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((out (assoc-ref outputs "out")))
-                 (invoke "./configure"
-                         (string-append "PREFIX=" out)
-                         (string-append "MANDIR=" out "/share/man"))))))
-         #:make-flags '("CFLAGS=-fPIC"))))
-
+       (list
+        #:test-target "regress"
+        #:phases
+        #~(modify-phases %standard-phases
+            (replace 'configure
+              (lambda _
+                (invoke "./configure"
+                        (string-append "PREFIX=" #$output)
+                        (string-append "MANDIR=" #$output "/share/man")))))
+        #:make-flags #~(list "CFLAGS=-fPIC")))
       (native-inputs
        (list which))
       (home-page "https://kristaps.bsd.lv/lowdown/")
-- 
2.34.0


[-- Attachment #5: 0004-gnu-nix-Update-to-2.4.patch --]
[-- Type: text/x-patch, Size: 6925 bytes --]

From 045c1997bd21341606bfb5d4ae8104b8464dc60e Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Tue, 11 Jan 2022 23:10:01 +0800
Subject: [PATCH 4/6] gnu: nix: Update to 2.4.

* gnu/packages/package-management.scm (nix): Update to 2.4.

[source]: Switch to Github repository since upstream no longer provides
tarball.
[native-inputs]: Add autoconf, autoconf-archive, automake, bison, flex, gcc,
googletest, jq, libtool.
[inputs]: Add libarchive, libcpuid, lowdown, zlib.

* gnu/packages/patches/nix-dont-build-html-doc.diff: New file.
* gnu/local.mk(dist_patch_DATA): Add corresponding entry.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/package-management.scm           | 66 +++++++++++++------
 .../patches/nix-dont-build-html-doc.diff      | 26 ++++++++
 3 files changed, 73 insertions(+), 20 deletions(-)
 create mode 100644 gnu/packages/patches/nix-dont-build-html-doc.diff

diff --git a/gnu/local.mk b/gnu/local.mk
index feadac4bad..9284212f01 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1515,6 +1515,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch \
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt1.patch	\
   %D%/packages/patches/nettle-3.5-CVE-2021-3580-pt2.patch	\
+  %D%/packages/patches/nix-dont-build-html-doc.diff		\
   %D%/packages/patches/nfs4-acl-tools-0.3.7-fixpaths.patch	\
   %D%/packages/patches/ngircd-handle-zombies.patch		\
   %D%/packages/patches/ngless-unliftio.patch		\
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 8a4f5155ed..03f741dc2c 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,8 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
+  #:use-module (gnu packages flex)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -70,6 +73,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
+  #:use-module (gnu packages hardware)
   #:use-module (gnu packages hurd)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages less)
@@ -77,6 +81,7 @@ (define-module (gnu packages package-management)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
@@ -657,14 +662,18 @@ (define-public guix-icons
 (define-public nix
   (package
     (name "nix")
-    (version "2.3.16")
-    (source (origin
-             (method url-fetch)
-             (uri (string-append "https://releases.nixos.org/nix/nix-"
-                                 version "/nix-" version ".tar.xz"))
-             (sha256
-              (base32
-               "1g5aqavr6i3c1xln53w1pdh1kvlxrpnknb105m4jbd85kyv83rky"))))
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "http://github.com/NixOS/nix")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+       (patches
+        (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
@@ -680,18 +689,35 @@ (define-public nix
                       (string-append "sysconfdir=" etc)
                       (string-append "profiledir=" etc "/profile.d")
                       make-flags)))))))
-    (native-inputs (list pkg-config))
-    (inputs (list boost
-                  brotli
-                  bzip2
-                  curl
-                  editline
-                  libgc
-                  libseccomp
-                  libsodium
-                  openssl
-                  sqlite
-                  xz))
+    (native-inputs
+     (list autoconf
+           autoconf-archive
+           automake
+           bison
+           flex
+           googletest
+           jq
+           libtool
+           pkg-config))
+    (inputs
+     (append (list boost
+                   brotli
+                   bzip2
+                   curl
+                   editline
+                   libarchive
+                   libgc
+                   libseccomp
+                   libsodium
+                   lowdown
+                   openssl
+                   sqlite
+                   xz
+                   zlib)
+             (if (or (target-x86-64?)
+                     (target-x86-32?))
+                 (list libcpuid)
+                 '())))
     (home-page "https://nixos.org/nix/")
     (synopsis "The Nix package manager")
     (description
diff --git a/gnu/packages/patches/nix-dont-build-html-doc.diff b/gnu/packages/patches/nix-dont-build-html-doc.diff
new file mode 100644
index 0000000000..79142bc215
--- /dev/null
+++ b/gnu/packages/patches/nix-dont-build-html-doc.diff
@@ -0,0 +1,26 @@
+"--enable-doc-gen" configure flag will enable HTML document generation that requires mdbook.
+We can't simply disable it because we need manpages.
+
+Author: Zhu Zihao <all_but_last@163.com>
+
+diff --git a/doc/manual/local.mk b/doc/manual/local.mk
+index e43d9f2fb..c323d1847 100644
+--- a/doc/manual/local.mk
++++ b/doc/manual/local.mk
+@@ -69,8 +69,6 @@ $(d)/builtins.json: $(bindir)/nix
+ 	$(trace-gen) $(dummy-env) NIX_PATH=nix/corepkgs=corepkgs $(bindir)/nix __dump-builtins > $@.tmp
+ 	@mv $@.tmp $@
+ 
+-# Generate the HTML manual.
+-install: $(docdir)/manual/index.html
+ 
+ # Generate 'nix' manpages.
+ install: $(mandir)/man1/nix3-manpages
+@@ -94,7 +92,5 @@ doc/manual/generated/man1/nix3-manpages: $(d)/src/command-ref/new-cli
+ 	done
+ 	@touch $@
+ 
+-$(docdir)/manual/index.html: $(MANUAL_SRCS) $(d)/book.toml $(d)/custom.css $(d)/src/SUMMARY.md $(d)/src/command-ref/new-cli $(d)/src/command-ref/conf-file.md $(d)/src/expressions/builtins.md $(call rwildcard, $(d)/src, *.md)
+-	$(trace-gen) RUST_LOG=warn mdbook build doc/manual -d $(DESTDIR)$(docdir)/manual
+ 
+ endif
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-nix-Use-G-expression.patch --]
[-- Type: text/x-patch, Size: 2156 bytes --]

From 2e6281516a3d909c2b031f1a7461f27801c032f4 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:42:32 +0800
Subject: [PATCH 5/6] gnu: nix: Use G-expression.

* gnu/packages/package-management.scm (nix)[arguments]: Convert to G-expression.
---
 gnu/packages/package-management.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 03f741dc2c..594d6e9d4b 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -676,19 +676,19 @@ (define-public nix
         (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'install
-           ;; Don't try & fail to create subdirectories in /etc, but keep them
-           ;; in the output as examples.
-           (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (etc (string-append out "/etc")))
-               (apply invoke "make" "install"
-                      (string-append "sysconfdir=" etc)
-                      (string-append "profiledir=" etc "/profile.d")
-                      make-flags)))))))
+     (list
+      #:configure-flags #~(list "--sysconfdir=/etc" "--enable-gc")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            ;; Don't try & fail to create subdirectories in /etc, but keep them
+            ;; in the output as examples.
+            (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
+              (let ((etc (string-append #$output "/etc")))
+                (apply invoke "make" "install"
+                       (string-append "sysconfdir=" etc)
+                       (string-append "profiledir=" etc "/profile.d")
+                       make-flags)))))))
     (native-inputs
      (list autoconf
            autoconf-archive
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-nix-Update-to-2.5.1.patch --]
[-- Type: text/x-patch, Size: 1170 bytes --]

From a8ff6088e543f5a7322180aa59e7c4d5447eb11c Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Fri, 14 Jan 2022 17:30:22 +0800
Subject: [PATCH 6/6] gnu: nix: Update to 2.5.1.

* gnu/packages/package-management.scm(nix): Update to 2.5.1.
---
 gnu/packages/package-management.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 594d6e9d4b..9882f0a411 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -662,7 +662,7 @@ (define-public guix-icons
 (define-public nix
   (package
     (name "nix")
-    (version "2.4")
+    (version "2.5.1")
     (source
      (origin
        (method git-fetch)
@@ -671,7 +671,7 @@ (define-public nix
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1abgfw5ndqklm0x533li32l4azifz3f6lhaxm6s74b704043r7m2"))
+        (base32 "1m8rmv8i6lg83pmalvjlq1fn8mcghn3ngjv3kw1kqsa45ymj5sqq"))
        (patches
         (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
-- 
2.34.0


[-- Attachment #8: Type: text/plain, Size: 100 bytes --]


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-15  5:47                         ` Zhu Zihao
@ 2022-01-15 10:52                           ` Maxime Devos
  2022-01-15 16:06                             ` Zhu Zihao
  2022-01-23 11:02                             ` [bug#51747] " Maxime Devos
  0 siblings, 2 replies; 27+ messages in thread
From: Maxime Devos @ 2022-01-15 10:52 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: Oleg Pykhalov, 51747

[-- Attachment #1: Type: text/plain, Size: 3036 bytes --]

Hi,

I looked a bit in the source code, and it seems to be missing
some error checking.  E.g., in libcpuid/cpuid_main.c:,
it is not verified that 'malloc' succeeded.

        list->names = (char**) malloc(sizeof(char*) * n);
        [...]
        list->names[n] = (char*) malloc (i - last)
        [....]
        list->names[n][i - last - 1 = '\0']

It doesn't seem exploitable here, but I would recommend something
like 'xmalloc' instead to avoid (anti-)learning by bad examples.

Also, in the package definition, you are using cmake-build-system.
This works, but the README doesn't mention CMake anywhere and instead
mentions the autotools (autoconf etc.) and has configure.ac, so I would
use gnu-build-system instead.

Zhu Zihao schreef op za 15-01-2022 om 13:47 [+0800]:
> +      (arguments
> +       (list
> +        #:configure-flags #~(list "-DLIBCPUID_TESTS=ON")
> +        #:phases
> +        #~(modify-phases %standard-phases
> +            (add-after 'unpack 'absolutize
> +              (lambda* (#:key inputs #:allow-other-keys)
> +                ;; Linux specific
> +                (when #$(target-linux?)
> +                  (substitute* "libcpuid/rdmsr.c"
> +                    (("modprobe") (which "modprobe")))))))))

This use of 'which' doesn't work when cross-compiling because it looks
in $PATH (which contains (possibly implicit) native-inputs) and not
'inputs' -- 'inputs' and 'native-inputs' are merged together when
compiling natively so this doesn't cause errors when compiling natively
but it doesn't work when cross-compiling -- try
"./pre-inst-env guix build libcpuid --target=aarch64-linux-gnu".

I would use 'search-input-file' instead:

        ;; using (when #$(target-linux? ...) ...) instead
        ;; of 'guard' would also work
        #~(modify-phases %standard-phases
            (add-after 'unpack 'absolutize
              (lambda* (#:key inputs #:allow-other-keys)
                ;; modprobe doesn't exist on the Hurd 
                (guard (c ((search-error? c) (values)))
                  (substitute* "libcpuid/rdmsr.c"
                    (("modprobe")
                     (search-input-file inputs "bin/modprobe")))))))))


> + confused with the @code{cpuid} command line utility from package
> + @code{cpuid}.")

A definite article is missing before 'package'.

> +      (native-inputs (list python-3))   ;required by tests

I would keep the original comment

      ;; a python from the 3. series is required by tests

here, because it is important that it comes from the 3. series
-- the shebang uses "/usr/bin/env python3", not "python3".  This
comment would be helpful when updating python to the 4. series
(these versions don't exist yet but presumably they eventually will),
as it would make it clear that we cannot simply replace 'python-3' with
'python-4'.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-15 10:52                           ` Maxime Devos
@ 2022-01-15 16:06                             ` Zhu Zihao
  2022-01-21 14:29                               ` bug#51747: " Oleg Pykhalov
  2022-01-23 11:02                             ` [bug#51747] " Maxime Devos
  1 sibling, 1 reply; 27+ messages in thread
From: Zhu Zihao @ 2022-01-15 16:06 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Oleg Pykhalov, 51747

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]


Maxime Devos <maximedevos@telenet.be> writes:

Please forgive me that I don't have so much time to test cross build. If
you have problem with my patches, you can modify it based on existing
patches. And don't forget to notice Guix committers to ensure they don't
miss any new patches. :)

-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#51747: [PATCH]: gnu: nix: Update to 2.4.
  2022-01-15 16:06                             ` Zhu Zihao
@ 2022-01-21 14:29                               ` Oleg Pykhalov
  0 siblings, 0 replies; 27+ messages in thread
From: Oleg Pykhalov @ 2022-01-21 14:29 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 51747-done, Maxime Devos

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

Zhu Zihao <all_but_last@163.com> writes:

> Maxime Devos <maximedevos@telenet.be> writes:
>
> Please forgive me that I don't have so much time to test cross build. If
> you have problem with my patches, you can modify it based on existing
> patches. And don't forget to notice Guix committers to ensure they don't
> miss any new patches. :)

Pushed to master.

Closing the issue.

Thanks,
Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
  2022-01-15 10:52                           ` Maxime Devos
  2022-01-15 16:06                             ` Zhu Zihao
@ 2022-01-23 11:02                             ` Maxime Devos
  1 sibling, 0 replies; 27+ messages in thread
From: Maxime Devos @ 2022-01-23 11:02 UTC (permalink / raw)
  Cc: 51747

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

Maxime Devos schreef op za 15-01-2022 om 11:52 [+0100]:
> I looked a bit in the source code, and it seems to be missing
> some error checking.  E.g., in libcpuid/cpuid_main.c:,
> it is not verified that 'malloc' succeeded.
> 
>         list->names = (char**) malloc(sizeof(char*) * n);
>         [...]
>         list->names[n] = (char*) malloc (i - last)
>         [....]
>         list->names[n][i - last - 1 = '\0']

This has been addressed upstream:
<https://github.com/anrieff/libcpuid/pull/160>.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2022-01-23 11:03 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-10 12:35 [bug#51747] [PATCH]: gnu: nix: Update to 2.4 Zhu Zihao
     [not found] ` <handler.51747.B.16365478179399.ack@debbugs.gnu.org>
2021-11-10 13:53   ` [bug#51747] Acknowledgement ([PATCH]: gnu: nix: Update to 2.4. ) Zhu Zihao
2021-11-10 15:47     ` Zhu Zihao
2021-11-17 11:21       ` Zhu Zihao
2021-12-04 15:28         ` Zhu Zihao
2022-01-11  8:23           ` [bug#51747] [PATCH]: gnu: nix: Update to 2.4 Oleg Pykhalov
2022-01-11  9:46             ` Zhu Zihao
2022-01-11 17:19             ` Zhu Zihao
2022-01-11 19:04               ` Maxime Devos
2022-01-12  4:21                 ` Zhu Zihao
2022-01-12  5:19                   ` Oleg Pykhalov
2022-01-12  7:08                     ` Zhu Zihao
2022-01-12  8:26                   ` Maxime Devos
2022-01-13  4:54                 ` Zhu Zihao
2022-01-13  7:54                   ` Zhu Zihao
2022-01-14 13:06                   ` Maxime Devos
2022-01-14 16:51                     ` Zhu Zihao
2022-01-14 18:39                       ` Maxime Devos
2022-01-15  1:58                         ` Zhu Zihao
2022-01-15  5:47                         ` Zhu Zihao
2022-01-15 10:52                           ` Maxime Devos
2022-01-15 16:06                             ` Zhu Zihao
2022-01-21 14:29                               ` bug#51747: " Oleg Pykhalov
2022-01-23 11:02                             ` [bug#51747] " Maxime Devos
2022-01-11 19:05               ` Maxime Devos
2022-01-14  9:31             ` Zhu Zihao
2022-01-14 12:56               ` Maxime Devos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).