add current xanmod kernel

master
Florian Schrofner 2023-09-22 20:35:13 +02:00
commit 49e6a611c1
Signed by: schrofi
GPG Key ID: 576B512668FB44EE
1 changed files with 106 additions and 0 deletions

106
schrofi/packages/xanmod.scm Normal file
View File

@ -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))