mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
system.kernel: fix for surface
This commit is contained in:
@@ -31,7 +31,7 @@ inputs:
|
||||
nixpkgs.march = "skylake";
|
||||
grub.installDevice = "efi";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
kernel.patches = [ "cjktty" "lantian" ];
|
||||
kernel.patches = [ "cjktty" "lantian" "surface" ];
|
||||
networking.hostname = "surface";
|
||||
};
|
||||
hardware =
|
||||
@@ -61,21 +61,6 @@ inputs:
|
||||
};
|
||||
bugs = [ "xmunet" ];
|
||||
};
|
||||
boot.kernelPackages =
|
||||
let
|
||||
originalKernel = inputs.pkgs.linuxPackages_xanmod_latest.kernel;
|
||||
version = originalKernel.version;
|
||||
majorVersion =
|
||||
let versionArray = builtins.splitVersion version;
|
||||
in "${builtins.elemAt versionArray 0}.${builtins.elemAt versionArray 1}";
|
||||
repoFile = "${inputs.topInputs.nixos-hardware}/microsoft/surface/common/kernel/linux-package.nix";
|
||||
inherit (inputs.pkgs.callPackage repoFile {}) repos;
|
||||
patchDir = repos.linux-surface + "/patches/${majorVersion}";
|
||||
patchFile = "${inputs.topInputs.nixos-hardware}/microsoft/surface/common/kernel/linux-6.6.x/patches.nix";
|
||||
kernelPatches = inputs.pkgs.callPackage patchFile { inherit (inputs.lib) kernel; inherit version patchDir; };
|
||||
in
|
||||
inputs.lib.mkForce (inputs.pkgs.linuxPackagesFor (originalKernel.override
|
||||
(prev: { kernelPatches = prev.kernelPatches ++ kernelPatches; })));
|
||||
environment.systemPackages = with inputs.pkgs; [ maliit-keyboard maliit-framework ];
|
||||
};
|
||||
}
|
||||
|
||||
27
flake.lock
generated
27
flake.lock
generated
@@ -970,6 +970,22 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"linux-surface": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1707902187,
|
||||
"narHash": "sha256-mGxhAvpBJ3wSgecz9mwghTjRUjwcsjE0cqdcUODLS+0=",
|
||||
"owner": "linux-surface",
|
||||
"repo": "linux-surface",
|
||||
"rev": "fcc945709d89716a0012d3d42d0e9af0f7cd60ee",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "linux-surface",
|
||||
"repo": "linux-surface",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lmix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -1308,15 +1324,15 @@
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1705312285,
|
||||
"narHash": "sha256-rd+dY+v61Y8w3u9bukO/hB55Xl4wXv4/yC8rCGVnK5U=",
|
||||
"owner": "NixOS",
|
||||
"lastModified": 1707989601,
|
||||
"narHash": "sha256-Zq81JV6NnWI4dDOYVB7VeP3BEv/HswEvIvIwrcUZoaA=",
|
||||
"owner": "CHN-beta",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "bee2202bec57e521e3bd8acd526884b9767d7fa0",
|
||||
"rev": "b3e300fcdab6c004e25de94d5e23ae78a267ec4b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"owner": "CHN-beta",
|
||||
"repo": "nixos-hardware",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -1838,6 +1854,7 @@
|
||||
"fluent-kde": "fluent-kde",
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
"linux-surface": "linux-surface",
|
||||
"lmix": "lmix",
|
||||
"matplotplusplus": "matplotplusplus",
|
||||
"misskey": "misskey",
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
};
|
||||
nix-doom-emacs = { url = "github:nix-community/nix-doom-emacs"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nur-linyinfeng = { url = "github:linyinfeng/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
nixos-hardware.url = "github:CHN-beta/nixos-hardware";
|
||||
envfs = { url = "github:Mic92/envfs"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
|
||||
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
|
||||
@@ -63,6 +63,7 @@
|
||||
cascade = { url = "github:CHN-beta/cascade"; flake = false; };
|
||||
blurred-wallpaper = { url = "github:bouteillerAlan/blurredwallpaper"; flake = false; };
|
||||
slate = { url = "github:TheBigWazz/Slate"; flake = false; };
|
||||
linux-surface = { url = "github:linux-surface/linux-surface"; flake = false; };
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
lib:
|
||||
{
|
||||
attrsToList = Attrs: builtins.map ( name: { inherit name; value = Attrs.${name}; } ) ( builtins.attrNames Attrs );
|
||||
attrsToList = attrs: builtins.map (name: { inherit name; value = attrs.${name}; }) (builtins.attrNames attrs);
|
||||
mkConditional = condition: trueResult: falseResult: let inherit (lib) mkMerge mkIf; in
|
||||
mkMerge [ ( mkIf condition trueResult ) ( mkIf (!condition) falseResult ) ];
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ inputs:
|
||||
patches =
|
||||
{
|
||||
cjktty =
|
||||
{
|
||||
[{
|
||||
name = "cjktty";
|
||||
patch =
|
||||
let
|
||||
version = builtins.splitVersion inputs.config.boot.kernelPackages.kernel.version;
|
||||
@@ -60,9 +61,10 @@ inputs:
|
||||
};
|
||||
extraStructuredConfig =
|
||||
{ FONT_CJK_16x16 = inputs.lib.kernel.yes; FONT_CJK_32x32 = inputs.lib.kernel.yes; };
|
||||
};
|
||||
}];
|
||||
lantian =
|
||||
{
|
||||
[{
|
||||
name = "lantian";
|
||||
patch = null;
|
||||
# pick from xddxdd/nur-packages dce93a
|
||||
extraStructuredConfig = with inputs.lib.kernel;
|
||||
@@ -79,9 +81,47 @@ inputs:
|
||||
HZ_250 = inputs.lib.mkForce no;
|
||||
HZ = inputs.lib.mkForce (freeform "1000");
|
||||
};
|
||||
};
|
||||
}];
|
||||
surface =
|
||||
let
|
||||
version =
|
||||
let versionArray = builtins.splitVersion inputs.config.boot.kernelPackages.kernel.version;
|
||||
in "${builtins.elemAt versionArray 0}.${builtins.elemAt versionArray 1}";
|
||||
kernelPatches = builtins.map
|
||||
(file:
|
||||
{
|
||||
name = "surface-${file.name}";
|
||||
patch = "${inputs.topInputs.linux-surface}/patches/${version}/${file.name}";
|
||||
})
|
||||
(builtins.filter
|
||||
(file: file.value == "regular")
|
||||
(inputs.localLib.attrsToList (builtins.readDir
|
||||
"${inputs.topInputs.linux-surface}/patches/${version}")));
|
||||
kernelConfig = builtins.removeAttrs
|
||||
(builtins.listToAttrs (builtins.concatLists (builtins.map
|
||||
(configString:
|
||||
if builtins.match "CONFIG_.*=." configString == [] then
|
||||
(
|
||||
let match = builtins.match "CONFIG_(.*)=(.)" configString; in with inputs.lib.kernel;
|
||||
[{
|
||||
name = builtins.elemAt match 0;
|
||||
value = { m = module; y = yes; }.${builtins.elemAt match 1};
|
||||
}]
|
||||
)
|
||||
else if builtins.match "# CONFIG_.* is not set" configString == [] then
|
||||
[{
|
||||
name = builtins.elemAt (builtins.match "# CONFIG_(.*) is not set" configString) 0;
|
||||
value = inputs.lib.kernel.unset;
|
||||
}]
|
||||
else if builtins.match "#.*" configString == [] then []
|
||||
else if configString == "" then []
|
||||
else throw "could not parse: ${configString}"
|
||||
)
|
||||
(inputs.lib.strings.splitString "\n"
|
||||
(builtins.readFile "${inputs.topInputs.linux-surface}/configs/surface-${version}.config")))))
|
||||
[ "VIDEO_IPU3_IMGU" ];
|
||||
in kernelPatches ++ [{ name = "surface-config"; patch = null; extraStructuredConfig = kernelConfig; }];
|
||||
};
|
||||
in
|
||||
builtins.map (name: { inherit name; } // patches.${name}) kernel.patches;
|
||||
in builtins.concatLists (builtins.map (name: patches.${name}) kernel.patches);
|
||||
};};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user