nixos/modules/hardware/chn-PC.nix

78 lines
2.2 KiB
Nix
Raw Normal View History

{ pkgs, ... }@inputs:
{
config =
{
2023-06-21 23:43:14 +08:00
nix.settings.system-features = [ "nixos-test" "benchmark" "kvm" "gccarch-alderlake" ];
nixpkgs =
{
hostPlatform = { system = "x86_64-linux"; gcc = { arch = "alderlake"; tune = "alderlake"; }; };
config.allowUnfree = true;
overlays =
[(
2023-06-24 21:26:41 +08:00
final: prev: let generic-pkgs = (inputs.topInputs.nixpkgs.lib.nixosSystem
{
system = "x86_64-linux";
modules = [{ config.nixpkgs.config.allowUnfree = true; }];
}).pkgs;
2023-06-17 19:06:03 +08:00
in
{
mono = generic-pkgs.mono;
pandoc = generic-pkgs.pandoc;
2023-06-17 19:20:52 +08:00
fwupd = generic-pkgs.fwupd;
2023-06-17 19:06:03 +08:00
}
)];
};
services.dbus.implementation = "broker";
2023-06-19 17:22:54 +08:00
programs.dconf.enable = true;
2023-06-24 23:00:02 +08:00
hardware.opengl.extraPackages = with inputs.pkgs; [ intel-media-driver intel-ocl ];
2023-06-21 09:55:18 +08:00
systemd.services =
{
2023-06-21 09:55:18 +08:00
reload-iwlwifi-after-hibernate =
{
2023-06-21 09:55:18 +08:00
description = "reload iwlwifi after resume from hibernate";
after = [ "systemd-hibernate.service" ];
serviceConfig =
{
Type = "oneshot";
2023-06-25 00:31:46 +08:00
ExecStart = let inherit (inputs.pkgs) kmod bash; in
2023-06-21 09:55:18 +08:00
[
2023-06-25 00:31:46 +08:00
"${kmod}/bin/modprobe -r iwlwifi" "${kmod}/bin/modprobe iwlwifi"
"${bash}/bin/bash -c 'echo 0 /sys/devices/system/cpu/intel_pstate/no_turbo'"
2023-06-21 09:55:18 +08:00
];
};
wantedBy = [ "systemd-hibernate.service" ];
};
lid-no-wakeup =
{
description = "lid no wake up";
2023-06-25 00:31:46 +08:00
serviceConfig.ExecStart = let inherit (inputs.pkgs) bash coreutils gnugrep; in
"${bash}/bin/bash -c '"
+ "if ${coreutils}/bin/cat /proc/acpi/wakeup | "
+ "${gnugrep}/bin/grep LID0 | "
+ "${gnugrep}/bin/grep -q enabled; then "
+ "echo LID0 > /proc/acpi/wakeup; "
+ "fi"
+ "'";
2023-06-21 09:55:18 +08:00
wantedBy = [ "multi-user.target" ];
};
};
2023-06-21 11:49:39 +08:00
boot.kernel.sysctl =
{
"net.core.rmem_max" = 67108864;
"net.core.wmem_max" = 67108864;
"net.ipv4.tcp_rmem" = "4096 87380 67108864";
"net.ipv4.tcp_wmem" = "4096 65536 67108864";
"net.ipv4.tcp_mtu_probing" = true;
"net.ipv4.tcp_tw_reuse" = true;
"vm.swappiness" = 10;
"net.ipv4.tcp_max_syn_backlog" = 8388608;
"net.core.netdev_max_backlog" = 8388608;
"net.core.somaxconn" = 8388608;
"vm.oom_kill_allocating_task" = true;
"vm.oom_dump_tasks" = false;
"vm.overcommit_kbytes" = 22020096;
"dev.i915.perf_stream_paranoid" = false;
};
};
}