-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlaptop-base.nix
39 lines (34 loc) · 1.04 KB
/
laptop-base.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ config, pkgs, ... }:
{ hardware = {
opengl.driSupport32Bit = true; # needed for steam and/or wine, i believe
};
services = {
acpid.enable = true;
logind.extraConfig = ''
HoldoffTimeoutSec=0
'';
};
systemd.services.battery_check = {
description = "Send notification if battery is low";
serviceConfig = {
Type = "oneshot";
User = "anders";
ExecStart = pkgs.writeScript "battery_check" ''
#!${pkgs.bash}/bin/bash --login
. <(udevadm info -q property -p /sys/class/power_supply/BAT0 |
grep -E 'POWER_SUPPLY_(CAPACITY|STATUS)=')
if [[ $POWER_SUPPLY_STATUS = Discharging && $POWER_SUPPLY_CAPACITY -lt 15 ]];
then notify-send -u critical "Battery is low: $POWER_SUPPLY_CAPACITY";
fi
'';
};
environment = { DISPLAY = ":0"; };
after = [ "display-manager.service" ];
startAt = "*:00/5";
};
users.extraUsers.anders = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" "audio" "docker" "redis" "adbusers" ];
};
}