refactoring

- overlays/{linux,wine-osu}.nix -> packages/{linux-lava,wine-osu}/
- overlays/misc/ -> overlays/patches/
- overlays/misc/0001...patch -> packages/linux-lava/si...patch
- overlays/misc/wine/ -> packages/wine-osu/patches/
- flake.nix:
  - overlays are dynamically read from overlays/
  - define custom packages separately
- packages/*
  - now imported using callPackage
This commit is contained in:
LavaDesu 2021-06-26 23:48:15 +07:00
parent 268a85c2ef
commit d9b73bfd43
Signed by: cilly
GPG key ID: 6500251E087653C9
15 changed files with 210 additions and 200 deletions

View file

@ -9,6 +9,26 @@
outputs = inputs: with inputs; outputs = inputs: with inputs;
let let
getPaths = root: builtins.map
(path: root + ("/" + path)) # Prepends root path
(builtins.attrNames (builtins.readDir root)); # Reads root path
customPackages = pkgs:
let
callPackage = pkgs.callPackage;
in {
linux-lava = callPackage ./packages/linux-lava {};
wine-osu = callPackage ./packages/wine-osu { inherit getPaths; };
};
overlays = (builtins.map
(path: import path) # Imports path
(builtins.filter
(path: nixpkgs.lib.hasSuffix ".nix" path) # Checks file extension
(getPaths ./overlays)
)
) ++ [(self: super: customPackages super)];
revCount = "297098"; revCount = "297098";
base = { config, ... }: { base = { config, ... }: {
system = { system = {
@ -19,23 +39,14 @@
}; };
}; };
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
nixpkgs.overlays = builtins.attrValues overlays; nixpkgs.overlays = overlays;
}; };
hm-base = { hm-base = {
home-manager.useGlobalPkgs = true; home-manager = {
home-manager.useUserPackages = true; useGlobalPkgs = true;
}; useUserPackages = true;
overlays = { };
discord = import ./overlays/discord.nix;
linux = import ./overlays/linux.nix;
material-icons = import ./overlays/material-icons.nix;
mps-youtube = import ./overlays/mps-youtube.nix;
picom = import ./overlays/picom.nix;
polybar = import ./overlays/polybar.nix;
transcrypt = import ./overlays/transcrypt.nix;
winetricks = import ./overlays/winetricks.nix;
wine-osu = import ./overlays/wine-osu.nix;
xinit = import ./overlays/xinit.nix;
}; };
in in
{ {
@ -48,17 +59,7 @@
./hosts/winter ./hosts/winter
secrets.nixosModules.winter secrets.nixosModules.winter
]; ];
specialArgs = { inherit overlays; };
}; };
packages.x86_64-linux = customPackages nixpkgs.legacyPackages.x86_64-linux;
packages.x86_64-linux =
let
pkgs = import nixpkgs {
overlays = builtins.attrValues overlays;
system = "x86_64-linux";
};
in {
inherit (pkgs) linux-lava wine-osu;
};
}; };
} }

View file

@ -1,4 +1,4 @@
{ config, pkgs, ...}: { { config, pkgs, ... }: {
powerManagement.cpuFreqGovernor = "ondemand"; powerManagement.cpuFreqGovernor = "ondemand";
boot = { boot = {
loader = { loader = {

View file

@ -1,126 +0,0 @@
self: super: {
linux-lava = super.buildLinux (
let
major = "5";
minor = "12";
patch = "13";
tkg = "2da317c20ed6f70085b195639b9aad2cacf31ab5";
mm = "${major}.${minor}";
mmp = "${major}.${minor}.${patch}";
kernelUrl = name: sha256: builtins.fetchurl {
inherit sha256;
url = "https://cdn.kernel.org/pub/linux/kernel/v${major}.x/${name}.xz";
};
tkgPatch = name: sha256: {
inherit name;
patch = builtins.fetchurl {
inherit sha256;
url = "https://raw.githubusercontent.com/Frogging-Family/linux-tkg/${tkg}/linux-tkg-patches/${mm}/${name}.patch";
};
};
in {
version = "${mmp}-tkg-Lava";
isZen = true;
# TODO:
# some stuff is set in pkgs/os-specific/linux/kernel/common-config.nix
# but i have no idea how to change it
structuredExtraConfig = with super.lib.kernel; builtins.mapAttrs (_: value: super.lib.mkForce value) {
LOCALVERSION = freeform "-tkg-Lava";
ZENIFY = yes;
FUTEX2 = yes;
MHASWELL = yes;
WINESYNC = module;
# timers
HZ_PERIODIC = no;
NO_HZ = yes;
NO_HZ_COMMON = yes;
NO_HZ_FULL = yes;
NO_HZ_IDLE = no;
CONTEXT_TRACKING = yes;
CONTEXT_TRACKING_FORCE = yes;
# HZ_100 = yes;
HZ_1000 = yes;
HZ_1000_NODEF = yes;
# preempt
PREEMPT = yes;
PREEMPT_COUNT = yes;
PREEMPT_VOLUNTARY = no;
PREEMPTION = yes;
PREEMPT_DYNAMIC = yes;
# scheduler
# SCHED_ALT = yes;
# SCHED_PDS = yes;
CACULE_SCHED = yes;
# cacule stuff
SCHED_AUTOGROUP = yes;
BSD_PROCESS_ACCT = no;
TASK_XACCT = no;
CGROUP_CPUACCT = no;
CGROUP_DEBUG = no;
# disable numa
NUMA = no;
AMD_NUMA = no;
X86_64_ACPI_NUMA = no;
NODES_SPAN_OTHER_NODES = no;
NUMA_EMU = no;
NEED_MULTIPLE_NODES = no;
USE_PERCPU_NUMA_NODE_ID = no;
ACPI_NUMA = no;
# disable misc debugging
SLUB_DEBUG = no;
PM_DEBUG = no;
PM_ADVANCED_DEBUG = no;
PM_SLEEP_DEBUG = no;
ACPI_DEBUG = no;
SCHED_DEBUG = no;
LATENCYTOP = no;
DEBUG_PREEMPT = no;
};
ignoreConfigErrors = true;
src = kernelUrl "linux-${mm}.tar" "0rn3z942vjc7bixjw066rm6kcr0x0wzgxqfq1f6xd113pzrgc3bx";
kernelPatches = [
# Kernel version patch
{
name = "patch-${patch}";
patch = kernelUrl "patch-${mmp}" "17d38hns5qfbw1pajpa5y38v86r49nqnw7a3pwsay5fapj69z8w4";
}
# AMD SI manual clocking
{
name = "amd";
patch = ./misc/0001-Lava-s-amdgpu-patches.patch;
}
# Graysky gcc patches
{
name = "graysky-gcc";
patch = builtins.fetchurl {
url = "https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/d2e7942c19ee568638d3795cf52db5274a90ce0a/more-uarches-for-kernel-5.8+.patch";
sha256 = "16jbknjlg12jxbj8cjkk01djvr01n9zz7qlzxppcqizmz55vk0wh";
};
}
# TK-Glitch patches
( tkgPatch "0002-clear-patches" "1h1gx6rq2c961d36z1szqv9xpq1xgz2bhqjsyb03jjdrdzlcv9rm" )
( tkgPatch "0003-cacule-${mm}" "1rgdk1x514xsjwcjjcdmggbaj6biql5p41skn98ysqbjaw7k22ib" )
( tkgPatch "0003-glitched-base" "1dg177i3y54z5nadc5678hm67angram2vlr314mpxv3jgsh7vj8s" )
( tkgPatch "0003-glitched-cfs" "1cm4s72pymxnh37da84qrzvrwbbwagk46m1xsk99ir7cjb1l1zay" )
# ( tkgPatch "0005-glitched-pds" "0833awp8n9ngyl5spx8znwyw1lj3nacp8vg7ffysw0j5r8akv9pw" )
( tkgPatch "0007-v${mm}-fsync" "0mplwdglw58bmkkxix4ccwgax3r02gahax9042dx33mybdnbl0mk" )
( tkgPatch "0007-v${mm}-futex2_interface" "1j29zyx2s85scfhbprgb9cs11rp50glbzczl4plphli8wds342pw" )
( tkgPatch "0007-v${mm}-winesync" "1av2k86ns0zc3lmgbfdch1z2a808brp2jvsfl4cwwlwwb51qzipp" )
# ( tkgPatch "0009-prjc_v${mm}-r1" "1z731jiwyc7z4d5hzd6szrxnvw0iygbqx82y2anzm32n22731dqv" )
( tkgPatch "0012-misc-additions" "092ws9v1snk61i6x3gbqm5m803zd81wykkdxizn7knvy2r611cbz")
];
});
}

View file

@ -2,7 +2,7 @@ self: super: {
transcrypt = super.transcrypt.overrideAttrs(o: rec { transcrypt = super.transcrypt.overrideAttrs(o: rec {
version = "2.1.0"; version = "2.1.0";
patches = [ ./misc/transcrypt.patch ]; patches = [ ./patches/transcrypt.patch ];
src = super.fetchFromGitHub { src = super.fetchFromGitHub {
owner = "elasticdog"; owner = "elasticdog";
repo = "transcrypt"; repo = "transcrypt";

View file

@ -1,45 +0,0 @@
self: super: {
wine-osu = (super.wineStaging.overrideDerivation(o: {
patches = (o.patches or []) ++ builtins.map (e: ./misc/wine + ("/" + e)) (builtins.attrNames (builtins.readDir ./misc/wine));
})).override {
wineRelease = "staging";
wineBuild = "wineWow";
pngSupport = true;
jpegSupport = true;
tiffSupport = true;
gettextSupport = true;
fontconfigSupport = true;
alsaSupport = true;
gtkSupport = true;
openglSupport = true;
tlsSupport = true;
gstreamerSupport = true;
#cupsSupport = true;
colorManagementSupport = true;
dbusSupport = true;
mpg123Support = true;
#openalSupport = true;
#openclSupport = true;
#cairoSupport = true;
#odbcSupport = true;
netapiSupport = true;
cursesSupport = true;
vaSupport = true;
pcapSupport = true;
#v4lSupport = true;
#saneSupport = true;
gsmSupport = true;
#gphoto2Support = true;
#ldapSupport = true;
pulseaudioSupport = true;
udevSupport = true;
xineramaSupport = true;
xmlSupport = true;
vulkanSupport = true;
sdlSupport = true;
faudioSupport = true;
vkd3dSupport = true;
mingwSupport = true;
};
}

View file

@ -4,7 +4,7 @@ self: super: {
# Some info: # Some info:
# - Make startx use $XAUTHORITY as server auth files instead of .serverauth.$$ # - Make startx use $XAUTHORITY as server auth files instead of .serverauth.$$
# - Make startx respect $XINITRC and $XSERVERRC # - Make startx respect $XINITRC and $XSERVERRC
patches = o.patches ++ [ ./misc/startx.patch ]; patches = o.patches ++ [ ./patches/startx.patch ];
}); });
}; };
} }

View file

@ -0,0 +1,129 @@
{
buildLinux,
kernelPatches,
lib,
...
} @ args:
let
major = "5";
minor = "12";
patch = "13";
tkg = "2da317c20ed6f70085b195639b9aad2cacf31ab5";
mm = "${major}.${minor}";
mmp = "${major}.${minor}.${patch}";
kernelUrl = name: sha256: builtins.fetchurl {
inherit sha256;
url = "https://cdn.kernel.org/pub/linux/kernel/v${major}.x/${name}.xz";
};
tkgPatch = name: sha256: {
inherit name;
patch = builtins.fetchurl {
inherit sha256;
url = "https://raw.githubusercontent.com/Frogging-Family/linux-tkg/${tkg}/linux-tkg-patches/${mm}/${name}.patch";
};
};
in buildLinux (args // {
version = "${mmp}-tkg-Lava";
isZen = true;
# TODO:
# some stuff is set in pkgs/os-specific/linux/kernel/common-config.nix
# but i have no idea how to change it
structuredExtraConfig = with lib.kernel; builtins.mapAttrs (_: value: lib.mkForce value) {
LOCALVERSION = freeform "-tkg-Lava";
ZENIFY = yes;
FUTEX2 = yes;
MHASWELL = yes;
WINESYNC = module;
# timers
HZ_PERIODIC = no;
NO_HZ = yes;
NO_HZ_COMMON = yes;
NO_HZ_FULL = yes;
NO_HZ_IDLE = no;
CONTEXT_TRACKING = yes;
CONTEXT_TRACKING_FORCE = yes;
# HZ_100 = yes;
HZ_1000 = yes;
HZ_1000_NODEF = yes;
# preempt
PREEMPT = yes;
PREEMPT_COUNT = yes;
PREEMPT_VOLUNTARY = no;
PREEMPTION = yes;
PREEMPT_DYNAMIC = yes;
# scheduler
# SCHED_ALT = yes;
# SCHED_PDS = yes;
CACULE_SCHED = yes;
# cacule stuff
SCHED_AUTOGROUP = yes;
BSD_PROCESS_ACCT = no;
TASK_XACCT = no;
CGROUP_CPUACCT = no;
CGROUP_DEBUG = no;
# disable numa
NUMA = no;
AMD_NUMA = no;
X86_64_ACPI_NUMA = no;
NODES_SPAN_OTHER_NODES = no;
NUMA_EMU = no;
NEED_MULTIPLE_NODES = no;
USE_PERCPU_NUMA_NODE_ID = no;
ACPI_NUMA = no;
# disable misc debugging
SLUB_DEBUG = no;
PM_DEBUG = no;
PM_ADVANCED_DEBUG = no;
PM_SLEEP_DEBUG = no;
ACPI_DEBUG = no;
SCHED_DEBUG = no;
LATENCYTOP = no;
DEBUG_PREEMPT = no;
};
ignoreConfigErrors = true;
src = kernelUrl "linux-${mm}.tar" "0rn3z942vjc7bixjw066rm6kcr0x0wzgxqfq1f6xd113pzrgc3bx";
kernelPatches = [
# Kernel version patch
{
name = "patch-${patch}";
patch = kernelUrl "patch-${mmp}" "17d38hns5qfbw1pajpa5y38v86r49nqnw7a3pwsay5fapj69z8w4";
}
# AMD SI manual clocking
{
name = "si-clock";
patch = ./si-manual-clocking.patch;
}
# Graysky gcc patches
{
name = "graysky-gcc";
patch = builtins.fetchurl {
url = "https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/d2e7942c19ee568638d3795cf52db5274a90ce0a/more-uarches-for-kernel-5.8+.patch";
sha256 = "16jbknjlg12jxbj8cjkk01djvr01n9zz7qlzxppcqizmz55vk0wh";
};
}
# TK-Glitch patches
( tkgPatch "0002-clear-patches" "1h1gx6rq2c961d36z1szqv9xpq1xgz2bhqjsyb03jjdrdzlcv9rm" )
( tkgPatch "0003-cacule-${mm}" "1rgdk1x514xsjwcjjcdmggbaj6biql5p41skn98ysqbjaw7k22ib" )
( tkgPatch "0003-glitched-base" "1dg177i3y54z5nadc5678hm67angram2vlr314mpxv3jgsh7vj8s" )
( tkgPatch "0003-glitched-cfs" "1cm4s72pymxnh37da84qrzvrwbbwagk46m1xsk99ir7cjb1l1zay" )
# ( tkgPatch "0005-glitched-pds" "0833awp8n9ngyl5spx8znwyw1lj3nacp8vg7ffysw0j5r8akv9pw" )
( tkgPatch "0007-v${mm}-fsync" "0mplwdglw58bmkkxix4ccwgax3r02gahax9042dx33mybdnbl0mk" )
( tkgPatch "0007-v${mm}-futex2_interface" "1j29zyx2s85scfhbprgb9cs11rp50glbzczl4plphli8wds342pw" )
( tkgPatch "0007-v${mm}-winesync" "1av2k86ns0zc3lmgbfdch1z2a808brp2jvsfl4cwwlwwb51qzipp" )
# ( tkgPatch "0009-prjc_v${mm}-r1" "1z731jiwyc7z4d5hzd6szrxnvw0iygbqx82y2anzm32n22731dqv" )
( tkgPatch "0012-misc-additions" "092ws9v1snk61i6x3gbqm5m803zd81wykkdxizn7knvy2r611cbz")
];
} // (args.argsOverride or {}))

View file

@ -0,0 +1,51 @@
{
getPaths,
winePackages,
wineUnstable,
wineStaging,
...
}:
# TODO: Use winePackages.callPackage
(wineStaging.overrideDerivation(o: {
patches = (o.patches or []) ++ getPaths ./patches;
})).override {
wineRelease = "staging";
wineBuild = "wineWow";
pngSupport = true;
jpegSupport = true;
tiffSupport = true;
gettextSupport = true;
fontconfigSupport = true;
alsaSupport = true;
gtkSupport = true;
openglSupport = true;
tlsSupport = true;
gstreamerSupport = true;
#cupsSupport = true;
colorManagementSupport = true;
dbusSupport = true;
mpg123Support = true;
#openalSupport = true;
#openclSupport = true;
#cairoSupport = true;
#odbcSupport = true;
netapiSupport = true;
cursesSupport = true;
vaSupport = true;
pcapSupport = true;
#v4lSupport = true;
#saneSupport = true;
gsmSupport = true;
#gphoto2Support = true;
#ldapSupport = true;
pulseaudioSupport = true;
udevSupport = true;
xineramaSupport = true;
xmlSupport = true;
vulkanSupport = true;
sdlSupport = true;
faudioSupport = true;
vkd3dSupport = true;
mingwSupport = true;
}