Commit 45c8c0dbc52c

Vincent Demeester <vincent@sbr.pm>
2022-09-19 18:12:01
systems: officemode/roadmode is on wakasu, not aomi
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 086916f
Changed files (2)
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;
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 = {