initial commit

This commit is contained in:
Henry Hiles 2025-08-31 10:43:23 -04:00
commit f5c962b566
No known key found for this signature in database
8 changed files with 7248 additions and 0 deletions

83
config/sdm845/kernel.nix Normal file
View file

@ -0,0 +1,83 @@
# Based on https://github.com/linyinfeng/dotfiles/blob/ff3e52e30fcc27b8119792aee9b3afe9ce4739b6/nixos/profiles/boot/kernel/sdm845-mainline/default.nix, thank you!
{
inputs,
config,
pkgs,
lib,
...
}: let
tag = "sdm845-6.16-rc2-4";
hash = "sha256-Nu7BwSl40Ytm7nCzyctNed7nqwq7NcVVxHLF3KFMKC4=";
version = lib.elemAt (lib.strings.match "sdm845-([0-9\\.]+(-rc[0-9]+)?)(-[a-zA-Z0-9\\-]+)?" tag) 0;
major = lib.versions.major version;
minor = lib.versions.minor version;
inherit (lib.kernel) yes module;
structuredExtraConfig =
import ../lib/adjust-standalone-config.nix (import ./_config.nix {inherit lib;})
// {
# for envfs
EROFS_FS = yes;
NET_9P = module;
CONFIG_NET_9P_VIRTIO = module;
"9P_FS" = module;
# other
RUST = yes;
};
in {
#
passthru.kernel = {
conf2nix = inputs.conf2nix.lib.conf2nix {
configFile = "${inputs.pmaports}/device/community/linux-postmarketos-qcom-sdm845/config-postmarketos-qcom-sdm845.aarch64";
inherit (config.boot.kernelPackages) kernel;
preset = "standalone";
};
};
boot = {
kernelPackages = let
linux_sdm845_fn = {
buildLinux,
lib,
...
} @ args:
buildLinux (
args
// {
inherit version;
modDirVersion = "${lib.versions.pad 3 version}-sdm845";
extraMeta.branch = lib.versions.majorMinor version;
src = pkgs.fetchFromGitLab {
owner = "sdm845-mainline";
repo = "linux";
rev = tag;
inherit hash;
};
defconfig = "defconfig sdm845.config";
enableCommonConfig = false;
autoModules = false;
inherit structuredExtraConfig;
stdenv = let
originalPlatform = pkgs.stdenv.hostPlatform;
hostPlatform = assert pkgs.stdenv.hostPlatform.isAarch64;
originalPlatform
// {
linux-kernel =
originalPlatform.linux-kernel
// {
extraConfig = "";
};
};
in
pkgs.stdenv // {inherit hostPlatform;};
}
// (args.argsOverride or {})
);
linux_sdm845 = pkgs.callPackage linux_sdm845_fn {
kernelPatches = lib.filter (p: !(lib.elem p.name [])) (
pkgs."linuxPackages_${major}_${minor}".kernel.kernelPatches or []
);
};
in
pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_sdm845);
};
}