commit 45c8c0dbc52cbc4a397ec643bf6b9e5e0e4b4934
parent 086916fc75364c93e5805740bf6c8d1217b34a83
Author: Vincent Demeester <vincent@sbr.pm>
Date: Mon, 19 Sep 2022 18:12:01 +0200
systems: officemode/roadmode is on wakasu, not aomi
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/systems/hosts/aomi.nix b/systems/hosts/aomi.nix
@@ -16,16 +16,6 @@ let
endpointPort = if secretCondition then (import secretPath).wg.listenPort else 0;
endpointPublicKey = strings.optionalString secretCondition (import secretPath).wireguard.kerkouane.publicKey;
metadata = importTOML ../../ops/hosts.toml;
-
- # Scripts
- officemode = pkgs.writeShellScriptBin "officemode" ''
- echo "80" > /sys/class/power_supply/BAT0/charge_control_end_threshold
- echo "70" > /sys/class/power_supply/BAT0/charge_control_start_threshold
- '';
- roadmode = pkgs.writeShellScriptBin "roadmode" ''
- echo "100" > /sys/class/power_supply/BAT0/charge_control_end_threshold
- echo "99" > /sys/class/power_supply/BAT0/charge_control_start_threshold
- '';
in
{
imports = [
@@ -63,18 +53,6 @@ in
hostName = hostname;
};
- environment.systemPackages = [ officemode roadmode ];
- security.sudo.extraRules = [
- # Allow execution of roadmode and officemode by users in wheel, without a password
- {
- groups = [ "wheel" ];
- commands = [
- { command = "${officemode}"; options = [ "NOPASSWD" ]; }
- { command = "${roadmode}"; options = [ "NOPASSWD" ]; }
- ];
- }
- ];
-
# extract this from desktop
networking.networkmanager = {
enable = true;
diff --git a/systems/hosts/wakasu.nix b/systems/hosts/wakasu.nix
@@ -12,6 +12,16 @@ let
getEmulator = system: (lib.systems.elaborate { inherit system; }).emulator pkgs;
metadata = importTOML ../../ops/hosts.toml;
+
+ # Scripts
+ officemode = pkgs.writeShellScriptBin "officemode" ''
+ echo "80" > /sys/class/power_supply/BAT0/charge_control_end_threshold
+ echo "70" > /sys/class/power_supply/BAT0/charge_control_start_threshold
+ '';
+ roadmode = pkgs.writeShellScriptBin "roadmode" ''
+ echo "100" > /sys/class/power_supply/BAT0/charge_control_end_threshold
+ echo "99" > /sys/class/power_supply/BAT0/charge_control_start_threshold
+ '';
in
{
imports = [
@@ -66,6 +76,17 @@ in
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="${pkgs.systemd}/bin/systemctl hibernate"
'';
+ security.sudo.extraRules = [
+ # Allow execution of roadmode and officemode by users in wheel, without a password
+ {
+ groups = [ "wheel" ];
+ commands = [
+ { command = "${officemode}"; options = [ "NOPASSWD" ]; }
+ { command = "${roadmode}"; options = [ "NOPASSWD" ]; }
+ ];
+ }
+ ];
+
modules = {
editors.emacs.enable = true;
hardware = {
@@ -103,6 +124,8 @@ in
environment.systemPackages = with pkgs; [
# docker client only
docker-client
+ officemode
+ roadmode
];
services = {