diff --git a/.github/workflows/cachix.yml b/.github/workflows/cachix.yml index c71c1b4..a4f90ff 100644 --- a/.github/workflows/cachix.yml +++ b/.github/workflows/cachix.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - kernelVersion: ["54", "510", "511"] + kernelVersion: ["54", "510", "512"] sched: [bmq, cfs, cacule, muqss, pds] include: - kernelVersion: "510" diff --git a/flake.nix b/flake.nix index d93dc2f..4babfd8 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,7 @@ }; }) (pkgs.lib.cartesianProductOfSets { scheduler = ["bmq" "cfs" "cacule" "muqss" "pds"]; - version = ["5.4" "5.10" "5.11"]; + version = ["5.4" "5.10" "5.12"]; })) // { "linux_tkg-upds-510" = callPackage ./packages/linux-tkg { version = "5.10"; diff --git a/packages/linux-tkg/default.nix b/packages/linux-tkg/default.nix index 94c0c76..094791e 100644 --- a/packages/linux-tkg/default.nix +++ b/packages/linux-tkg/default.nix @@ -44,31 +44,7 @@ let tkg = "2da317c20ed6f70085b195639b9aad2cacf31ab5"; - majorVersion = - if lib.versions.major version == "5" - then "5" - else throw "Unsupported major version"; - minorVersion = lib.versions.minor version; - patchVersion = - if minorVersion == "4" then "128" - else if minorVersion == "10" then "46" - else if minorVersion == "12" then "13" - else throw "Unsupported minor version"; - - mmp = "${majorVersion}.${minorVersion}.${patchVersion}"; - mm = "${majorVersion}.${minorVersion}"; - - kernelUrl = name: sha256: builtins.fetchurl { - inherit sha256; - url = "https://cdn.kernel.org/pub/linux/kernel/v${majorVersion}.x/${name}.xz"; - }; - - tkgSource = fetchFromGitHub { - owner = "Frogging-Family"; - repo = "linux-tkg"; - rev = "2da317c20ed6f70085b195639b9aad2cacf31ab5"; - sha256 = "06a5fpafids8nc550pcsyvar2igphi6bpghqzl6cp48hg6p2g07w"; - }; + sources = import ./sources.nix { inherit fetchFromGitHub lib version; }; boolToKernel = bool: with lib.kernel; if bool then yes else no; boolToKernelMod = bool: with lib.kernel; if bool then module else no; @@ -105,10 +81,10 @@ let "5.4" = { TP_SMAPI = module; RAID6_USE_PREFER_GEN = yes; - RCU_BOOST_DELAY = freeform 0; + RCU_BOOST_DELAY = freeform "0"; }; }; - in base // (if builtins.hasAttr mm extras then extras.${mm} else {}); + in base // (if builtins.hasAttr version extras then extras.${version} else {}); debug = if debug @@ -154,7 +130,7 @@ let in if builtins.hasAttr scheduler schedConfigs then - if builtins.elem scheduler supportedSchedulers.${mm} + if builtins.elem scheduler supportedSchedulers.${version} then schedConfigs.${scheduler} else throw "Unsupported scheduler for kernel version" else throw "Unknown scheduler"; @@ -260,7 +236,7 @@ let "0003-glitched-base" ] ++ lib.optional miscAdditions "0012-misc-additions" - ++ lib.optionals (mm == "5.12") [ + ++ lib.optionals (version == "5.12") [ "0001-mm-Support-soft-dirty-flag-reset-for-VA-range" "0002-mm-Support-soft-dirty-flag-read-with-reset" ] @@ -272,33 +248,33 @@ let }; map = { muqss = [ - "0004-${mm}-ck1" + "0004-${version}-ck1" "0004-glitched-muqss" ]; upds = [ - "0005-v${mm}_undead-pds099o" + "0005-v${version}_undead-pds099o" "0005-undead-glitched-pds" ]; - pds = if mm == "5.4" + pds = if version == "5.4" then [ - "0005-v${mm}_undead-pds099o" + "0005-v${version}_undead-pds099o" "0005-glitched-pds" ] else [ - "0009-prjc_v${mm}-r${prjcRevisions.${mm}}" + "0009-prjc_v${version}-r${prjcRevisions.${version}}" "0005-glitched-pds" ]; - bmq = if mm == "5.4" + bmq = if version == "5.4" then [ "0009-bmq_v5.4-r2" "0009-glitched-bmq" ] else [ - "0009-prjc_v${mm}-r${prjcRevisions.${mm}}" + "0009-prjc_v${version}-r${prjcRevisions.${version}}" "0009-glitched-bmq" ]; cacule = [ - "0003-cacule-${mm}" + "0003-cacule-${version}" "0003-glitched-cfs" ]; cfs = ["0003-glitched-cfs"]; @@ -313,10 +289,10 @@ let let map = rec { muqss = "0004-glitched-ondemand-muqss"; upds = "0005-undead-glitched-ondemand-pds"; - pds = if mm == "5.4" + pds = if version == "5.4" then "0005-glitched-ondemand-pds" else "0009-glitched-ondemand-bmq"; - bmq = if mm != "5.4" + bmq = if version != "5.4" then "0009-glitched-ondemand-bmq" else {}; }; in @@ -324,21 +300,21 @@ let then [map.${scheduler}] else [] ) - ++ lib.optional bcachefs "0008-${mm}-bcachefs" - ++ lib.optional fsync "0007-v${mm}-fsync" - ++ lib.optional futex2 "0007-v${mm}-futex2_interface" - ++ lib.optional winesync "0007-v${mm}-winesync" + ++ lib.optional bcachefs "0008-${version}-bcachefs" + ++ lib.optional fsync "0007-v${version}-fsync" + ++ lib.optional futex2 "0007-v${version}-futex2_interface" + ++ lib.optional winesync "0007-v${version}-winesync" ++ lib.optional zfsFix "0011-ZFS-fix"; toPatch = name: { inherit name; - patch = "${tkgSource}/linux-tkg-patches/${mm}/${name}.patch"; + patch = "${sources.tkg}/linux-tkg-patches/${version}/${name}.patch"; }; tkgPatches = builtins.map (e: toPatch e) (lib.naturalSort patchNames); suffix = if builtins.stringLength localVersion != 0 then "-tkg-${localVersion}" else "-tkg"; in buildLinux(args // rec { - version = "${mmp}-tkg"; + version = "${sources.fullVersion}-tkg"; modDirVersion = version + suffix; isZen = zenify; @@ -351,9 +327,9 @@ in buildLinux(args // rec { kernelPatches = #args.kernelPatches [{ - name = "patch-${mmp}"; - patch = kernelUrl "patch-${mmp}" "17d38hns5qfbw1pajpa5y38v86r49nqnw7a3pwsay5fapj69z8w4"; + name = "patch-${version}"; + patch = sources.patchSrc; }] ++ tkgPatches; - src = kernelUrl "linux-${mm}.tar" "0rn3z942vjc7bixjw066rm6kcr0x0wzgxqfq1f6xd113pzrgc3bx"; + src = sources.kernelSrc; } // (args.argsOverride or {})) diff --git a/packages/linux-tkg/sources.nix b/packages/linux-tkg/sources.nix new file mode 100644 index 0000000..1619844 --- /dev/null +++ b/packages/linux-tkg/sources.nix @@ -0,0 +1,44 @@ +{ fetchFromGitHub, lib, version }: +let + vMap = { + "5.4" = { + version = "5.4.128"; + baseHash = "14glqppn90z79b36k4c76mv90q933i2bg54rgwlcl2v7n608jcxz"; + patchHash = "04ylr4f4amzviqljhc6i79dqhjmjx45shf0rply1v5zqlfndb459"; + }; + "5.10" = { + version = "5.10.46"; + baseHash = "0hyav21vzz5v1kgb455pcz9ncg5qqzxmp60na290scwq7vj9kpyw"; + patchHash = "0jl31aayxyns3pkvm9mycvwakg2i45win9nfbirhcz7z5gfsa7fg"; + }; + "5.12" = { + version = "5.12.13"; + baseHash = "0rn3z942vjc7bixjw066rm6kcr0x0wzgxqfq1f6xd113pzrgc3bx"; + patchHash = "17d38hns5qfbw1pajpa5y38v86r49nqnw7a3pwsay5fapj69z8w4"; + }; + }; + + tkg = fetchFromGitHub { + owner = "Frogging-Family"; + repo = "linux-tkg"; + rev = "2da317c20ed6f70085b195639b9aad2cacf31ab5"; + sha256 = "06a5fpafids8nc550pcsyvar2igphi6bpghqzl6cp48hg6p2g07w"; + }; + + ver = + if builtins.hasAttr version vMap + then vMap.${version} + else throw "Unsupported version"; +in rec { + inherit tkg; + + fullVersion = ver.version; + kernelSrc = builtins.fetchurl { + url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major version}.x/linux-${version}.tar.xz"; + sha256 = ver.baseHash; + }; + patchSrc = builtins.fetchurl { + url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major version}.x/patch-${fullVersion}.xz"; + sha256 = ver.patchHash; + }; +}