summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/amdgpu.nix29
-rw-r--r--system/bootloader/default.nix7
-rw-r--r--system/bootloader/grub.nix20
-rw-r--r--system/bootloader/limine.nix24
-rw-r--r--system/bootloader/plymouth.nix25
-rw-r--r--system/default.nix23
-rw-r--r--system/desktops/wayland.nix7
-rw-r--r--system/gaming/default.nix33
-rw-r--r--system/gaming/steam.nix2
-rw-r--r--system/nvidia.nix18
-rw-r--r--system/sops.nix27
-rw-r--r--system/sshd.nix3
-rw-r--r--system/vpn.nix38
13 files changed, 243 insertions, 13 deletions
diff --git a/system/amdgpu.nix b/system/amdgpu.nix
new file mode 100644
index 0000000..5bb0f02
--- /dev/null
+++ b/system/amdgpu.nix
@@ -0,0 +1,29 @@
+{
+ lib,
+ config,
+ pkgs,
+ ...
+}: let
+ inherit (lib) mkIf;
+ cfg = config.amdgpu;
+in {
+ config = mkIf cfg.enable {
+ # kernel modules
+ boot = {
+ initrd.kernelModules = ["amdgpu"];
+ kernelModules = ["kvm-amd"];
+ };
+
+ # AMD Anti-Lag
+ hardware.graphics.extraPackages = with pkgs; [
+ low-latency-layer
+ ];
+
+ # Configuration
+ environment.variables = {
+ AMD_VULKAN_ICD = "RADV";
+ RADV_ANTILAG = "1";
+ LOW_LATENCY_LAYER = "1";
+ };
+ };
+}
diff --git a/system/bootloader/default.nix b/system/bootloader/default.nix
new file mode 100644
index 0000000..29fa61d
--- /dev/null
+++ b/system/bootloader/default.nix
@@ -0,0 +1,7 @@
+_: {
+ imports = [
+ ./grub.nix
+ ./limine.nix
+ ./plymouth.nix
+ ];
+}
diff --git a/system/bootloader/grub.nix b/system/bootloader/grub.nix
new file mode 100644
index 0000000..167e779
--- /dev/null
+++ b/system/bootloader/grub.nix
@@ -0,0 +1,20 @@
+{
+ lib,
+ config,
+ ...
+}: let
+ inherit (lib) mkIf;
+ cfg = config.bootloader.grub;
+in {
+ config = mkIf cfg.enable {
+ boot.loader = {
+ efi.canTouchEfiVariables = true;
+ grub = {
+ enable = true;
+ efiSupport = true;
+ device = "nodev";
+ splashImage = config.theme.wallpaper;
+ };
+ };
+ };
+}
diff --git a/system/bootloader/limine.nix b/system/bootloader/limine.nix
new file mode 100644
index 0000000..3487809
--- /dev/null
+++ b/system/bootloader/limine.nix
@@ -0,0 +1,24 @@
+{
+ lib,
+ config,
+ ...
+}: let
+ inherit (lib) mkIf;
+ cfg = config.bootloader.limine;
+in {
+ config = mkIf cfg.enable {
+ boot.loader = {
+ efi.canTouchEfiVariables = true;
+ limine = {
+ enable = true;
+ efiSupport = true;
+ secureBoot.enable = cfg.secureBoot.enable;
+ maxGenerations = 10;
+ style = {
+ backdrop = config.theme.colors.base;
+ wallpapers = [config.theme.wallpaper];
+ };
+ };
+ };
+ };
+}
diff --git a/system/bootloader/plymouth.nix b/system/bootloader/plymouth.nix
new file mode 100644
index 0000000..9338a84
--- /dev/null
+++ b/system/bootloader/plymouth.nix
@@ -0,0 +1,25 @@
+{
+ lib,
+ config,
+ ...
+}: let
+ inherit (lib) mkIf;
+ cfg = config.bootloader.plymouth;
+in {
+ config = mkIf cfg.enable {
+ boot = {
+ kernelParams = [
+ "quiet"
+ "splash"
+ "rd.udev.log_level=3"
+ "systemd.show_status=auto"
+ "udev.log_priority=3"
+ "vt.global_cursor_default=0"
+ ];
+ plymouth = {
+ enable = true;
+ theme = "bgrt";
+ };
+ };
+ };
+}
diff --git a/system/default.nix b/system/default.nix
index 4bb2809..a8b384d 100644
--- a/system/default.nix
+++ b/system/default.nix
@@ -13,18 +13,22 @@ in {
inputs.nix-gaming.nixosModules.platformOptimizations
inputs.nix-gaming.nixosModules.pipewireLowLatency
inputs.nix-gaming.nixosModules.wine
+ ./bootloader
./desktops
./gaming
./virt
+ ./amdgpu.nix
./battery.nix
./bluetooth.nix
./desktop.nix
./fingerprint.nix
./networking.nix
./nvidia.nix
+ ./sops.nix
./sshd.nix
./tpm.nix
./unfree.nix
+ ./vpn.nix
];
# allow flakes
@@ -38,9 +42,14 @@ in {
experimental-features = ["nix-command" "flakes"];
use-xdg-base-directories = true;
trusted-users = ["root" "@wheel"];
- max-jobs = config.cores / 4;
- cores = (config.cores - 2) / config.nix.settings.max-jobs;
+ # cachyos kernel
+ substituters = ["https://attic.xuyh0120.win/lantian"];
+ trusted-public-keys = ["lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc="];
};
+ # make nice
+ daemonCPUSchedPolicy = "idle";
+ daemonIOSchedClass = "idle";
+ daemonIOSchedPriority = 7;
};
# allow defined unfree packages
@@ -56,6 +65,7 @@ in {
(_: _: inputs.hy3.packages.${system})
# gaming
(_: _: inputs.nix-gaming.packages.${system})
+ inputs.nix-cachyos-kernel.overlays.pinned
# misc
(_: _: inputs.talc.packages.${system})
(_: _: inputs.apple-fonts.packages.${system})
@@ -87,7 +97,7 @@ in {
imports = [
../home
../options.nix
- (inputs.self.lib.homeConfig config)
+ (lib.home.mkConfig config)
];
};
@@ -135,10 +145,7 @@ in {
};
# use the latest kernel
- boot.kernelPackages =
- if config.gaming.enable
- then pkgs.linuxPackages_xanmod_latest
- else pkgs.linuxPackages_latest;
+ boot.kernelPackages = pkgs.linuxPackages_latest;
# sysrq
boot.kernel.sysctl."kernel.sysrq" = 246;
@@ -175,7 +182,7 @@ in {
};
# certs
- security.pki.certificateFiles = inputs.self.lib.certs;
+ security.pki.certificateFiles = lib.files.certs;
# sudo
security.sudo.enable = false;
diff --git a/system/desktops/wayland.nix b/system/desktops/wayland.nix
index 2f43fb3..382d6a1 100644
--- a/system/desktops/wayland.nix
+++ b/system/desktops/wayland.nix
@@ -23,6 +23,13 @@ in {
};
};
+ environment.variables = {
+ MOZ_ENABLE_WAYLAND = "1";
+ NIXOS_OZONE_WL = "1";
+ SDL_VIDEODRIVER = "wayland,x11";
+ SDL_VIDEO_DRIVER = "wayland,x11";
+ };
+
programs.xwayland.enable = true;
};
}
diff --git a/system/gaming/default.nix b/system/gaming/default.nix
index ac04c6f..ca97345 100644
--- a/system/gaming/default.nix
+++ b/system/gaming/default.nix
@@ -12,6 +12,16 @@ in {
];
config = mkIf cfg.enable {
+ boot.kernelParams = [
+ # lower latency
+ "tsc=reliable"
+ "clocksource=tsc"
+ "preempt=full"
+ # no watchdog
+ "nmi_watchdog=0"
+ "nowatchdog"
+ ];
+
programs.wine = {
enable = true;
package = pkgs.wineWow64Packages.staging;
@@ -19,8 +29,31 @@ in {
ntsync = true;
};
+ services.ananicy = {
+ enable = true;
+ package = pkgs.ananicy-cpp;
+ rulesProvider = pkgs.ananicy-rules-cachyos;
+ };
+
+ services.hardware.openrgb = {
+ enable = cfg.openrgb.enable;
+ package = pkgs.openrgb-with-all-plugins;
+ };
+
+ services.scx = {
+ enable = true;
+ package = pkgs.scx.rustscheds;
+ scheduler = "scx_pandemonium";
+ };
+
environment.systemPackages = with pkgs; [
winetricks
];
+
+ services.udev.packages = with pkgs; [
+ cachyos-settings
+ ];
+
+ environment.etc."sysctl.d/70-cachyos-settings.conf".source = "${pkgs.cachyos-settings}/etc/sysctl.d/70-cachyos-settings.conf";
};
}
diff --git a/system/gaming/steam.nix b/system/gaming/steam.nix
index dd4fc50..dca5c25 100644
--- a/system/gaming/steam.nix
+++ b/system/gaming/steam.nix
@@ -17,7 +17,7 @@ in {
programs.gamescope = {
enable = true;
- capSysNice = true;
+ capSysNice = false;
};
programs.steam = {
diff --git a/system/nvidia.nix b/system/nvidia.nix
index d9818e0..566da5d 100644
--- a/system/nvidia.nix
+++ b/system/nvidia.nix
@@ -9,7 +9,13 @@
in {
config = mkIf cfg.enable {
# kernel modules
- boot.blacklistedKernelModules = ["nouveau"];
+ boot = {
+ blacklistedKernelModules = ["nouveau"];
+ kernelParams = [
+ "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
+ "nvidia.NVreg_TemporaryFilePath=/var/tmp"
+ ];
+ };
services.xserver.videoDrivers = ["modesetting" "nvidia"];
# nvidia driver
@@ -17,7 +23,7 @@ in {
modesetting.enable = true;
powerManagement = {
enable = true;
- finegrained = true;
+ finegrained = false;
};
prime =
cfg.primeBusIds
@@ -32,6 +38,11 @@ in {
package = config.boot.kernelPackages.nvidiaPackages.latest;
};
+ # NVIDIA Reflex
+ hardware.graphics.extraPackages = with pkgs; [
+ low-latency-layer
+ ];
+
# cuda
environment = mkIf cfg.cuda.enable {
systemPackages = with pkgs; [
@@ -44,6 +55,9 @@ in {
NVIDIA_DRIVER_CAPABILITIES = "compute,utility";
CUDA_VISIBLE_DEVICES = 0;
CUDA_PATH = "${pkgs.cudatoolkit}";
+ # NVIDIA Reflex
+ LOW_LATENCY_LAYER = "1";
+ LOW_LATENCY_LAYER_REFLEX = "1";
};
};
nix.settings = mkIf cfg.cuda.enable {
diff --git a/system/sops.nix b/system/sops.nix
new file mode 100644
index 0000000..17f6f13
--- /dev/null
+++ b/system/sops.nix
@@ -0,0 +1,27 @@
+{
+ config,
+ pkgs,
+ lib,
+ inputs,
+ hostDir,
+ ...
+}: let
+ inherit (lib) mkIf;
+ cfg = config.sops;
+in {
+ imports = [
+ inputs.sops-nix.nixosModules.sops
+ ];
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [
+ sops
+ ];
+
+ sops = {
+ defaultSopsFile = hostDir + "/secrets.yaml";
+ gnupg.home = config.homePath + "/.local/share/gnupg";
+ gnupg.sshKeyPaths = [];
+ };
+ };
+}
diff --git a/system/sshd.nix b/system/sshd.nix
index e60da43..088b6e1 100644
--- a/system/sshd.nix
+++ b/system/sshd.nix
@@ -1,7 +1,6 @@
{
lib,
config,
- inputs,
...
}: let
inherit (lib) mkIf;
@@ -35,7 +34,7 @@ in {
# add authorized keys
users.users.${config.user} = {
- openssh.authorizedKeys.keyFiles = inputs.self.lib.sshKeys;
+ openssh.authorizedKeys.keyFiles = lib.files.sshKeys;
};
};
}
diff --git a/system/vpn.nix b/system/vpn.nix
new file mode 100644
index 0000000..c336f32
--- /dev/null
+++ b/system/vpn.nix
@@ -0,0 +1,38 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}: let
+ inherit (lib) mkIf;
+ cfg = config.vpn;
+in {
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [
+ wireguard-tools
+ ];
+
+ networking.wg-quick.interfaces = {
+ freyanet = {
+ address = [cfg.ip];
+ dns = ["10.2.0.1"];
+ privateKeyFile = config.sops.secrets.freyanetWg.path;
+ autostart = false;
+
+ peers = [
+ {
+ publicKey = "x0ykwakpYCvI/pG+nR83lNUyeOE9m54thnX3bvZ+FUk=";
+ allowedIPs = ["10.0.0.0/8"];
+ endpoint = "freya.cat:3000";
+ persistentKeepalive = 25;
+ }
+ ];
+ };
+ };
+
+ sops = {
+ enable = true;
+ secrets.freyanetWg = {};
+ };
+ };
+}