From 0b4f1c3affb1faf1aae2afb07bdd4e8697f87f2c Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Sat, 9 Dec 2023 15:58:47 +0800 Subject: nongnu: make-linux-xanmod: Adjust style. * nongnu/packages/linux.scm (%default-extra-linux-options,config->string): Move into make-linux-xanmod. (make-linux-xanmod): Adjust comments. Move the base kernel produced by customize-linux out of let form. [native-inputs]: Use prepend instead of append. Signed-off-by: Jonathan Brielmaier --- nongnu/packages/linux.scm | 116 ++++++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 55 deletions(-) (limited to 'nongnu') diff --git a/nongnu/packages/linux.scm b/nongnu/packages/linux.scm index be6fb8e..222862a 100644 --- a/nongnu/packages/linux.scm +++ b/nongnu/packages/linux.scm @@ -46,12 +46,6 @@ #:use-module (srfi srfi-1) #:export (corrupt-linux)) -(define %default-extra-linux-options - (@@ (gnu packages linux) %default-extra-linux-options)) - -(define config->string - (@@ (gnu packages linux) config->string)) - (define (linux-url version) "Return a URL for Linux VERSION." (string-append "mirror://kernel.org" @@ -189,56 +183,68 @@ on hardware which requires nonfree software to function.")))) #:key (name "linux-xanmod") (xanmod-defconfig "config_x86-64-v1")) - (let ((defconfig xanmod-defconfig) ;to be used in phases. - (base (customize-linux #:name name - #:source source - #:defconfig xanmod-defconfig - ;; EXTRAVERSION is used instead. - #:configs (config->string - '(("CONFIG_LOCALVERSION" . ""))) - #:extra-version xanmod-revision))) - (package - (inherit base) - (version version) - (arguments - (substitute-keyword-arguments (package-arguments base) - ((#:phases phases) - #~(modify-phases #$phases - (add-before 'configure 'add-xanmod-defconfig - (lambda _ - (rename-file - (string-append "CONFIGS/xanmod/gcc/" #$defconfig) - ".config") - - ;; Adapted from `make-linux-libre*'. - (chmod ".config" #o666) - (let ((port (open-file ".config" "a")) - (extra-configuration - #$(config->string - ;; FIXME: There might be other support missing. - (append '(("CONFIG_BLK_DEV_NVME" . #t) - ("CONFIG_CRYPTO_XTS" . m) - ("CONFIG_VIRTIO_CONSOLE" . m)) - %default-extra-linux-options)))) - (display extra-configuration port) - (close-port port)) - (invoke "make" "oldconfig") - - (rename-file - ".config" - (string-append "arch/x86/configs/" #$defconfig)))))))) - (native-inputs - (modify-inputs (package-native-inputs base) - ;; cpio is needed for CONFIG_IKHEADERS. - (append cpio zstd))) - (home-page "https://xanmod.org/") - (supported-systems '("x86_64-linux")) - (synopsis - "Linux kernel distribution with custom settings and new features") - (description - "This package provides XanMod kernel, a general-purpose Linux kernel + + (define %default-extra-linux-options + (@@ (gnu packages linux) %default-extra-linux-options)) + + (define config->string + (@@ (gnu packages linux) config->string)) + + (define base-kernel + (customize-linux + #:name name + #:source source + #:defconfig xanmod-defconfig + ;; EXTRAVERSION is used instead. + #:configs (config->string + '(("CONFIG_LOCALVERSION" . ""))) + #:extra-version xanmod-revision)) + + (package + (inherit base-kernel) + (version version) + (arguments + (substitute-keyword-arguments (package-arguments base-kernel) + ((#:phases phases) + #~(modify-phases #$phases + ;; Since `customize-linux' replaces the configure phase, we add + ;; XanMod defconfig beforehand to ensure compatibility of the + ;; resulting package with `customize-linux'. + (add-before 'configure 'add-xanmod-defconfig + (lambda _ + (rename-file + (string-append "CONFIGS/xanmod/gcc/" #$xanmod-defconfig) + ".config") + + ;; Adapted from `make-linux-libre*'. + (chmod ".config" #o666) + (let ((port (open-file ".config" "a")) + (extra-configuration + #$(config->string + (append %default-extra-linux-options + ;; NOTE: These are configs expected by Guix + ;; but missing from XanMod defconfig. + '(("CONFIG_BLK_DEV_NVME" . #t) + ("CONFIG_CRYPTO_XTS" . m) + ("CONFIG_VIRTIO_CONSOLE" . m)))))) + (display extra-configuration port) + (close-port port)) + (invoke "make" "oldconfig") + + (rename-file + ".config" + (string-append "arch/x86/configs/" #$xanmod-defconfig)))))))) + (native-inputs + (modify-inputs (package-native-inputs base-kernel) + ;; cpio is needed for CONFIG_IKHEADERS. + (prepend cpio zstd))) + (home-page "https://xanmod.org/") + (supported-systems '("x86_64-linux")) + (synopsis "Linux kernel distribution with custom settings and new features") + (description + "This package provides XanMod kernel, a general-purpose Linux kernel distribution with custom settings and new features. It's built to provide a -stable, responsive and smooth desktop experience.")))) +stable, responsive and smooth desktop experience."))) ;; Linux-XanMod sources (define-public linux-xanmod-version "6.5.10") -- cgit v1.2.3