From f53a27baee853cf609260fae753df3d273b75fb6 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 --- fediversity/default.nix | 13 +++++++++++++ fediversity/mastodon.nix | 4 ++++ vm/mastodon-vm.nix | 6 ++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/fediversity/default.nix b/fediversity/default.nix index 379b1b2..5ff0883 100644 --- a/fediversity/default.nix +++ b/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/fediversity/mastodon.nix b/fediversity/mastodon.nix index d19edca..14568a7 100644 --- a/fediversity/mastodon.nix +++ b/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/vm/mastodon-vm.nix b/vm/mastodon-vm.nix index b9d28b1..ecf880c 100644 --- a/vm/mastodon-vm.nix +++ b/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 {