From 95e572bce0ad1b431adc305b8b41b1fc56b459e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Mon, 11 Nov 2024 16:16:27 +0100 Subject: [PATCH] Number of cores also when on metal --- services/fediversity/default.nix | 13 +++++++++++++ services/fediversity/mastodon.nix | 4 ++++ services/vm/mastodon-vm.nix | 6 ++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/services/fediversity/default.nix b/services/fediversity/default.nix index 379b1b2c..5ff08836 100644 --- a/services/fediversity/default.nix +++ b/services/fediversity/default.nix @@ -31,6 +31,19 @@ in { pixelfed.enable = mkEnableOption "default Fediversity Pixelfed configuration"; peertube.enable = mkEnableOption "default Fediversity PeerTube configuration"; + temp = mkOption { + description = "options that are only used while developing; should be removed eventually"; + default = {}; + type = types.submodule { + options = { + cores = mkOption { + description = "number of cores; should be obtained from NixOps4"; + type = types.int; + }; + }; + }; + }; + internal = mkOption { description = "options that are only meant to be used internally; change at your own risk"; default = {}; diff --git a/services/fediversity/mastodon.nix b/services/fediversity/mastodon.nix index d19edca0..14568a7e 100644 --- a/services/fediversity/mastodon.nix +++ b/services/fediversity/mastodon.nix @@ -66,6 +66,10 @@ lib.mkIf (config.fediversity.enable && config.fediversity.mastodon.enable) { localDomain = config.fediversity.internal.mastodon.domain; configureNginx = true; + # from the documentation: recommended is the amount of your CPU cores minus + # one. but it also must be a positive integer + streamingProcesses = lib.max 1 (config.fediversity.temp.cores - 1); + # TODO: configure a mailserver so this works smtp = { fromAddress = "noreply@${config.fediversity.internal.mastodon.domain}"; diff --git a/services/vm/mastodon-vm.nix b/services/vm/mastodon-vm.nix index b9d28b15..ecf880c8 100644 --- a/services/vm/mastodon-vm.nix +++ b/services/vm/mastodon-vm.nix @@ -8,16 +8,14 @@ enable = true; domain = "localhost"; mastodon.enable = true; + + temp.cores = config.virtualisation.cores; }; services.mastodon = { extraConfig = { EMAIL_DOMAIN_ALLOWLIST = "example.com"; }; - - # from the documentation: recommended is the amount of your CPU cores - # minus one. but it also must be a positive integer - streamingProcesses = lib.max 1 (config.virtualisation.cores - 1); }; security.acme = lib.mkVMOverride {