commit 6e863b55fc526e29a5d9a2587502e190638e069e Author: Florian Schrofner Date: Fri Sep 22 20:35:13 2023 +0200 add current xanmod kernel diff --git a/schrofi/packages/xanmod.scm b/schrofi/packages/xanmod.scm new file mode 100644 index 0000000..028f05d --- /dev/null +++ b/schrofi/packages/xanmod.scm @@ -0,0 +1,106 @@ +;; this was shamelessly copied fron nonguix +(define-module (schrofi packages xanmod) + #:use-module (gnu packages) + #:use-module (gnu packages base) + #:use-module (gnu packages compression) + #:use-module (gnu packages cpio) + #:use-module (gnu packages linux) + #:use-module (guix licenses) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix download) + #:use-module (guix gexp) + #:use-module (guix git-download) + #:use-module (guix build-system copy) + #:use-module (guix build-system gnu) + #:use-module (guix build-system linux-module) + #:use-module (guix build-system trivial) + #:use-module (srfi srfi-1)) + +(define %default-extra-linux-options + (@@ (gnu packages linux) %default-extra-linux-options)) + +(define config->string + (@@ (gnu packages linux) config->string)) + +(define (make-linux-xanmod-source version xanmod-revision hash-string) + (origin + (method url-fetch) + (uri (string-append "https://gitlab.com/xanmod/linux/-/archive/" + version "-" xanmod-revision ".tar.bz2")) + (sha256 hash-string))) + +(define* (make-linux-xanmod version xanmod-revision instruction-set source + #:key + (name "xanmod") + (xanmod-defconfig (string-append "config_x86-64-" instruction-set))) + (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 + ;; EXTRAVERSION is used instead. + (add-after 'unpack 'remove-localversion + (lambda _ + (when (file-exists? "localversion") + (delete-file "localversion")))) + (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 +distribution with custom settings and new features. It's built to provide a +stable, responsive and smooth desktop experience.")))) + +(define-public xanmod-version "6.5.4") +(define-public xanmod-revision "xanmod1") +(define-public xanmod-instruction-set "v3") +(define-public xanmod-source + (make-linux-xanmod-source + xanmod-version + xanmod-revision + (base32 "1cff9blxixvzflw8gxpqhjvvv06kxdrrwwbl5pbymc9hcr80jj96"))) + +(define-public xanmod + (make-linux-xanmod xanmod-version + xanmod-revision + xanmod-instruction-set + xanmod-source))