diff --git a/flake.nix b/flake.nix
index cafb311..95bce6e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,10 +2,10 @@
description = "Nix config entry point";
inputs = {
- nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Home manager
- home-manager.url = "github:nix-community/home-manager/release-25.05";
+ home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Managing flatpak apps
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1";
diff --git a/hosts/spectre-x360-2018/default.nix b/hosts/spectre-x360-2018/default.nix
index 80495fd..64ff277 100644
--- a/hosts/spectre-x360-2018/default.nix
+++ b/hosts/spectre-x360-2018/default.nix
@@ -5,6 +5,7 @@
./configuration.nix
./hardware-configuration.nix
../../modules/nixos/bluetooth.nix
+ ../../modules/nixos/flakes.nix
../../modules/nixos/fonts.nix
../../modules/nixos/hyprland.nix
../../modules/nixos/monitoring.nix
@@ -12,6 +13,7 @@
../../modules/nixos/nvidia.nix
../../modules/nixos/pipewire.nix
../../modules/nixos/podman.nix
+ ../../modules/nixos/power.nix
../../utils/binary-cache.nix
../../utils/garbage-collection.nix
];
diff --git a/modules/home-manager/code.nix b/modules/home-manager/code.nix
index 7e9c1eb..ce389f8 100644
--- a/modules/home-manager/code.nix
+++ b/modules/home-manager/code.nix
@@ -3,119 +3,114 @@
programs.vscode = {
enable = true;
- profiles = {
- default = {
- extensions = with pkgs.vscode-extensions; [
- # QOL
- mhutchie.git-graph
- redhat.vscode-yaml
- github.copilot
+ # profiles = {
+ # default = {
+ extensions = with pkgs.vscode-extensions; [
+ # QOL
+ mhutchie.git-graph
+ redhat.vscode-yaml
+ github.copilot
- # python
- ms-python.python
- ms-python.isort
- ms-python.debugpy
- ms-python.vscode-pylance
+ # python
+ ms-python.python
+ ms-python.isort
+ ms-python.debugpy
+ ms-python.vscode-pylance
- # Nix language
- jnoortheen.nix-ide
- ];
+ # Nix language
+ jnoortheen.nix-ide
+ ];
+ # };
+
+ keybindings = [
+ {
+ key = "ctrl+#";
+ command = "editor.action.commentLine";
+ when = "textInputFocus";
+ }
+ ];
+
+ userSettings = {
+ "telemetry.enableCrashReporter" = false;
+ "telemetry.enableTelemetry" = false;
+ "git.ignoreMissingGitWarning" = true;
+ "editor.suggestSelection" = "first";
+ "workbench.editorAssociations" = {
+ "*.ipynb" = "jupyter-notebook";
};
-
- keybindings = {
- "ctrl+shift+." = "workbench.action.terminal.focus";
- "ctlr+#" = "editor.action.commentLine";
+ "workbench.startupEditor" = "newUntitledFile";
+ "editor.renderWhitespace" = "none";
+ "editor.acceptSuggestionOnEnter" = "off";
+ "explorer.confirmDelete" = false;
+ "git.confirmSync" = false;
+ "workbench.iconTheme" = "vs-seti";
+ "editor.fontLigatures" = true;
+ "explorer.confirmDragAndDrop" = false;
+ "editor.wordWrap" = "on";
+ "settingsSync.ignoredSettings" = [
+ "editor.fontFamily"
+ "terminal.integrated.fontFamily"
+ "-python.venvFolders"
+ ];
+ "jupyter.askForKernelRestart" = false;
+ "security.workspace.trust.untrustedFiles" = "open";
+ "notebook.cellToolbarLocation" = {
+ "default" = "right";
+ "jupyter-notebook" = "left";
};
-
- userSettings = ''
- {
- "telemetry.enableCrashReporter": false,
- "telemetry.enableTelemetry": false,
- "git.ignoreMissingGitWarning": true,
- "editor.suggestSelection": "first",
- "workbench.editorAssociations": {
- "*.ipynb": "jupyter-notebook"
- },
- "workbench.startupEditor": "newUntitledFile",
- "editor.renderWhitespace": "none",
- "editor.acceptSuggestionOnEnter": "off",
- "explorer.confirmDelete": false,
- "git.confirmSync": false,
- "workbench.iconTheme": "vs-seti",
- "editor.fontLigatures": true,
- "explorer.confirmDragAndDrop": false,
- "editor.wordWrap": "on",
- "files.associations": {
- },
- "settingsSync.ignoredSettings": [
- "editor.fontFamily",
- "terminal.integrated.fontFamily",
- "-python.venvFolders"
- ],
- "jupyter.askForKernelRestart": false,
- "security.workspace.trust.untrustedFiles": "open",
- "notebook.cellToolbarLocation": {
- "default": "right",
- "jupyter-notebook": "left"
- },
- "git.enableSmartCommit": true,
- "terminal.integrated.fontFamily": "Fira Code",
- "settingsSync.ignoredExtensions": [
- "ms-vscode-remote.remote-wsl",
- "ms-vscode-remote.remote-ssh-edit",
- "ms-vscode-remote.remote-ssh"
- ],
- "editor.bracketPairColorization.enabled": true,
- "jupyter.widgetScriptSources": [
- "jsdelivr.com",
- "unpkg.com"
- ],
- "%DOC%.tex"
- ],
- "diffEditor.renderSideBySide": false,
- "editor.inlineSuggest.enabled": true,
- "suppressLineUncommittedWarning": true
- },
- "github.copilot.enable": {
- "*": true,
- "plaintext": true,
- "markdown": true,
- "scminput": false,
- "yaml": true
- },
- "redhat.telemetry.enabled": false,
- "git.autofetch": true,
- "terminal.integrated.enableMultiLinePasteWarning": false,
- "editor.unicodeHighlight.nonBasicASCII": false,
- "jupyter.disableJupyterAutoStart": true,
- "editor.unicodeHighlight.invisibleCharacters": false,
- "editor.unicodeHighlight.ambiguousCharacters": false,
- "diffEditor.ignoreTrimWhitespace": false,
- "update.showReleaseNotes": false,
- "terminal.external.linuxExec": "kitty",
- "window.dialogStyle": "custom",
- "window.titleBarStyle": "custom",
- "github.copilot.editor.enableAutoCompletions": true,
- "window.menuBarVisibility": "compact",
- "workbench.colorTheme": "Default Light+",
- "github.copilot.advanced": {},
- "git.openRepositoryInParentFolders": "never",
- "terminal.integrated.commandsToSkipShell": [
- "language-julia.interrupt"
- ],
- "diffEditor.hideUnchangedRegions.enabled": true,
- "[typst]": {
- "editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?"
- },
- "[typst-code]": {
- "editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?"
- },
- "tinymist.fontPaths": [
- "./font"
- ],
- "editor.fontFamily": "'FiraCode Nerd Font Mono', 'monospace', monospace",
- };
- '';
+ "git.enableSmartCommit" = true;
+ "terminal.integrated.fontFamily" = "Fira Code";
+ "settingsSync.ignoredExtensions" = [
+ "ms-vscode-remote.remote-wsl"
+ "ms-vscode-remote.remote-ssh-edit"
+ "ms-vscode-remote.remote-ssh"
+ ];
+ "editor.bracketPairColorization.enabled" = true;
+ "jupyter.widgetScriptSources" = [
+ "jsdelivr.com"
+ "unpkg.com"
+ ];
+ "diffEditor.renderSideBySide" = false;
+ "editor.inlineSuggest.enabled" = true;
+ "github.copilot.enable" = {
+ "*" = true;
+ "plaintext" = true;
+ "markdown" = true;
+ "scminput" = false;
+ "yaml" = true;
+ };
+ "redhat.telemetry.enabled" = false;
+ "git.autofetch" = true;
+ "terminal.integrated.enableMultiLinePasteWarning" = false;
+ "editor.unicodeHighlight.nonBasicASCII" = false;
+ "jupyter.disableJupyterAutoStart" = true;
+ "editor.unicodeHighlight.invisibleCharacters" = false;
+ "editor.unicodeHighlight.ambiguousCharacters" = false;
+ "diffEditor.ignoreTrimWhitespace" = false;
+ "update.showReleaseNotes" = false;
+ "terminal.external.linuxExec" = "kitty";
+ "window.dialogStyle" = "custom";
+ "window.titleBarStyle" = "custom";
+ "github.copilot.editor.enableAutoCompletions" = true;
+ "window.menuBarVisibility" = "compact";
+ "workbench.colorTheme" = "Default Light+";
+ "github.copilot.advanced" = {};
+ "git.openRepositoryInParentFolders" = "never";
+ "terminal.integrated.commandsToSkipShell" = [
+ "language-julia.interrupt"
+ ];
+ "diffEditor.hideUnchangedRegions.enabled" = true;
+ "[typst]" = {
+ "editor.wordSeparators" = "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?";
+ };
+ "[typst-code]" = {
+ "editor.wordSeparators" = "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?";
+ };
+ "tinymist.fontPaths" = [
+ "./font"
+ ];
+ "editor.fontFamily" = "'FiraCode Nerd Font Mono', 'monospace', monospace";
};
+ };
}
diff --git a/modules/home-manager/hypr/hyprland-customization.nix b/modules/home-manager/hypr/hyprland-customization.nix
index a6444b6..5dcc954 100644
--- a/modules/home-manager/hypr/hyprland-customization.nix
+++ b/modules/home-manager/hypr/hyprland-customization.nix
@@ -59,9 +59,9 @@
# "${pkgs.hyprpaper}/bin/hyprpaper"
# hyprpaper is handled as its own service
"${pkgs.waybar}/bin/waybar"
- # Fixes cursor themes in gnome apps under hyprland
- "gsettings set org.gnome.desktop.interface cursor-theme '${config.home.pointerCursor.name}'"
- "gsettings set org.gnome.desktop.interface cursor-size ${toString home.pointerCursor.size}"
+ # # Fixes cursor themes in gnome apps under hyprland
+ # "gsettings set org.gnome.desktop.interface cursor-theme '${config.home.pointerCursor.name}'"
+ # "gsettings set org.gnome.desktop.interface cursor-size ${toString home.pointerCursor.size}"
];
general = {
diff --git a/modules/home-manager/hypr/hyprpaper.nix b/modules/home-manager/hypr/hyprpaper.nix
index 0581fdc..b86b13e 100644
--- a/modules/home-manager/hypr/hyprpaper.nix
+++ b/modules/home-manager/hypr/hyprpaper.nix
@@ -4,23 +4,23 @@
...
}:
with lib; let
- wallpapers = builtins.readDir ../../../wallpapers;
+ # wallpapers = builtins.readDir ../../../wallpapers;
- wallpaperBashArray = "(\"${strings.concatStrings (strings.intersperse "\" \"" (map (wallpaper: ../../../wallpapers + "/" + wallpaper) (attrNames wallpapers)))}\")";
- wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
- wallpapers=${wallpaperBashArray}
- rand=$[$RANDOM % ''${#wallpapers[@]}]
- wallpaper=''${wallpapers[$rand]}
+ # wallpaperBashArray = "(\"${strings.concatStrings (strings.intersperse "\" \"" (map (wallpaper: ../../../wallpapers + "/" + wallpaper) (attrNames wallpapers)))}\")";
+ # wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
+ # wallpapers=${wallpaperBashArray}
+ # rand=$[$RANDOM % ''${#wallpapers[@]}]
+ # wallpaper=''${wallpapers[$rand]}
- monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`)
- hyprctl hyprpaper unload all
- hyprctl hyprpaper preload $wallpaper
- for m in ''${monitor[@]}; do
- hyprctl hyprpaper wallpaper "$m,$wallpaper"
- done
- '';
+ # monitor=(`hyprctl monitors | grep Monitor | awk '{print $2}'`)
+ # hyprctl hyprpaper unload all
+ # hyprctl hyprpaper preload $wallpaper
+ # for m in ''${monitor[@]}; do
+ # hyprctl hyprpaper wallpaper "$m,$wallpaper"
+ # done
+ # '';
in {
- home.packages = [wallpaperRandomizer];
+ # home.packages = [wallpaperRandomizer];
services.hyprpaper = {
enable = true;
@@ -32,29 +32,29 @@ in {
# };
};
- systemd.user = {
- services.wallpaperRandomizer = {
- Install = {WantedBy = ["graphical-session.target"];};
+ # systemd.user = {
+ # services.wallpaperRandomizer = {
+ # Install = {WantedBy = ["graphical-session.target"];};
- Unit = {
- Description = "Set random desktop background using hyprpaper";
- After = ["graphical-session-pre.target"];
- PartOf = ["graphical-session.target"];
- };
+ # Unit = {
+ # Description = "Set random desktop background using hyprpaper";
+ # After = ["graphical-session-pre.target"];
+ # PartOf = ["graphical-session.target"];
+ # };
- Service = {
- Type = "oneshot";
- ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
- IOSchedulingClass = "idle";
- };
- };
+ # Service = {
+ # Type = "oneshot";
+ # ExecStart = "${wallpaperRandomizer}/bin/wallpaperRandomizer";
+ # IOSchedulingClass = "idle";
+ # };
+ # };
- timers.wallpaperRandomizer = {
- Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
+ # timers.wallpaperRandomizer = {
+ # Unit = {Description = "Set random desktop background using hyprpaper on an interval";};
- Timer = {OnUnitActiveSec = "6h";};
+ # Timer = {OnUnitActiveSec = "6h";};
- Install = {WantedBy = ["timers.target"];};
- };
- };
+ # Install = {WantedBy = ["timers.target"];};
+ # };
+ # };
}
\ No newline at end of file
diff --git a/modules/home-manager/hypr/waybar.nix b/modules/home-manager/hypr/waybar.nix
index 208b1a7..5af4e1c 100644
--- a/modules/home-manager/hypr/waybar.nix
+++ b/modules/home-manager/hypr/waybar.nix
@@ -5,9 +5,13 @@
# waybar requires font-awesome
home.packages = [
- # fira code now contains ligatures and font-awesome
- nerd-fonts.fira-code
pkgs.pavucontrol
+ # fira code now contains ligatures and font-awesome
+ # TODO - this only works after nixpkgs 25.05
+ # nerd-fonts.fira-code
+ (pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; })
+ pkgs.fira-code
+
];
# enable waybar
@@ -47,23 +51,18 @@
"battery"
"backlight"
"tray"
+ "idle_inhibitor"
];
# module specific settings
"hyprland/workspaces" = {
format = "{icon}";
format-icons = {
- active = "";
- default = "";
- empty = "";
+ active = "●";
+ default = "○";
};
};
- "custom/notification" = {
- tooltip = false;
- format = "";
- on-click = "swaync-client -t -sw";
- escape = true;
- };
+
"clock" = {
format = "{:%H:%M}";
interval = 1;
@@ -74,16 +73,16 @@
};
};
};
+
+ "idle_inhibitor" = {
+ format = "{icon}";
+ format-icons = {
+ activated = "";
+ deactivated = "";
+ };
+ tooltip = "true";
+ };
- # "network" = {
- # "format-wifi" = "";
- # "format-ethernet" ="";
- # "format-disconnected" = "";
- # "tooltip-format-disconnected" = "Error";
- # "tooltip-format-wifi" = "{essid} ({signalStrength}%) ";
- # "tooltip-format-ethernet" = "{ifname} 🖧 ";
- # "on-click" = "kitty nmtui";
- # };
"bluetooth" = {
format-on = "";
format-off = "BT-off";
@@ -110,28 +109,50 @@
};
"pulseaudio" = {
- reverse-scrolling = 1;
- format = "{volume}% {icon} {format_source}";
+ format = "{icon} {volume}% {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
- format-bluetooth-muted = " {icon} {format_source}";
- format-muted = "婢 {format_source}";
- format-source = "{volume}% ";
+ format-bluetooth-muted = " {icon} {format_source}";
+ format-muted = " {format_source}";
+ format-source = " {volume}%";
format-source-muted = "";
format-icons = {
headphone = "";
- hands-free = "";
- headset = "";
+ hands-free = "";
+ headset = "";
phone = "";
portable = "";
- car = "";
- default = ["奄" "奔" "墳"];
+ default = [
+ ""
+ ""
+ ""
+ ];
};
- on-click = "pavucontrol";
- min-length = 13;
+ on-click = "sleep 0.1 && pavucontrol";
};
"tray" = {
spacing = 5;
};
+
+ "custom/notification" = {
+ tooltip = false;
+ format = "{icon} {}";
+ format-icons = {
+ notification = "";
+ none = "";
+ dnd-notification = "";
+ dnd-none = "";
+ inhibited-notification = "";
+ inhibited-none = "";
+ dnd-inhibited-notification = "";
+ dnd-inhibited-none = "";
+ };
+ return-type = "json";
+ exec-if = "which swaync-client";
+ exec = "swaync-client -swb";
+ on-click = "sleep 0.1 && task-waybar";
+ escape = true;
+ };
+
};
};
@@ -151,6 +172,11 @@
window#waybar.hidden {
opacity: 0.2;
}
+
+ .module {
+ color: #ffffff;
+ border: none;
+ }
#workspaces {
margin-right: 8px;
@@ -172,56 +198,10 @@
font-size: 12px;
}
- /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
- #workspaces button:hover {
- transition: none;
- box-shadow: inherit;
- text-shadow: inherit;
- border-radius: inherit;
- color: #383c4a;
- background: #7c818c;
- }
-
#workspaces button.focused {
color: white;
}
- #language {
- padding-left: 16px;
- padding-right: 8px;
- border-radius: 10px 0px 0px 10px;
- transition: none;
- color: #ffffff;
- background: #383c4a;
- }
-
- #keyboard-state {
- margin-right: 8px;
- padding-right: 16px;
- border-radius: 0px 10px 10px 0px;
- transition: none;
- color: #ffffff;
- background: #383c4a;
- }
-
- #custom-pacman {
- padding-left: 16px;
- padding-right: 8px;
- border-radius: 10px 0px 0px 10px;
- transition: none;
- color: #ffffff;
- background: #383c4a;
- }
-
- #custom-mail {
- margin-right: 8px;
- padding-right: 16px;
- border-radius: 0px 10px 10px 0px;
- transition: none;
- color: #ffffff;
- background: #383c4a;
- }
-
#mode {
padding-left: 16px;
padding-right: 16px;
@@ -240,14 +220,6 @@
background: #383c4a;
}
- #custom-weather {
- padding-right: 16px;
- border-radius: 0px 10px 10px 0px;
- transition: none;
- color: #ffffff;
- background: #383c4a;
- }
-
#pulseaudio {
margin-right: 8px;
padding-left: 16px;
@@ -263,29 +235,7 @@
color: #2a5c45;
}
- #custom-mem {
- margin-right: 8px;
- padding-left: 16px;
- padding-right: 16px;
- border-radius: 10px;
- transition: none;
- color: #ffffff;
- background: #383c4a;
- }
- #temperature {
- margin-right: 8px;
- padding-left: 16px;
- padding-right: 16px;
- border-radius: 10px;
- transition: none;
- color: #ffffff;
- background: #383c4a;
- }
-
- #temperature.critical {
- background-color: #eb4d4b;
- }
#backlight {
margin-right: 8px;
diff --git a/modules/home-manager/xdg-portals.nix b/modules/home-manager/xdg-portals.nix
index a796bf2..ab6c353 100644
--- a/modules/home-manager/xdg-portals.nix
+++ b/modules/home-manager/xdg-portals.nix
@@ -4,7 +4,7 @@
xdg.portal = {
enable = true;
- configPackages [ pkgs.hyprland ];
+ configPackages = [ pkgs.hyprland ];
extraPortals = [
pkgs.xdg-desktop-portal-gtk
@@ -17,7 +17,7 @@
createDirectories = true;
desktop = "Desktop";
documents = "Documents";
- downloads = "Downloads";
+ # downloads = "Downloads";
pictures = "Pictures";
};
}
diff --git a/modules/nixos/flakes.nix b/modules/nixos/flakes.nix
new file mode 100644
index 0000000..2b6f25a
--- /dev/null
+++ b/modules/nixos/flakes.nix
@@ -0,0 +1,3 @@
+{
+ nix.settings.experimental-features = [ "nix-command" "flakes" ];
+}
\ No newline at end of file
diff --git a/modules/nixos/nvidia.nix b/modules/nixos/nvidia.nix
index 010847e..54205ab 100644
--- a/modules/nixos/nvidia.nix
+++ b/modules/nixos/nvidia.nix
@@ -1,8 +1,8 @@
{
- config,
- lib,
- pkgs,
- ...
+ config,
+ lib,
+ pkgs,
+ ...
}:
{
@@ -29,14 +29,7 @@
intelBusId = "PCI:0:2:0";
};
- package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
- version = "565.77";
- sha256_64bit = "sha256-CnqnQsRrzzTXZpgkAtF7PbH9s7wbiTRNcM0SPByzFHw=";
- sha256_aarch64 = "sha256-LSAYUnhfnK3rcuPe1dixOwAujSof19kNOfdRHE7bToE=";
- openSha256 = "sha256-Fxo0t61KQDs71YA8u7arY+503wkAc1foaa51vi2Pl5I=";
- settingsSha256 = "sha256-VUetj3LlOSz/LB+DDfMCN34uA4bNTTpjDrb6C6Iwukk=";
- persistencedSha256 = "sha256-wnDjC099D8d9NJSp9D0CbsL+vfHXyJFYYgU3CwcqKww=";
- };
+ package = config.boot.kernelPackages.nvidiaPackages.beta;
};
# overwrite the blacklists set previously
boot.extraModprobeConfig = "";
@@ -65,31 +58,9 @@
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", ATTR{power/control}="auto", ATTR{remove}="1"
'';
-
# # Remove the whole bridge responsible for the VGA/3D controller
# ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{class}=="0x060400", ATTR{power/control}="auto", ATTR{remove}="1"
- # # somehow the udev rules are not enough to prevent the nouveau driver from loading
- # # Also unload remove the bus by id manually
- # # unload 0000:01:00.1 and 0000:01:00.0
- # # at boot echo 1 > /sys/bus/pci/devices/0000:01:00.1/remove
- # # at boot echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove
-
- # systemd.services.remove-nouveau = {
- # description = "Remove Nouveau PCI devices";
- # wantedBy = [ "multi-user.target" ];
- # after = [ "sysinit.target" ];
- # serviceConfig = {
- # Type = "oneshot";
- # ExecStart = "${pkgs.coreutils}/bin/echo 1 > /sys/bus/pci/devices/0000:01:00.1/remove";
- # ExecStart = "${pkgs.coreutils}/bin/echo auto > /sys/bus/pci/devices/0000:00:01.0/power/control";
- # ExecStart = "${pkgs.coreutils}/bin/echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove";
- # ExecStart = "${pkgs.coreutils}/bin/echo auto > /sys/bus/pci/devices/0000:00:01.0/power/control";
- # };
- # };
-
-
-
boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
}
diff --git a/modules/nixos/power.nix b/modules/nixos/power.nix
new file mode 100644
index 0000000..5e5a357
--- /dev/null
+++ b/modules/nixos/power.nix
@@ -0,0 +1,30 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+{
+ services.tlp = {
+ enable = true;
+ settings = {
+ CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
+ CPU_SCALING_GOVERNOR_ON_AC = "performance";
+
+ CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
+ CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
+
+ CPU_MIN_PERF_ON_AC = 0;
+ CPU_MAX_PERF_ON_AC = 100;
+ CPU_MIN_PERF_ON_BAT = 0;
+ CPU_MAX_PERF_ON_BAT = 50;
+ };
+ };
+
+ systemd.sleep.extraConfig = ''
+ AllowSuspend=yes
+ AllowHibernation=yes
+ AllowHybridSleep=yes
+ AllowSuspendThenHibernate=yes
+ '';
+}