From 2e9eb5189394312b78aa01ee1468f06165f2f44c Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 17 May 2023 01:53:17 +0000 Subject: [PATCH] i2p/yggdrasil: factor out and only enable for desko/servo especially this means i no longer run them on moby, improving battery life & such --- hosts/by-name/desko/default.nix | 1 + hosts/by-name/lappy/default.nix | 2 -- hosts/by-name/servo/default.nix | 1 + hosts/common/default.nix | 1 - hosts/common/i2p.nix | 4 ---- hosts/modules/roles/ac.nix | 16 ++++++++++++++++ hosts/modules/roles/default.nix | 1 + 7 files changed, 19 insertions(+), 7 deletions(-) delete mode 100644 hosts/common/i2p.nix create mode 100644 hosts/modules/roles/ac.nix diff --git a/hosts/by-name/desko/default.nix b/hosts/by-name/desko/default.nix index 83cdc701..23bce3c5 100644 --- a/hosts/by-name/desko/default.nix +++ b/hosts/by-name/desko/default.nix @@ -7,6 +7,7 @@ sops.secrets.colin-passwd.neededForUsers = true; sane.roles.build-machine.enable = true; + sane.roles.ac = true; sane.roles.client = true; sane.roles.dev-machine = true; sane.services.wg-home.enable = true; diff --git a/hosts/by-name/lappy/default.nix b/hosts/by-name/lappy/default.nix index 2d3b088f..c68750b4 100644 --- a/hosts/by-name/lappy/default.nix +++ b/hosts/by-name/lappy/default.nix @@ -4,8 +4,6 @@ ./fs.nix ]; - sane.yggdrasil.enable = true; - sane.roles.client = true; sane.roles.dev-machine = true; sane.services.wg-home.enable = true; diff --git a/hosts/by-name/servo/default.nix b/hosts/by-name/servo/default.nix index 4c26c8e2..079430ff 100644 --- a/hosts/by-name/servo/default.nix +++ b/hosts/by-name/servo/default.nix @@ -14,6 +14,7 @@ signaldctl.enableFor.user.colin = true; }; + sane.roles.ac = true; sane.roles.build-machine.enable = true; sane.roles.build-machine.emulation = false; sane.zsh.showDeadlines = false; # ~/knowledge doesn't always exist diff --git a/hosts/common/default.nix b/hosts/common/default.nix index 57e0236b..23cb699a 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -6,7 +6,6 @@ ./fs.nix ./hardware.nix ./home - ./i2p.nix ./ids.nix ./machine-id.nix ./net.nix diff --git a/hosts/common/i2p.nix b/hosts/common/i2p.nix deleted file mode 100644 index 9f296934..00000000 --- a/hosts/common/i2p.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: -{ - services.i2p.enable = true; -} diff --git a/hosts/modules/roles/ac.nix b/hosts/modules/roles/ac.nix new file mode 100644 index 00000000..7d55bd23 --- /dev/null +++ b/hosts/modules/roles/ac.nix @@ -0,0 +1,16 @@ +{ config, lib, ... }: +{ + options.sane.roles.ac = with lib; mkOption { + type = types.bool; + default = false; + description = '' + services which you probably only want to use with AC power. + specifically because they drain resources like power or bandwidth. + ''; + }; + + config = lib.mkIf config.sane.roles.ac { + sane.yggdrasil.enable = true; + services.i2p.enable = true; + }; +} diff --git a/hosts/modules/roles/default.nix b/hosts/modules/roles/default.nix index b0c0b096..a668caeb 100644 --- a/hosts/modules/roles/default.nix +++ b/hosts/modules/roles/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./ac.nix ./build-machine.nix ./client ./dev-machine.nix