Consolidate duplicate configs

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-12-19 00:11:41 +00:00
parent bcad2979bf
commit d1460c4591
6 changed files with 143 additions and 274 deletions

View File

@@ -1,14 +1,11 @@
{
inputs,
lib,
pkgs,
...
}:
{ inputs, ... }:
{
imports = [
../../lib
inputs.disko.nixosModules.disko
(import ./format.nix { device = "/dev/disk/by-id/nvme-SAMSUNG_MZVL22T0HBLB-00BL2_S64RNE0R602762"; })
./hardware.nix
./display.nix
../common/system/configs/bluetooth
../common/system/configs/boot
../common/system/configs/brightnessctl
@@ -53,67 +50,6 @@
i18n.defaultLocale = "en_US.UTF-8";
sops.defaultSopsFile = ./secrets/secrets.yaml;
# https://github.com/NixOS/nixos-hardware/tree/master/lenovo/legion/16achg6
hardware = {
enableAllFirmware = true;
cpu = {
cores = 8;
threads = 16;
amd.updateMicrocode = true;
};
nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
open = false;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
nvidiaBusId = "PCI:1:0:0";
amdgpuBusId = "PCI:6:0:0";
};
};
graphics = {
enable32Bit = true;
extraPackages = with pkgs; [
amdvlk
driversi686Linux.amdvlk
rocmPackages.clr
rocmPackages.clr.icd
];
};
};
boot = {
kernelParams = [
"amd_pstate=active"
"video=eDP-1:2560x1600@165"
];
kernelModules = [ "kvm-amd" ];
initrd.kernelModules = [
"nvme"
"ahci"
"usbhid"
"amdgpu"
];
};
nixpkgs = {
hostPlatform = "x86_64-linux";
config = {
cudaSupport = true;
rocmSupport = true;
};
};
fileSystems."/mnt/windows" = {
device = "/dev/disk/by-id/nvme-Samsung_SSD_980_PRO_2TB_S69ENF0R841140X-part3";
fsType = "ntfs3";
@@ -125,70 +61,4 @@
"windows_names"
];
};
powerManagement.enable = true;
systemd.services.powertop.postStart = builtins.readFile ./system/scripts/mouse.sh;
services = {
xserver.videoDrivers = [ "nvidia" ];
fstrim.enable = true;
tlp.settings.DISK_DEVICES = "nvme0n1 nvme1n1";
};
programs = {
steam.package = pkgs.steam.override {
extraEnv.STEAM_FORCE_DESKTOPUI_SCALING = 1.25;
};
gamescope = {
env = {
__NV_PRIME_RENDER_OFFLOAD = "1";
__VK_LAYER_NV_optimus = "NVIDIA_only";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
};
args = [
"-W 2560"
"-H 1600"
];
};
};
home-manager.sharedModules = [
{
wayland.windowManager.hyprland.settings = {
monitor = "eDP-1, 2560x1600@165, 0x0, 1.25";
env = [ "WLR_DRM_DEVICES,$HOME/.config/hypr/card" ];
device = [
{
name = "syna2ba6:00-06cb:ce44-touchpad";
sensitivity = 0.5;
}
];
gestures.workspace_swipe_distance = 600;
};
programs = {
zsh.loginExtra = lib.mkBefore (builtins.readFile ./system/scripts/card.sh);
# VSCode does not play well with fractional scaling
vscode.userSettings."window.zoomLevel" = (1.25 - 1) / 0.2;
obs-studio.resolution = {
base = {
x = 4096;
y = 2560;
};
output = {
x = 2048;
y = 1280;
};
};
};
theme.cursor.size = 24;
}
];
}

41
hosts/eirene/display.nix Normal file
View File

@@ -0,0 +1,41 @@
{ pkgs, ... }:
{
boot.kernelParams = [ "video=eDP-1:2560x1600@165" ];
programs = {
steam.package = pkgs.steam.override {
extraEnv.STEAM_FORCE_DESKTOPUI_SCALING = 1.25;
};
gamescope = {
args = [
"-W 2560"
"-H 1600"
];
};
};
home-manager.sharedModules = [
{
wayland.windowManager.hyprland.settings.monitor = "eDP-1, 2560x1600@165, 0x0, 1.25";
programs = {
vscode.userSettings."window.zoomLevel" = (1.25 - 1) / 0.2;
obs-studio.resolution = {
base = {
x = 4096;
y = 2560;
};
output = {
x = 2048;
y = 1280;
};
};
};
theme.cursor.size = 24;
}
];
}

91
hosts/eirene/hardware.nix Normal file
View File

@@ -0,0 +1,91 @@
{ pkgs, lib, ... }:
{
# https://github.com/NixOS/nixos-hardware/tree/master/lenovo/legion/16achg6
hardware = {
enableAllFirmware = true;
cpu = {
cores = 8;
threads = 16;
amd.updateMicrocode = true;
};
nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
open = false;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
nvidiaBusId = "PCI:1:0:0";
amdgpuBusId = "PCI:6:0:0";
};
};
graphics = {
enable32Bit = true;
extraPackages = with pkgs; [
amdvlk
driversi686Linux.amdvlk
rocmPackages.clr
rocmPackages.clr.icd
];
};
};
boot = {
kernelParams = [ "amd_pstate=active" ];
kernelModules = [ "kvm-amd" ];
initrd.kernelModules = [
"nvme"
"ahci"
"usbhid"
"amdgpu"
];
};
nixpkgs = {
hostPlatform = "x86_64-linux";
config = {
cudaSupport = true;
rocmSupport = true;
};
};
powerManagement.enable = true;
systemd.services.powertop.postStart = builtins.readFile ./system/scripts/mouse.sh;
services = {
xserver.videoDrivers = [ "nvidia" ];
fstrim.enable = true;
tlp.settings.DISK_DEVICES = "nvme0n1 nvme1n1";
};
programs.gamescope.env = {
__NV_PRIME_RENDER_OFFLOAD = "1";
__VK_LAYER_NV_optimus = "NVIDIA_only";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
};
home-manager.sharedModules = [
{
wayland.windowManager.hyprland.settings = {
env = [ "WLR_DRM_DEVICES,$HOME/.config/hypr/card" ];
device = [
{
name = "syna2ba6:00-06cb:ce44-touchpad";
sensitivity = 0.5;
}
];
gestures.workspace_swipe_distance = 600;
};
programs.zsh.loginExtra = lib.mkBefore (builtins.readFile ./system/scripts/card.sh);
}
];
}

View File

@@ -1,10 +1,4 @@
{
config,
inputs,
lib,
pkgs,
...
}:
{ config, inputs, ... }:
{
imports = [
../../lib
@@ -12,6 +6,8 @@
(import ./format.nix {
device = "/dev/disk/by-id/usb-SanDisk_Ultra_Trek_0501990ddf7236633373ea7dd2e6715f954e2dbb35cadae343333f0562cda6aa7ec80000000000000000000042c100baff1e08109f5581078ea6d9c3-0:0";
})
../eirene/hardware.nix
../eirene/display.nix
../common/system/configs/bluetooth
../common/system/configs/boot
../common/system/configs/brightnessctl
@@ -55,117 +51,12 @@
i18n.defaultLocale = "en_US.UTF-8";
sops.defaultSopsFile = ./secrets/secrets.yaml;
# https://github.com/NixOS/nixos-hardware/tree/master/lenovo/legion/16achg6
hardware = {
enableAllFirmware = true;
cpu = {
cores = 8;
threads = 16;
amd.updateMicrocode = true;
};
nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
open = false;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
nvidiaBusId = "PCI:1:0:0";
amdgpuBusId = "PCI:6:0:0";
};
};
graphics = {
enable32Bit = true;
extraPackages = with pkgs; [
amdvlk
driversi686Linux.amdvlk
rocmPackages.clr
rocmPackages.clr.icd
];
};
};
boot = {
kernelParams = [
"amd_pstate=active"
"video=eDP-1:2560x1600@165"
];
kernelModules = [ "kvm-amd" ];
initrd.kernelModules = [
"nvme"
"ahci"
"usbhid"
"amdgpu"
"xhci_pci"
"usb_storage"
"sd_mod"
];
};
boot.initrd.kernelModules = [
"xhci_pci"
"usb_storage"
"sd_mod"
];
environment.impermanence.device =
config.disko.devices.disk.usb.content.partitions.root.content.name;
nixpkgs = {
hostPlatform = "x86_64-linux";
config = {
cudaSupport = true;
rocmSupport = true;
};
};
powerManagement.enable = true;
systemd.services.powertop.postStart = builtins.readFile ./system/scripts/mouse.sh;
services = {
xserver.videoDrivers = [ "nvidia" ];
fstrim.enable = true;
tlp.settings.DISK_DEVICES = "nvme0n1 nvme1n1";
};
home-manager.sharedModules = [
{
wayland.windowManager.hyprland.settings = {
monitor = "eDP-1, 2560x1600@165, 0x0, 1.25";
env = [ "WLR_DRM_DEVICES,$HOME/.config/hypr/card" ];
device = [
{
name = "syna2ba6:00-06cb:ce44-touchpad";
sensitivity = 0.5;
}
];
gestures.workspace_swipe_distance = 600;
};
programs = {
zsh.loginExtra = lib.mkBefore (builtins.readFile ./system/scripts/card.sh);
# VSCode does not play well with fractional scaling
vscode.userSettings."window.zoomLevel" = (1.25 - 1) / 0.2;
obs-studio.resolution = {
base = {
x = 4096;
y = 2560;
};
output = {
x = 2048;
y = 1280;
};
};
};
theme.cursor.size = 24;
}
];
}

View File

@@ -1,10 +0,0 @@
AMD=/dev/dri/by-path/pci-0000:06:00.0-card
NVIDIA=/dev/dri/by-path/pci-0000:01:00.0-card
if [[ -e "${AMD}" ]]; then
CARD=${AMD}
else
CARD=${NVIDIA}
fi
ln -sf "${CARD}" "${HOME}"/.config/hypr/card

View File

@@ -1,14 +0,0 @@
SEARCH_STRINGS=(
"Mouse"
"Razer DeathAdder Elite"
"Razer DeathAdder V3 HyperSpeed"
)
for search_string in "${SEARCH_STRINGS[@]}"; do
echo "Searching for devices matching: ${search_string}"
for f in $(grep -l "${search_string}" /sys/bus/usb/devices/*/product 2>/dev/null | sed "s/product/power\\/control/"); do
echo "Setting power control to 'on' for: ${f}"
echo on >| "${f}"
done
done