mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-22 13:03:56 -05:00
moved pp-adjuster script to home modules
This commit is contained in:
parent
f188dd3843
commit
fe1ee27b8f
3
aly.nix
3
aly.nix
|
@ -58,6 +58,9 @@
|
||||||
vsCodium.enable = true;
|
vsCodium.enable = true;
|
||||||
webCord.enable = true;
|
webCord.enable = true;
|
||||||
};
|
};
|
||||||
|
scripts = {
|
||||||
|
pp-adjuster.enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
wayland.windowManager.sway.config.assigns = {
|
wayland.windowManager.sway.config.assigns = {
|
||||||
"workspace 1: web" = [{app_id = "firefox";}];
|
"workspace 1: web" = [{app_id = "firefox";}];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [./apps ./desktop ./services];
|
imports = [./apps ./desktop ./services ./scripts];
|
||||||
|
|
||||||
nixpkgs = {
|
nixpkgs = {
|
||||||
# Configure nixpkgs instance
|
# Configure nixpkgs instance
|
||||||
|
|
10
homeManagerModules/scripts/default.nix
Normal file
10
homeManagerModules/scripts/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [
|
||||||
|
./pp-adjuster
|
||||||
|
];
|
||||||
|
}
|
28
homeManagerModules/scripts/pp-adjuster/default.nix
Normal file
28
homeManagerModules/scripts/pp-adjuster/default.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
pp-adjuster = pkgs.writeShellScriptBin "pp-adjuster" ''
|
||||||
|
# Only works on petalburg.
|
||||||
|
current_profile=$(${pkgs.power-profiles-daemon}/bin/powerprofilesctl get | tr -d '[:space:]')
|
||||||
|
|
||||||
|
if [ "$current_profile" == "power-saver" ]; then
|
||||||
|
${pkgs.power-profiles-daemon}/bin/powerprofilesctl set balanced
|
||||||
|
elif [ "$current_profile" == "balanced" ]; then
|
||||||
|
${pkgs.power-profiles-daemon}/bin/powerprofilesctl set performance
|
||||||
|
elif [ "$current_profile" == "performance" ]; then
|
||||||
|
${pkgs.power-profiles-daemon}/bin/powerprofilesctl set power-saver
|
||||||
|
fi
|
||||||
|
|
||||||
|
new_profile=$(${pkgs.power-profiles-daemon}/bin/powerprofilesctl get | tr -d '[:space:]')
|
||||||
|
${pkgs.libnotify}/bin/notify-send "Power profile set to $new_profile."
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
options = {alyraffauf.scripts.pp-adjuster.enable = lib.mkEnableOption "Enable pp-adjuster script.";};
|
||||||
|
|
||||||
|
config = lib.mkIf config.alyraffauf.scripts.pp-adjuster.enable {
|
||||||
|
home.packages = [pp-adjuster];
|
||||||
|
};
|
||||||
|
}
|
|
@ -30,28 +30,6 @@
|
||||||
plasma-apply-lookandfeel -a org.kde.breezedark.desktop
|
plasma-apply-lookandfeel -a org.kde.breezedark.desktop
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pp-adjuster = pkgs.writeShellApplication {
|
|
||||||
name = "pp-adjuster";
|
|
||||||
|
|
||||||
runtimeInputs = [pkgs.libnotify pkgs.power-profiles-daemon];
|
|
||||||
|
|
||||||
text = ''
|
|
||||||
# Only works on petalburg.
|
|
||||||
current_profile=$(${pkgs.power-profiles-daemon}/bin/powerprofilesctl get | tr -d '[:space:]')
|
|
||||||
|
|
||||||
if [ "$current_profile" == "power-saver" ]; then
|
|
||||||
${pkgs.power-profiles-daemon}/bin/powerprofilesctl set balanced
|
|
||||||
elif [ "$current_profile" == "balanced" ]; then
|
|
||||||
${pkgs.power-profiles-daemon}/bin/powerprofilesctl set performance
|
|
||||||
elif [ "$current_profile" == "performance" ]; then
|
|
||||||
${pkgs.power-profiles-daemon}/bin/powerprofilesctl set power-saver
|
|
||||||
fi
|
|
||||||
|
|
||||||
new_profile=$(${pkgs.power-profiles-daemon}/bin/powerprofilesctl get | tr -d '[:space:]')
|
|
||||||
${pkgs.libnotify}/bin/notify-send "Power profile set to $new_profile."
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./disko.nix
|
./disko.nix
|
||||||
|
@ -70,7 +48,7 @@ in {
|
||||||
|
|
||||||
networking.hostName = "petalburg"; # Define your hostname.
|
networking.hostName = "petalburg"; # Define your hostname.
|
||||||
|
|
||||||
environment.systemPackages = [cs-adjuster cs-adjuster-plasma pp-adjuster];
|
environment.systemPackages = [cs-adjuster cs-adjuster-plasma];
|
||||||
|
|
||||||
alyraffauf = {
|
alyraffauf = {
|
||||||
system = {
|
system = {
|
||||||
|
|
Loading…
Reference in a new issue