updated home/scripts

This commit is contained in:
serenity-F 2025-03-08 19:13:03 +10:00
parent f63a236b90
commit 6acf7a6d5d
4 changed files with 34 additions and 35 deletions

View file

@ -133,6 +133,8 @@
disksPath = "${homeDir}/Disks/"; # for easy disk navigation
flakePath = "${homeDir}/flakes/nixdots/"; # current path to flake - unused
#flakePath = "${homeDir}/SerenityOS/"; # for v1.0.0 release
wallpaper =
"${flakePath}/home/resources/wallpapers/almondBlossoms-VanGogh.jpg";
in {
@ -146,6 +148,7 @@
inherit label version;
inherit flakePath disksPath;
inherit primaryUser homeDir;
inherit wallpaper;
};
modules = [
sops-nix.nixosModules.sops
@ -162,6 +165,7 @@
inherit label version;
inherit flakePath disksPath;
inherit primaryUser homeDir;
inherit wallpaper;
};
modules = [
sops-nix.nixosModules.sops
@ -177,6 +181,7 @@
inherit label version;
inherit flakePath disksPath;
inherit primaryUser homeDir;
inherit wallpaper;
};
modules = [
sops-nix.nixosModules.sops
@ -198,6 +203,7 @@
inherit label version;
inherit flakePath disksPath;
inherit primaryUser homeDir;
inherit wallpaper;
};
modules = [
sops-nix.nixosModules.sops

19
home/scripts/battery.nix Normal file
View file

@ -0,0 +1,19 @@
{ pkgs, ... }:
let
## Battery status for laptop
battery-notif = pkgs.writeShellScriptBin "battery-notif" ''
# Send notifications when low on battery and not in charge
while true; do
battery_level=$(cat /sys/class/power_supply/BAT*/capacity)
battery_status=$(cat /sys/class/power_supply/BAT*/status)
if [[ $battery_level -le 20 ]] && [[ $battery_status == "Discharging" ]]; then
${pkgs.libnotify}/bin/notify-send "󰁻 Low battery" "Battery level is $battery_level%"
elif [[ $battery_level -le 10 ]] && [[ $battery_status == "Discharging" ]]; then
${pkgs.libnotify}/bin/notify-send --urgency=critical "󰁺 Very low battery" "Battery level is $battery_level%"
fi
sleep 60
done
'';
in { home.packages = [ battery-notif ]; }

View file

@ -1,10 +1,6 @@
{ pkgs, config, ... }:
{ ... }:
{
imports = [
./automount
./startup.nix
./desktop.nix
./nix-utils.nix
];
imports =
[ ./automount ./startup.nix ./desktop.nix ./battery.nix ./nix-utils.nix ];
}

View file

@ -1,20 +1,6 @@
{ pkgs, config, homeDir, ... }:
{ pkgs, wallpaper, ... }:
let
battery-notif = pkgs.writeShellScriptBin "battery-notif" ''
# Send notifications when low on battery and not in charge
while true; do
battery_level=$(cat /sys/class/power_supply/BAT*/capacity)
battery_status=$(cat /sys/class/power_supply/BAT*/status)
if [[ $battery_level -le 20 ]] && [[ $battery_status == "Discharging" ]]; then
${pkgs.libnotify}/bin/notify-send "󰁻 Low battery" "Battery level is $battery_level%"
elif [[ $battery_level -le 10 ]] && [[ $battery_status == "Discharging" ]]; then
${pkgs.libnotify}/bin/notify-send --urgency=critical "󰁺 Very low battery" "Battery level is $battery_level%"
fi
sleep 60
done
'';
startup = pkgs.writeShellScriptBin "startup" ''
# Because HM enabling services suck.
@ -22,28 +8,20 @@ let
systemctl --user start hyprpolkitagent
nicotine-plus
swww init & sleep 0.1
swww img ${config.theme.wallpaper}
swww img ${wallpaper}
'';
startupExtra = pkgs.writeShellScriptBin "startupExtra" ''
otd-gui
vesktop
easyeffects
nicotine-plus
vesktop
'';
in {
home.packages = [
startup
startupExtra
battery-notif
];
}
in { home.packages = [ startup startupExtra ]; }