Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # From configuration.nix
- systemd.user.services.batteryMonitor = {
- path = [ pkgs.bash pkgs.acpi pkgs.libnotify ];
- wantedBy = [ "multi-user.target" ];
- description = "Notifies when battery is low and suspends";
- serviceConfig = {
- Type = "simple";
- ExecStart = "${pkgs.bash}/bin/bash %h/.wm-scripts/battery-monitor.sh";
- };
- };
- systemd.user.timers.batteryMonitor = {
- timerConfig = {
- OnUnitInactiveSec = "2s";
- AccuracySec = "1s";
- };
- wantedBy = [ "timers.target" ];
- };
- λ systemctl --user cat batteryMonitor
- # /nix/store/bbakz8q4wcyhbh43n86f5z07i8jlsadv-unit-batteryMonitor.service/batteryMonitor.service
- [Unit]
- Description=Notifies when battery is low and suspends
- [Service]
- Environment="LOCALE_ARCHIVE=/nix/store/1xpr86xg998h5acn4zqrx58xjdjqnnds-glibc-locales-2.31/lib/locale/local>
- Environment="PATH=/nix/store/2jysm3dfsgby5sw5jgj43qjrb5v79ms9-bash-4.4-p23/bin:/nix/store/891p25c0g3acijh6g>
- Environment="TZDIR=/nix/store/xg8nmhp28a5xf6ifgg8n93nrwbp8ghvm-tzdata-2019c/share/zoneinfo"
- ExecStart=/nix/store/2jysm3dfsgby5sw5jgj43qjrb5v79ms9-bash-4.4-p23/bin/bash %h/.wm-scripts/battery-monitor.>
- Type=simple
- λ systemctl --user enable batteryMonitor
- The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
- Alias= settings in the [Install] section, and DefaultInstance= for template
- units). This means they are not meant to be enabled using systemctl.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement