init cachy kernel
This commit is contained in:
11
packages/linux-cachyos/lib/kconfig-to-nix.nix
Normal file
11
packages/linux-cachyos/lib/kconfig-to-nix.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ runCommand, configfile }:
|
||||
# taken from <nixpkgs>/pkgs/os-specific/linux/kernel/manual-config.nix
|
||||
runCommand "config.nix" { } ''
|
||||
echo "{" > "$out"
|
||||
while IFS='=' read key val; do
|
||||
[ "x''${key#CONFIG_}" != "x$key" ] || continue
|
||||
no_firstquote="''${val#\"}";
|
||||
echo ' "'"$key"'" = "'"''${no_firstquote%\"}"'";' >> "$out"
|
||||
done < "${configfile}"
|
||||
echo "}" >> $out
|
||||
''
|
||||
102
packages/linux-cachyos/lib/llvm-module-overlay.nix
Normal file
102
packages/linux-cachyos/lib/llvm-module-overlay.nix
Normal file
@@ -0,0 +1,102 @@
|
||||
{ final, ... }:
|
||||
kernel: _finalModules: prevModules:
|
||||
|
||||
let
|
||||
# Helps when overriding both inputs and outputs attrs.
|
||||
multiOverride = prev: newInputs: (prev.override newInputs).overrideAttrs;
|
||||
|
||||
# Helps replacing all the dependencies in a derivation.
|
||||
overrideFull =
|
||||
newScope: prev:
|
||||
let
|
||||
args = prev.override.__functionArgs;
|
||||
names = builtins.filter (arg: builtins.hasAttr arg newScope) (builtins.attrNames args);
|
||||
values = lib.attrsets.genAttrs names (arg: builtins.getAttr arg newScope);
|
||||
in
|
||||
prev.override values;
|
||||
|
||||
# Don't waste user's time.
|
||||
markBroken =
|
||||
drv:
|
||||
drv.overrideAttrs (prevAttrs: {
|
||||
meta = (prevAttrs.meta or { }) // {
|
||||
broken = true;
|
||||
};
|
||||
});
|
||||
|
||||
fixNoVideo =
|
||||
prevDrv:
|
||||
prevDrv.overrideAttrs (prevAttrs: {
|
||||
passthru = prevAttrs.passthru // {
|
||||
settings = overrideFull (final // final.xorg) prevAttrs.passthru.settings;
|
||||
};
|
||||
});
|
||||
in
|
||||
with prevModules;
|
||||
{
|
||||
evdi =
|
||||
multiOverride prevModules.evdi
|
||||
{
|
||||
inherit (final) python3;
|
||||
}
|
||||
(prevAttrs: rec {
|
||||
env = prevAttrs.env // {
|
||||
CFLAGS = "";
|
||||
};
|
||||
makeFlags = prevAttrs.makeFlags ++ [
|
||||
"CFLAGS=${
|
||||
builtins.replaceStrings [ "discarded-qualifiers" ] [ "ignored-qualifiers" ] prevAttrs.env.CFLAGS
|
||||
}"
|
||||
];
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail 'discarded-qualifiers' 'ignored-qualifiers'
|
||||
'';
|
||||
# Don't build userspace stuff
|
||||
postBuild = "";
|
||||
installPhase =
|
||||
builtins.replaceStrings [ "install -Dm755 library/libevdi.so" ] [ "#" ]
|
||||
prevAttrs.installPhase;
|
||||
});
|
||||
nvidia_x11 = fixNoVideo nvidia_x11;
|
||||
nvidia_x11_beta = fixNoVideo nvidia_x11_beta;
|
||||
nvidia_x11_latest = fixNoVideo nvidia_x11_latest;
|
||||
nvidia_x11_legacy535 = fixNoVideo nvidia_x11_legacy535;
|
||||
nvidia_dc_535 = markBroken nvidia_dc_535;
|
||||
nvidia_dc_565 = markBroken nvidia_dc_565;
|
||||
nvidia_x11_legacy470 = markBroken nvidia_x11_legacy470;
|
||||
nvidiaPackages = nvidiaPackages.extend (
|
||||
_finalNV: prevNV: with prevNV; {
|
||||
production = fixNoVideo production;
|
||||
stable = fixNoVideo stable;
|
||||
beta = fixNoVideo beta;
|
||||
vulkan_beta = fixNoVideo vulkan_beta;
|
||||
latest = fixNoVideo latest;
|
||||
legacy_535 = fixNoVideo legacy_535;
|
||||
dc_535 = markBroken dc_535;
|
||||
dc_565 = markBroken dc_565;
|
||||
legacy_470 = markBroken legacy_470;
|
||||
}
|
||||
);
|
||||
# perf needs systemtap fixed first
|
||||
perf = markBroken perf;
|
||||
virtualbox =
|
||||
multiOverride virtualbox
|
||||
{
|
||||
inherit (final) virtualbox;
|
||||
}
|
||||
(prevAttrs: {
|
||||
makeFlags = prevAttrs.makeFlags ++ kernel.commonMakeFlags;
|
||||
});
|
||||
xpadneo = xpadneo.override {
|
||||
inherit (final) bluez;
|
||||
};
|
||||
zenpower = zenpower.overrideAttrs (prevAttrs: {
|
||||
makeFlags =
|
||||
prevAttrs.makeFlags
|
||||
++ kernel.commonMakeFlags
|
||||
++ [
|
||||
"KBUILD_CFLAGS="
|
||||
];
|
||||
});
|
||||
}
|
||||
30
packages/linux-cachyos/lib/llvm-pkgs.nix
Normal file
30
packages/linux-cachyos/lib/llvm-pkgs.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
final,
|
||||
flakes,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# Don't waste user's time.
|
||||
markBroken =
|
||||
drv:
|
||||
drv.overrideAttrs (prevAttrs: {
|
||||
meta = (prevAttrs.meta or { }) // {
|
||||
broken = true;
|
||||
};
|
||||
});
|
||||
in
|
||||
(final.pkgsLLVM.extend flakes.self.overlays.default).extend (
|
||||
_finalLLVM: prevLLVM: {
|
||||
inherit (final)
|
||||
dbus
|
||||
libdrm
|
||||
libgbm
|
||||
libGL
|
||||
libxv
|
||||
libtirpc
|
||||
wayland
|
||||
xorg
|
||||
;
|
||||
cups = markBroken prevLLVM.cups;
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user