Merge branch 'production' into blas

This commit is contained in:
2024-02-16 17:15:11 +08:00
21 changed files with 456 additions and 174 deletions

View File

@@ -47,11 +47,11 @@ inputs:
networking.hostname = "nas";
gui.preferred = false;
};
hardware = { cpus = [ "intel" ]; gpus = [ "intel" ]; };
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
packages.packageSet = "desktop-fat";
services =
{
snapper.enable = true;
snapper.enable = false;
fontconfig.enable = true;
samba =
{

View File

@@ -53,14 +53,15 @@ inputs:
};
nixpkgs =
{ march = "znver4"; cuda = { enable = true; capabilities = [ "8.9" ]; forwardCompat = false; }; };
kernel.patches = [ "cjktty" "lantian" ];
kernel.patches = [ "cjktty" "lantian" "hibernate-progress" ];
networking.hostname = "pc";
sysctl.laptop-mode = 5;
};
hardware =
{
cpus = [ "amd" ];
gpus = [ "nvidia" ];
gpu = { type = "amd+nvidia"; prime.busId = { amd = "8:0:0"; nvidia = "1:0:0"; }; };
# gpu.type = "amd";
bluetooth.enable = true;
joystick.enable = true;
printer.enable = true;
@@ -133,13 +134,11 @@ inputs:
publicKey = "l1gFSDCeBxyf/BipXNvoEvVvLqPgdil84nmr5q6+EEw=";
wireguardIp = "192.168.83.3";
};
gamemode = { enable = true; drmDevice = 1; };
};
bugs = [ "xmunet" "backlight" "amdpstate" ];
};
# use plasma-x11 as default, instead of plasma-wayland
services.xserver.displayManager.defaultSession = inputs.lib.mkForce "plasma";
virtualisation.virtualbox.host = { enable = true; enableExtensionPack = true; };
hardware.nvidia.forceFullCompositionPipeline = true;
home-manager.users.chn.config.programs.plasma.startup.autoStartScript.xcalib.text =
"${inputs.pkgs.xcalib}/bin/xcalib -d :0 ${./color/TPLCD_161B_Default.icm}";
nixpkgs.overlays = [(final: prev: rec
@@ -147,5 +146,17 @@ inputs:
blas = prev.blas.override { blasProvider = final.amd-blis; };
lapack = prev.lapack.override { lapackProvider = final.amd-libflame; };
})];
services.xserver.displayManager.defaultSession = inputs.lib.mkForce "plasma";
powerManagement.resumeCommands =
''
${inputs.pkgs.kmod}/bin/modprobe -r mt7921e
${inputs.pkgs.kmod}/bin/modprobe mt7921e
'';
specialisation.nvidia.configuration =
{
system.nixos.tags = [ "discreate-graphic" ];
nixos.hardware.gpu.type = inputs.lib.mkForce "nvidia";
hardware.nvidia.forceFullCompositionPipeline = true;
};
};
}

View File

@@ -31,13 +31,13 @@ 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 =
{
cpus = [ "intel" ];
gpus = [ "intel" ];
gpu.type = "intel";
bluetooth.enable = true;
joystick.enable = true;
printer.enable = true;
@@ -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 ];
};
}

View File

@@ -47,12 +47,12 @@ inputs:
hardware =
{
cpus = [ "amd" ];
gpus = [ "nvidia" ];
# gpus = [ "nvidia" ];
bluetooth.enable = true;
joystick.enable = true;
printer.enable = true;
sound.enable = true;
gamemode.drmDevice = 1;
# gamemode.drmDevice = 1;
};
packages.packageSet = "workstation";
virtualization = { docker.enable = true; kvmHost = { enable = true; gui = true; }; };

158
flake.lock generated
View File

@@ -40,15 +40,15 @@
"cascade": {
"flake": false,
"locked": {
"lastModified": 1706712246,
"narHash": "sha256-xqA4U7IzGtmqdqFxznB/5d7riHVRCTz7PBiNQrnOpmE=",
"owner": "andreasgrafen",
"lastModified": 1707981987,
"narHash": "sha256-6p4t7maih5I5BqkawqArnYSN+35iUPxlsHebk6SRf7A=",
"owner": "CHN-beta",
"repo": "cascade",
"rev": "6b584eb86c45501930e689ca73a60f89521d9896",
"rev": "7c5645ed390c8b829e241f3ed5495a9d5a473375",
"type": "github"
},
"original": {
"owner": "andreasgrafen",
"owner": "CHN-beta",
"repo": "cascade",
"type": "github"
}
@@ -622,6 +622,24 @@
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1698882062,
"narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8c9fa2545007b49a5db5f650ae91f227672c3877",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_3"
},
"locked": {
"lastModified": 1701473968,
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
@@ -636,7 +654,7 @@
"type": "github"
}
},
"flake-parts_4": {
"flake-parts_5": {
"inputs": {
"nixpkgs-lib": [
"nixpak",
@@ -657,7 +675,7 @@
"type": "github"
}
},
"flake-parts_5": {
"flake-parts_6": {
"inputs": {
"nixpkgs-lib": [
"nur-linyinfeng",
@@ -970,6 +988,38 @@
"type": "github"
}
},
"lepton": {
"flake": false,
"locked": {
"lastModified": 1707757295,
"narHash": "sha256-KvwLiJFbe+YHjuEz9c/NV/eTMiQamRUQ2fAGY6piw8Y=",
"owner": "black7375",
"repo": "Firefox-UI-Fix",
"rev": "a25a08819ad36b3601a23123458edded0d849f7e",
"type": "github"
},
"original": {
"owner": "black7375",
"repo": "Firefox-UI-Fix",
"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": [
@@ -1191,6 +1241,28 @@
"type": "github"
}
},
"nix-fast-build": {
"inputs": {
"flake-parts": "flake-parts_3",
"nixpkgs": [
"nixpkgs"
],
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1703607026,
"narHash": "sha256-Emh0BPoqlS4ntp2UJrwydXfIP4qIMF0VBB2FUE3/M/E=",
"owner": "Mic92",
"repo": "nix-fast-build",
"rev": "4376b8a33b217ee2f78ba3dcff01a3e464d13a46",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "nix-fast-build",
"type": "github"
}
},
"nix-filter": {
"locked": {
"lastModified": 1701697642,
@@ -1266,7 +1338,7 @@
},
"nixd": {
"inputs": {
"flake-parts": "flake-parts_3",
"flake-parts": "flake-parts_4",
"nixpkgs": [
"nixpkgs"
]
@@ -1308,15 +1380,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"
}
@@ -1339,7 +1411,7 @@
},
"nixpak": {
"inputs": {
"flake-parts": "flake-parts_4",
"flake-parts": "flake-parts_5",
"hercules-ci-effects": "hercules-ci-effects",
"nixpkgs": [
"nixpkgs"
@@ -1410,6 +1482,24 @@
}
},
"nixpkgs-lib_2": {
"locked": {
"dir": "lib",
"lastModified": 1698611440,
"narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib_3": {
"locked": {
"dir": "lib",
"lastModified": 1701253981,
@@ -1477,11 +1567,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1707787472,
"narHash": "sha256-vt85JbRZRhrhiUzLmRFMDajRiF6gHB3drRWbkf6qZSs=",
"lastModified": 1708000057,
"narHash": "sha256-vpmOD7xoYaD08WqKhoRS7tyvB9JzAc4KGWW0lQW0cCw=",
"owner": "CHN-beta",
"repo": "nixpkgs",
"rev": "6cdb11a09e297c47aa0076d511608687864197c9",
"rev": "d780b53ae92422a50786c60a32b8d59f1eecbc54",
"type": "github"
},
"original": {
@@ -1542,14 +1632,14 @@
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_7",
"flake-parts": "flake-parts_5",
"flake-parts": "flake-parts_6",
"flake-utils": "flake-utils_8",
"nixos-stable": "nixos-stable",
"nixpkgs": [
"nixpkgs"
],
"nvfetcher": "nvfetcher",
"treefmt-nix": "treefmt-nix_2"
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
"lastModified": 1705926964,
@@ -1838,6 +1928,8 @@
"fluent-kde": "fluent-kde",
"home-manager": "home-manager",
"impermanence": "impermanence",
"lepton": "lepton",
"linux-surface": "linux-surface",
"lmix": "lmix",
"matplotplusplus": "matplotplusplus",
"misskey": "misskey",
@@ -1845,6 +1937,7 @@
"napalm": "napalm",
"nix-alien": "nix-alien",
"nix-doom-emacs": "nix-doom-emacs",
"nix-fast-build": "nix-fast-build",
"nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions",
"nixd": "nixd",
@@ -1906,11 +1999,11 @@
"rycee": {
"flake": false,
"locked": {
"lastModified": 1707673696,
"narHash": "sha256-3+IgVATpdUFJ33QLIuK8mIzg5rSWA/wX0IoBMfPKzWo=",
"lastModified": 1708056242,
"narHash": "sha256-HaqzfC+WhWPgm3ISCdcB/TWJ/JaE9GJ+dF2GpntkxHU=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "22f2d8e0cbb3a8490a104ca5cb7bbc8ba10d262c",
"rev": "170daec97818f490559fc8c807bcef4848fb8142",
"type": "gitlab"
},
"original": {
@@ -2194,6 +2287,27 @@
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"nix-fast-build",
"nixpkgs"
]
},
"locked": {
"lastModified": 1698438538,
"narHash": "sha256-AWxaKTDL3MtxaVTVU5lYBvSnlspOS0Fjt8GxBgnU0Do=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "5deb8dc125a9f83b65ca86cf0c8167c46593e0b1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_3": {
"inputs": {
"nixpkgs": [
"nur-linyinfeng",

View File

@@ -41,8 +41,9 @@
};
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"; };
nix-fast-build = { url = "github:/Mic92/nix-fast-build"; inputs.nixpkgs.follows = "nixpkgs"; };
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
rsshub = { url = "github:DIYgod/RSSHub"; flake = false; };
@@ -60,9 +61,11 @@
win11os-kde = { url = "github:yeyushengfan258/Win11OS-kde"; flake = false; };
fluent-kde = { url = "github:vinceliuice/Fluent-kde"; flake = false; };
rycee = { url = "gitlab:rycee/nur-expressions"; flake = false; };
cascade = { url = "github:andreasgrafen/cascade"; flake = false; };
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; };
lepton = { url = "github:black7375/Firefox-UI-Fix"; flake = false; };
};
outputs = inputs:

View File

@@ -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 ) ];

View File

@@ -1,6 +1,6 @@
inputs:
{
imports = inputs.localLib.mkModules [ ./legion.nix ];
imports = inputs.localLib.mkModules [ ./gpu.nix ./legion.nix ];
options.nixos.hardware = let inherit (inputs.lib) mkOption types; in
{
bluetooth.enable = mkOption { type = types.bool; default = false; };
@@ -8,14 +8,6 @@ inputs:
printer.enable = mkOption { type = types.bool; default = false; };
sound.enable = mkOption { type = types.bool; default = false; };
cpus = mkOption { type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
gpus = mkOption { type = types.listOf (types.enum [ "intel" "nvidia" "amd" ]); default = []; };
prime =
{
enable = mkOption { type = types.bool; default = false; };
mode = mkOption { type = types.enum [ "offload" "sync" ]; default = "offload"; };
busId = mkOption { type = types.attrsOf types.str; default = {}; };
};
gamemode.drmDevice = mkOption { type = types.int; default = 0; };
halo-keyboard.enable = mkOption { type = types.bool; default = false; };
};
config =
@@ -82,80 +74,6 @@ inputs:
concatLists (map (cpu: modules.${cpu}) hardware.cpus);
}
)
# gpus
(
mkIf (hardware.gpus != [])
{
boot.initrd.availableKernelModules =
let
modules =
{
intel = [ "i915" ];
nvidia = [ "nvidia" "nvidia_drm" "nvidia_modeset" "nvidia_uvm" ];
amd = [ "amdgpu" ];
};
in
concatLists (map (gpu: modules.${gpu}) hardware.gpus);
hardware =
{
opengl =
{
enable = true;
driSupport = true;
extraPackages =
with inputs.pkgs;
let
packages =
{
intel = [ intel-compute-runtime intel-media-driver libvdpau-va-gl ]; # intel-vaapi-driver
nvidia = [ vaapiVdpau ];
amd = [ amdvlk rocmPackages.clr rocmPackages.clr.icd ];
};
in
concatLists (map (gpu: packages.${gpu}) hardware.gpus);
driSupport32Bit = true;
};
nvidia = mkIf (builtins.elem "nvidia" hardware.gpus)
{
modesetting.enable = true;
powerManagement.enable = true;
dynamicBoost.enable = true;
nvidiaSettings = true;
package = inputs.config.boot.kernelPackages.nvidiaPackages.production;
};
};
}
)
(mkIf (builtins.elem "intel" hardware.gpus) { services.xserver.videoDrivers = [ "modesetting" ]; })
(mkIf (builtins.elem "amd" hardware.gpus) { services.xserver.videoDrivers = [ "modesetting" ]; })
# prime
(
mkIf hardware.prime.enable
{
hardware.nvidia = mkMerge
[
(
mkIf (hardware.prime.mode == "offload")
{
prime.offload = { enable = true; enableOffloadCmd = true; };
powerManagement = { finegrained = true; enable = true; };
}
)
(
mkIf (hardware.prime.mode == "sync")
{
prime = { sync.enable = true; };
# prime.forceFullCompositionPipeline = true;
}
)
{
prime = listToAttrs
(map (gpu: { inherit (gpu) value; name = "${gpu.name}BusId"; }) (attrsToList hardware.prime.busId));
}
];
}
)
{ programs.gamemode.settings.gpu.gpu_device = "${toString hardware.gamemode.drmDevice}"; }
# halo-keyboard
(mkIf hardware.halo-keyboard.enable
(

84
modules/hardware/gpu.nix Normal file
View File

@@ -0,0 +1,84 @@
inputs:
{
options.nixos.hardware.gpu = let inherit (inputs.lib) mkOption types; in
{
type = mkOption
{
type = types.nullOr (types.enum
[
# single gpu
"intel" "nvidia" "amd"
# hibrid gpu: use nvidia prime offload mode
"intel+nvidia" "amd+nvidia"
]);
default = null;
};
prime.busId = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; };
};
config = let inherit (inputs.config.nixos.hardware) gpu; in inputs.lib.mkIf (gpu.type != null) (inputs.lib.mkMerge
[
# generic settings
(
let gpus = inputs.lib.strings.splitString "+" gpu.type; in
{
boot.initrd.availableKernelModules =
let modules =
{
intel = [ "i915" ];
nvidia = [ "nvidia" "nvidia_drm" "nvidia_modeset" ]; # nvidia-uvm should not be loaded
amd = [ "amdgpu" ];
};
in builtins.concatLists (builtins.map (gpu: modules.${gpu}) gpus);
hardware =
{
opengl =
{
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages =
let packages = with inputs.pkgs;
{
intel = [ intel-vaapi-driver libvdpau-va-gl intel-media-driver ];
nvidia = [ vaapiVdpau ];
amd = [ amdvlk rocmPackages.clr rocmPackages.clr.icd ];
};
in builtins.concatLists (builtins.map (gpu: packages.${gpu}) gpus);
extraPackages32 =
let packages = { intel = []; nvidia = []; amd = [ inputs.pkgs.driversi686Linux.amdvlk ]; };
in builtins.concatLists (builtins.map (gpu: packages.${gpu}) gpus);
};
nvidia = inputs.lib.mkIf (builtins.elem "nvidia" gpus)
{
modesetting.enable = true;
powerManagement.enable = true;
dynamicBoost.enable = true;
nvidiaSettings = true;
# package = inputs.config.boot.kernelPackages.nvidiaPackages.production;
};
};
boot =
{
kernelParams = inputs.lib.mkIf (builtins.elem "amd" gpus)
[ "radeon.cik_support=0" "amdgpu.cik_support=1" "radeon.si_support=0" "amdgpu.si_support=1" "iommu=pt" ];
blacklistedKernelModules = [ "nouveau" ];
};
environment.variables.VDPAU_DRIVER = inputs.lib.mkIf (builtins.elem "intel" gpus) "va_gl";
services.xserver.videoDrivers =
let driver = { intel = "modesetting"; amd = "amdgpu"; nvidia = "nvidia"; };
in builtins.map (gpu: driver.${gpu}) gpus;
}
)
# nvidia prime offload
(
inputs.lib.mkIf (inputs.lib.strings.hasSuffix "+nvidia" gpu.type) { hardware.nvidia =
{
prime = { offload = { enable = true; enableOffloadCmd = true; }; }
// builtins.listToAttrs (builtins.map
(gpu: { name = "${if gpu.name == "amd" then "amdgpu" else gpu.name}BusId"; value = "PCI:${gpu.value}"; })
(inputs.localLib.attrsToList gpu.prime.busId));
powerManagement.finegrained = true;
};}
)
]);
}

View File

@@ -31,9 +31,9 @@ inputs:
)
];
search = { default = "Google"; force = true; };
userChrome = builtins.concatStringsSep "\n" (builtins.map
(file: builtins.readFile "${inputs.topInputs.cascade}/chrome/includes/cascade-${file}.css")
[ "config-mouse" "colours" "layout" "responsive" "floating-panel" "nav-bar" "tabs" ]);
userChrome = builtins.readFile "${inputs.topInputs.lepton}/userChrome.css";
userContent = builtins.readFile "${inputs.topInputs.lepton}/userContent.css";
extraConfig = builtins.readFile "${inputs.topInputs.lepton}/user.js";
settings =
{
# general

View File

@@ -45,7 +45,7 @@ inputs:
# networking
ipset iptables iproute2 dig nettools traceroute tcping-go whois tcpdump nmap inetutils wireguard-tools
# nix tools
nix-output-monitor nix-tree ssh-to-age
nix-output-monitor nix-tree ssh-to-age (callPackage "${inputs.topInputs.nix-fast-build}" {})
# office
todo-txt-cli
# development

View File

@@ -68,29 +68,7 @@ inputs:
anime-game-launcher = { enable = true; package = inputs.pkgs.anime-game-launcher; };
honkers-railway-launcher = { enable = true; package = inputs.pkgs.honkers-railway-launcher; };
nix-ld.enable = true;
gamemode =
{
enable = true;
settings =
{
general.renice = 10;
gpu =
{
apply_gpu_optimisations = "accept-responsibility";
nv_powermizer_mode = 1;
};
custom = let notify-send = "${inputs.pkgs.libnotify}/bin/notify-send"; in
{
start = "${notify-send} 'GameMode started'";
end = "${notify-send} 'GameMode ended'";
};
};
};
chromium =
{
enable = true;
extraOpts.PasswordManagerEnabled = false;
};
chromium = { enable = true; extraOpts.PasswordManagerEnabled = false; };
};
};
}

View File

@@ -40,6 +40,7 @@ inputs:
./fail2ban.nix
./wireguard.nix
./akkoma.nix
./gamemode.nix
];
options.nixos.services = let inherit (inputs.lib) mkOption types; in
{

View File

@@ -0,0 +1,30 @@
inputs:
{
options.nixos.services.gamemode = let inherit (inputs.lib) mkOption types; in
{
enable = mkOption { type = types.bool; default = false; };
drmDevice = mkOption { type = types.int; };
};
config = let inherit (inputs.config.nixos.services) gamemode; in inputs.lib.mkIf gamemode.enable
{
programs.gamemode =
{
enable = true;
settings =
{
general.renice = 10;
gpu =
{
apply_gpu_optimisations = "accept-responsibility";
nv_powermizer_mode = 1;
gpu_device = builtins.toString gamemode.drmDevice;
};
custom = let notify-send = "${inputs.pkgs.libnotify}/bin/notify-send"; in
{
start = "${notify-send} 'GameMode started'";
end = "${notify-send} 'GameMode ended'";
};
};
};
};
}

View File

@@ -6,7 +6,7 @@ inputs:
./fileSystems
./grub.nix
./initrd.nix
./kernel.nix
./kernel
./impermanence.nix
./gui.nix
./nixpkgs.nix

View File

@@ -19,7 +19,6 @@ inputs:
enable = true;
displayManager = { sddm.enable = true; defaultSession = "plasmawayland"; };
desktopManager.plasma5.enable = true;
videoDrivers = inputs.config.nixos.hardware.gpus;
};
systemd.services.display-manager = { after = [ "network-online.target" ]; enable = gui.autoStart; };
environment =

View File

@@ -39,7 +39,8 @@ inputs:
patches =
{
cjktty =
{
[{
name = "cjktty";
patch =
let
version = builtins.splitVersion inputs.config.boot.kernelPackages.kernel.version;
@@ -54,15 +55,16 @@ inputs:
hashes =
{
"6.1" = "11ddiammvjxx2m9v32p25l1ai759a1d6xhdpszgnihv7g2fzigf5";
"6.6" = "19ib0syj3207ifr315gdrnpv6nhh435fmgl05c7k715nng40i827";
"6.7" = "1yfsmc0873xiwlirir0xfp9zyrpd09q1srgr3z4rl7i7lxzaqls8";
};
in hashes."${major}.${minor}";
};
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,48 @@ 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; }];
hibernate-progress = [{ name = "hibernate-progress"; patch = ./hibernate-progress.patch; }];
};
in
builtins.map (name: { inherit name; } // patches.${name}) kernel.patches;
in builtins.concatLists (builtins.map (name: patches.${name}) kernel.patches);
};};
}

View File

@@ -0,0 +1,116 @@
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index d44f5937f1e5..8905c0438b64 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -552,7 +552,7 @@ static int save_image(struct swap_map_handle *handle,
hib_init_batch(&hb);
- pr_info("Saving image data pages (%u pages)...\n",
+ pr_err("Saving image data pages (%u pages)...\n",
nr_to_write);
m = nr_to_write / 10;
if (!m)
@@ -567,7 +567,7 @@ static int save_image(struct swap_map_handle *handle,
if (ret)
break;
if (!(nr_pages % m))
- pr_info("Image saving progress: %3d%%\n",
+ pr_err("Image saving progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -577,7 +577,7 @@ static int save_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret)
- pr_info("Image saving done\n");
+ pr_err("Image saving done\n");
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
return ret;
}
@@ -767,8 +767,8 @@ static int save_image_lzo(struct swap_map_handle *handle,
*/
handle->reqd_free_pages = reqd_free_pages();
- pr_info("Using %u thread(s) for compression\n", nr_threads);
- pr_info("Compressing and saving image data (%u pages)...\n",
+ pr_err("Using %u thread(s) for compression\n", nr_threads);
+ pr_err("Compressing and saving image data (%u pages)...\n",
nr_to_write);
m = nr_to_write / 10;
if (!m)
@@ -789,7 +789,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
data_of(*snapshot), PAGE_SIZE);
if (!(nr_pages % m))
- pr_info("Image saving progress: %3d%%\n",
+ pr_err("Image saving progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -860,7 +860,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret)
- pr_info("Image saving done\n");
+ pr_err("Image saving done\n");
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
out_clean:
hib_finish_batch(&hb);
@@ -1071,7 +1071,7 @@ static int load_image(struct swap_map_handle *handle,
hib_init_batch(&hb);
clean_pages_on_read = true;
- pr_info("Loading image data pages (%u pages)...\n", nr_to_read);
+ pr_err("Loading image data pages (%u pages)...\n", nr_to_read);
m = nr_to_read / 10;
if (!m)
m = 1;
@@ -1089,7 +1089,7 @@ static int load_image(struct swap_map_handle *handle,
if (ret)
break;
if (!(nr_pages % m))
- pr_info("Image loading progress: %3d%%\n",
+ pr_err("Image loading progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -1099,7 +1099,7 @@ static int load_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret) {
- pr_info("Image loading done\n");
+ pr_err("Image loading done\n");
snapshot_write_finalize(snapshot);
if (!snapshot_image_loaded(snapshot))
ret = -ENODATA;
@@ -1283,8 +1283,8 @@ static int load_image_lzo(struct swap_map_handle *handle,
}
want = ring_size = i;
- pr_info("Using %u thread(s) for decompression\n", nr_threads);
- pr_info("Loading and decompressing image data (%u pages)...\n",
+ pr_err("Using %u thread(s) for decompression\n", nr_threads);
+ pr_err("Loading and decompressing image data (%u pages)...\n",
nr_to_read);
m = nr_to_read / 10;
if (!m)
@@ -1414,7 +1414,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
data[thr].unc + off, PAGE_SIZE);
if (!(nr_pages % m))
- pr_info("Image loading progress: %3d%%\n",
+ pr_err("Image loading progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
@@ -1440,7 +1440,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
}
stop = ktime_get();
if (!ret) {
- pr_info("Image loading done\n");
+ pr_err("Image loading done\n");
snapshot_write_finalize(snapshot);
if (!snapshot_image_loaded(snapshot))
ret = -ENODATA;

View File

@@ -17,10 +17,10 @@ inputs:
system-features = [ "big-parallel" "nixos-test" "benchmark" ];
experimental-features = [ "nix-command" "flakes" ];
keep-failed = true;
max-substitution-jobs = 1;
max-substitution-jobs = 4;
trusted-public-keys = [ "chn:Cc+nowW1LIpe1kyXOZmNaznFDiH1glXmpb4A+WD/DTE=" ];
show-trace = true;
max-jobs = 1;
max-jobs = 4;
cores = 0;
keep-going = true;
};

View File

@@ -40,7 +40,7 @@ inputs:
{
kwin =
{
Overview = "Meta+Tab";
ExposeAll = "Meta+Tab";
"Show Desktop" = "Meta+D";
"Suspend Compositing" = "Alt+Shift+F12";
"Walk Through Windows" = "Alt+Tab";

View File

@@ -37,7 +37,9 @@ inputs:
setSocketVariable = true;
daemon.settings = { features.buildkit = true; dns = [ "1.1.1.1" ]; storage-driver = "overlay2"; };
};
enableNvidia = builtins.elem "nvidia" inputs.config.nixos.hardware.gpus;
enableNvidia =
let gpu = inputs.config.nixos.hardware.gpu.type;
in inputs.lib.mkIf (gpu != null && inputs.lib.strings.hasInfix "nvidia" gpu) true;
storageDriver = "overlay2";
};
nixos.services.firewall.trustedInterfaces = [ "docker0" ];