wip: various changes to modularization and laptop

This commit is contained in:
2025-12-24 18:38:03 +00:00
parent 1528eee84e
commit 8cb2e05312
4 changed files with 105 additions and 24 deletions

View File

@@ -0,0 +1,29 @@
{ ... }:
{
services.tlp = {
enable = true;
extraConfig = ''
CPU_SCALING_GOVERNOR_ON_BAT=power_save
CPU_SCALING_GOVERNOR_ON_AC=performance
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave
'';
settings = {
START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge
STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
};
};
powerManagement.powertop.enable = true;
services.thermald.enable = true;
services.upower = {
enable = true;
};
services.logind.extraConfig = {
HandlePowerKey = "hibernate"; # Hibernate when the power button is pressed
HandleLidSwitch = "hibernate"; # Hibernate when the lid is closed
};
systemd.sleep = {
hibernate = true;
hybridSleep = true;
};
}

View File

@@ -16,6 +16,7 @@ in
{ {
imports = [ imports = [
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
./laptop.nix
]; ];
modules = { modules = {
fish.enable = true; fish.enable = true;
@@ -24,6 +25,7 @@ in
steam.enable = false; steam.enable = false;
Hyprland.enable = true; Hyprland.enable = true;
wivrn.enable = false; wivrn.enable = false;
fonts.enable = true;
}; };
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
@@ -37,7 +39,8 @@ in
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/London"; # time.timeZone = "Europe/London";
services.automatic-timezoned.enable = true;
nix.settings = { nix.settings = {
substituters = [ substituters = [
@@ -59,6 +62,16 @@ in
}; };
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;
extraPackages = with pkgs; [
# Required for modern Intel GPUs (Xe iGPU and ARC)
intel-media-driver # VA-API (iHD) userspace
vpl-gpu-rt # oneVPL (QSV) runtime
# Optional (compute / tooling):
intel-compute-runtime # OpenCL (NEO) + Level Zero for Arc/Xe
# NOTE: 'intel-ocl' also exists as a legacy package; not recommended for Arc/Xe.
# libvdpau-va-gl # Only if you must run VDPAU-only apps
];
}; };
services.openssh = { services.openssh = {
enable = true; enable = true;

View File

@@ -24,6 +24,7 @@ in
steam.enable = true; steam.enable = true;
Hyprland.enable = true; Hyprland.enable = true;
wivrn.enable = true; wivrn.enable = true;
fonts.enable = true;
}; };
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
@@ -174,29 +175,29 @@ in
package = config.boot.kernelPackages.nvidiaPackages.latest; package = config.boot.kernelPackages.nvidiaPackages.latest;
}; };
fonts = { # fonts = {
enableDefaultPackages = true; # enableDefaultPackages = true;
packages = # packages =
with pkgs; # with pkgs;
[ # [
nerd-fonts.jetbrains-mono # nerd-fonts.jetbrains-mono
material-design-icons # material-design-icons
material-symbols # material-symbols
googlesans-code # googlesans-code
nerd-fonts.caskaydia-cove # nerd-fonts.caskaydia-cove
nerd-fonts.noto # nerd-fonts.noto
noto-fonts-cjk-sans # noto-fonts-cjk-sans
noto-fonts-cjk-serif # noto-fonts-cjk-serif
] # ]
++ [ # ++ [
(inputs.font-patcher.lib.patchFont { # (inputs.font-patcher.lib.patchFont {
font = "${pkgs.googlesans-code}/share/fonts/googlesans-code/GoogleSansCode[wght].ttf"; # font = "${pkgs.googlesans-code}/share/fonts/googlesans-code/GoogleSansCode[wght].ttf";
name = "Google Sans Code Nerd Font"; # name = "Google Sans Code Nerd Font";
inherit system; # inherit system;
}) # })
]; # ];
fontDir.enable = true; # fontDir.enable = true;
}; # };
boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
programs.nix-ld.enable = true; programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [ programs.nix-ld.libraries = with pkgs; [

38
modules/fonts/nixos.nix Normal file
View File

@@ -0,0 +1,38 @@
{
inputs,
pkgs,
lib,
config,
...
}:
let
cfg = config.modules.fonts;
in
{
options.modules.fonts = {
enable = lib.mkEnableOption "fonts";
};
config.fonts = lib.mkIf cfg.enable {
enableDefaultPackages = true;
packages =
with pkgs;
[
nerd-fonts.jetbrains-mono
material-design-icons
material-symbols
googlesans-code
nerd-fonts.caskaydia-cove
nerd-fonts.noto
noto-fonts-cjk-sans
noto-fonts-cjk-serif
]
++ [
(inputs.font-patcher.lib.patchFont {
font = "${pkgs.googlesans-code}/share/fonts/googlesans-code/GoogleSansCode[wght].ttf";
name = "Google Sans Code Nerd Font";
inherit system;
})
];
fontDir.enable = true;
};
}