From 53d59bcd24369ae724d66b040ab71b974af38cfc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 8 Jan 2025 11:19:16 +0300 Subject: [PATCH] docs: expand nix installation; wording --- README.md | 68 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 9681f64..f4a3464 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,19 @@ # 🔋 Batmon -> **Batmon** is a dead-simple battery monitor for Linux written in Go. It -> provides real-time monitoring of battery status and adjusts the power profile -> accordingly to optimize battery life. +Dead-simple, somewhat configurable battery monitor for Linux. Batmon monitors +the battery path in real time and adjusts your power profiles accordingly to +optimize battery life for e.g. laptops. ## Features - Real-time monitoring of battery status -- Adjustment of power profile based on battery status -- Support for custom commands and extra commands -- Configuration via a JSON file -- Not written in Rust (the codebase is _readable_) +- Dynamic adjustment of power profiles +- Simple configuration though JSON configuration file + - Optional command execution on state changes ## Installation -## Prerequisites +### Prerequisites - Upower - powerprofilesctl @@ -22,8 +21,33 @@ ### Nix -**Batmon** is primarily distributed through a Nix flake. You may install it -manually using `nix profile install github:NotAShelf/batmon` +You are strongly encouraged to get Batmon through Nix, using the flake located +in this repository. You may install it manually on non-NixOS systems using +`nix profile install`. + +```bash +nix profile install github:NotAShelf/batmon +``` + +Or on NixOS systems using the package exposed for your system. + +```nix +{inputs, pkgs, ...}: { + environment.systemPackages = [ + inputs.batmon.packages.${pkgs.stdenv.system}.default + ]; +} +``` + +Alternatively, using the NixOS _module_ to install Batmon and configure a +systemd service for you. + +```nix +{inputs, pkgs, ...}: { + imports = [inputs.batmon.nixosModules.default]; + services.batmon.enable = true; +} +``` ### Manually @@ -31,25 +55,21 @@ manually using `nix profile install github:NotAShelf/batmon` go install . # this will install Batmon in your $GOPATH ``` -## Usage +Start Batmon through your terminal, or as a systemd service. -To start using Batmon, use the following command: +## Configuration -``` -batmon -``` - -By default, Gomon will load the configuration from config.json in the current -directory. You can specify a different configuration file using the `--config` -flag: +By default, Batmon will load the configuration from `config.json` located in the +current directory. You can specify a different configuration file using the +`--config` flag: ```console batmon -c /path/to/config.json ``` -The configuration file should contain a list of batteries to monitor, along -with any custom commands or extra commands to execute. Here's an example of -a configuration file: +The configuration file should contain a list of batteries to monitor, along with +any custom commands or extra commands to execute. Here's an example of a +configuration file: ```json { @@ -63,8 +83,8 @@ a configuration file: } ``` -- You can leave `command` empty to use the default behaviour - which will - switch active powerprofile using `powerprofiles set performance | balanced` +- You can leave `command` empty to use the default behaviour - which will switch + active powerprofile using `powerprofiles set performance | balanced` - `extraCommand`, if provided, will be executed in addition to the `command` value.