From 3dc8bee3cb3a472dcf8d3990a6623327ac75d985 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Fri, 5 Dec 2025 09:38:13 +0530 Subject: feat(cez/specialisation/heater): init --- flake.lock | 12 ++++++------ home/common/modules/git.nix | 13 +++++++------ home/wayland/modules/sway/swayidle.nix | 8 +------- os/cez/configuration.nix | 1 + os/cez/hardware-configuration.nix | 25 ------------------------- os/cez/modules/specialisation/default.nix | 6 ++++++ os/cez/modules/specialisation/heater.nix | 31 +++++++++++++++++++++++++++++++ os/cez/modules/specialisation/nvidia.nix | 25 +++++++++++++++++++++++++ os/common/modules/home-manager.nix | 13 +++++-------- 9 files changed, 82 insertions(+), 52 deletions(-) create mode 100644 os/cez/modules/specialisation/default.nix create mode 100644 os/cez/modules/specialisation/heater.nix create mode 100644 os/cez/modules/specialisation/nvidia.nix diff --git a/flake.lock b/flake.lock index 396345d..2ae98ff 100644 --- a/flake.lock +++ b/flake.lock @@ -212,11 +212,11 @@ ] }, "locked": { - "lastModified": 1757132907, - "narHash": "sha256-OfvAAqf3MTEAn4qMBSbdyj2vHsaCFY//RWhafJXoSLo=", + "lastModified": 1765007211, + "narHash": "sha256-cMbpYbwAn/LoO1MHuVQ/w3UoJOgq0Qp7l1w2msZ+QXI=", "owner": "sinanmohd", "repo": "home-manager", - "rev": "6790cd605d16c48dc71956ca6e66b4b91a6347e8", + "rev": "6d04437fd9e06417b626dc562bde450875c730d7", "type": "github" }, "original": { @@ -345,11 +345,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1760284886, - "narHash": "sha256-TK9Kr0BYBQ/1P5kAsnNQhmWWKgmZXwUQr4ZMjCzWf2c=", + "lastModified": 1764667669, + "narHash": "sha256-7WUCZfmqLAssbDqwg9cUDAXrSoXN79eEEq17qhTNM/Y=", "owner": "NixOs", "repo": "nixpkgs", - "rev": "cf3f5c4def3c7b5f1fc012b3d839575dbe552d43", + "rev": "418468ac9527e799809c900eda37cbff999199b6", "type": "github" }, "original": { diff --git a/home/common/modules/git.nix b/home/common/modules/git.nix index 3f8a98e..077ee1d 100644 --- a/home/common/modules/git.nix +++ b/home/common/modules/git.nix @@ -1,15 +1,16 @@ { config, ... }: let - userName = config.global.userdata.nameFq; - userEmail = config.global.userdata.email; + name = config.global.userdata.nameFq; + email = config.global.userdata.email; in { programs.git = { enable = true; - inherit userName; - inherit userEmail; - - extraConfig = { + settings = { + user = { + inherit name; + inherit email; + }; color.ui = "auto"; init.defaultBranch = "master"; }; diff --git a/home/wayland/modules/sway/swayidle.nix b/home/wayland/modules/sway/swayidle.nix index d9ff473..b7d7d26 100644 --- a/home/wayland/modules/sway/swayidle.nix +++ b/home/wayland/modules/sway/swayidle.nix @@ -57,13 +57,7 @@ in services.swayidle = { enable = true; systemdTarget = "sway-session.target"; - - events = [ - { - event = "before-sleep"; - command = swaylock; - } - ]; + events."before-sleep" = swaylock; timeouts = [ { diff --git a/os/cez/configuration.nix b/os/cez/configuration.nix index 90c7786..0cf9957 100644 --- a/os/cez/configuration.nix +++ b/os/cez/configuration.nix @@ -7,6 +7,7 @@ ./modules/wireguard.nix ./modules/tlp.nix ../../global/cez + ./modules/specialisation ]; networking.hostName = "cez"; diff --git a/os/cez/hardware-configuration.nix b/os/cez/hardware-configuration.nix index 39dc3a6..da9ed90 100644 --- a/os/cez/hardware-configuration.nix +++ b/os/cez/hardware-configuration.nix @@ -46,29 +46,4 @@ fsType = "ext4"; }; }; - - specialisation.nvidia.configuration = { - boot = { - kernelParams = [ "transparent_hugepage=always" ]; - kernel.sysctl."vm.max_map_count" = 2147483642; - }; - - environment.variables = { - DRI_PRIME = 1; - __NV_PRIME_RENDER_OFFLOAD = 1; - __VK_LAYER_NV_optimus = "NVIDIA_only"; - __GLX_VENDOR_LIBRARY_NAME = "nvidia"; - }; - - hardware.nvidia = { - open = true; - nvidiaSettings = false; - prime.sync.enable = true; - }; - - services = { - xserver.videoDrivers = [ "nvidia" ]; - tlp.settings.PLATFORM_PROFILE_ON_AC = lib.mkForce "performance"; - }; - }; } diff --git a/os/cez/modules/specialisation/default.nix b/os/cez/modules/specialisation/default.nix new file mode 100644 index 0000000..c7fb4aa --- /dev/null +++ b/os/cez/modules/specialisation/default.nix @@ -0,0 +1,6 @@ +{ + specialisation = { + nvidia.configuration.imports = [ ./nvidia.nix ]; + heater.configuration.imports = [ ./heater.nix ]; + }; +} diff --git a/os/cez/modules/specialisation/heater.nix b/os/cez/modules/specialisation/heater.nix new file mode 100644 index 0000000..68dbf4d --- /dev/null +++ b/os/cez/modules/specialisation/heater.nix @@ -0,0 +1,31 @@ +{ + config, + pkgs, + lib, + ... +}: +let + heater = pkgs.writeShellApplication { + name = "heater"; + runtimeInputs = with pkgs; [ + vulkan-tools + mangohud + ]; + + text = '' + MESA_VK_WSI_PRESENT_MODE=immediate mangohud vkcube --present_mode 0 + ''; + }; + username = config.global.userdata.name; +in +{ + imports = [ ./nvidia.nix ]; + + services.logind.settings.Login.HandleLidSwitch = "ignore"; + environment.systemPackages = [ heater ]; + home-manager.users.${username}.imports = [ + { + wayland.windowManager.sway.settings.exec = [ "${lib.getExe heater}" ]; + } + ]; +} diff --git a/os/cez/modules/specialisation/nvidia.nix b/os/cez/modules/specialisation/nvidia.nix new file mode 100644 index 0000000..3ac30b4 --- /dev/null +++ b/os/cez/modules/specialisation/nvidia.nix @@ -0,0 +1,25 @@ +{ lib, ... }: +{ + boot = { + kernelParams = [ "transparent_hugepage=always" ]; + kernel.sysctl."vm.max_map_count" = 2147483642; + }; + + environment.variables = { + DRI_PRIME = 1; + __NV_PRIME_RENDER_OFFLOAD = 1; + __VK_LAYER_NV_optimus = "NVIDIA_only"; + __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + }; + + hardware.nvidia = { + open = true; + nvidiaSettings = false; + prime.sync.enable = true; + }; + + services = { + xserver.videoDrivers = [ "nvidia" ]; + tlp.settings.PLATFORM_PROFILE_ON_AC = lib.mkForce "performance"; + }; +} diff --git a/os/common/modules/home-manager.nix b/os/common/modules/home-manager.nix index 8212747..722c9ab 100644 --- a/os/common/modules/home-manager.nix +++ b/os/common/modules/home-manager.nix @@ -2,18 +2,15 @@ let username = config.global.userdata.name; host = config.networking.hostName; + homeManagerHostPath = ../../../home/${host}/home.nix; in { home-manager = { useGlobalPkgs = true; useUserPackages = false; - users.${username} = - { ... }: - { - imports = [ - ../../../home/common/home.nix - ] - ++ lib.optional (builtins.pathExists ../../../home/${host}) ../../../home/${host}/home.nix; - }; + users.${username}.imports = [ + ../../../home/common/home.nix + ] + ++ lib.optional (builtins.pathExists homeManagerHostPath) homeManagerHostPath; }; } -- cgit v1.2.3