Compare commits

..

4 commits

Author SHA1 Message Date
028a370299 battery notifier
Some checks failed
Activate Homelab Configuration / rebuild (push) Failing after 9s
2026-03-20 06:54:42 +07:00
2890b8b503 preinstall extensions 2026-03-20 06:54:42 +07:00
1b40da95a7 disable forgejo internal sign in 2026-03-20 06:54:42 +07:00
ac542840a0 fix broken dest 2026-03-20 06:54:42 +07:00
4 changed files with 23 additions and 4 deletions

View file

@ -1,4 +1,4 @@
{ pkgs, resume-dev, ... }: {
{ pkgs, username, resume-dev, ... }: {
powerManagement.powertop.enable = true;
services = {
@ -10,6 +10,18 @@
echo 85 > /sys/class/power_supply/BAT*/charge_control_end_threshold || true
''}"
'';
cron = {
enable = true;
systemCronJobs = [
"* * * * * ${username} bash -x ${pkgs.writeShellScript "low-battery-notifier" ''
BAT_PCT=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '[0-9]+(?=%)'`
BAT_STA=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '\w+(?=,)'`
echo "`date` battery status:$BAT_STA percentage:$BAT_PCT"
test $BAT_PCT -le 30 && test $BAT_PCT -gt 15 && test $BAT_STA = "Discharging" && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send -c device -u normal "Low Battery" "\$\{BAT_PCT}% remaining."
test $BAT_PCT -le 15 && test $BAT_STA = "Discharging" && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send -c device -u critical "Low Battery" "Shutdown at 10%."
''} > /tmp/cron.batt.log 2>&1"
];
};
upower = {
enable = true;
percentageCritical = 15;

View file

@ -2,7 +2,14 @@
programs.zed-editor = {
enable = true;
package = pkgs.zed-editor;
extensions = [ "nix" ];
extensions = [
"html" "html-snippets"
"svelte" "svelte-snippets"
"wakatime" "discord-presence"
"catppuccin" "catppuccin-icons"
"git-firefly"
"nix"
];
userSettings = {
format_on_save = "off";
vim_mode = true;

View file

@ -25,7 +25,7 @@
DISABLE_REGISTRATION = true;
ENABLE_OPENID_SIGNIN = false;
ENABLE_OPENID_SIGNUP = false;
ENABLE_INTERNAL_SIGNIN = true;
ENABLE_INTERNAL_SIGNIN = false;
SHOW_REGISTRATION_BUTTON = false;
ALLOW_ONLY_EXTERNAL_REGISTRATION = true;
ALLOW_ONLY_INTERNAL_REGISTRATION = false;

View file

@ -74,7 +74,7 @@ in {
} // lib.mapAttrs' (subdomain: cfg: lib.nameValuePair "${subdomain}.${base}" {
useACMEHost = base;
forceSSL = true;
locations."/".return = "301 ${base}";
locations."/".return = "301 ${cfg.dest}";
}) redirects // lib.mapAttrs' (subdomain: cfg: lib.nameValuePair (if subdomain == "@" then base else "${subdomain}.${base}") {
useACMEHost = base;
forceSSL = true;