summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/backup/syncoid.nix2
-rw-r--r--nixos/modules/services/continuous-integration/woodpecker/server.nix8
-rw-r--r--nixos/modules/services/display-managers/greetd.nix1
-rw-r--r--nixos/modules/services/hardware/fwupd.nix13
-rw-r--r--nixos/modules/services/hardware/throttled.nix1
-rw-r--r--nixos/modules/services/matrix/appservice-discord.nix4
-rw-r--r--nixos/modules/services/matrix/matrix-sliding-sync.nix9
-rw-r--r--nixos/modules/services/matrix/mautrix-facebook.nix2
-rw-r--r--nixos/modules/services/matrix/mautrix-telegram.nix4
-rw-r--r--nixos/modules/services/matrix/mautrix-whatsapp.nix4
-rw-r--r--nixos/modules/services/matrix/mx-puppet-discord.nix4
-rw-r--r--nixos/modules/services/matrix/synapse.nix13
-rw-r--r--nixos/modules/services/monitoring/grafana-image-renderer.nix2
-rw-r--r--nixos/modules/services/networking/hostapd.nix30
-rw-r--r--nixos/modules/services/networking/prosody.nix3
-rw-r--r--nixos/modules/services/printing/cupsd.nix23
-rw-r--r--nixos/modules/services/web-apps/akkoma.nix6
-rw-r--r--nixos/modules/services/web-apps/freshrss.nix6
-rw-r--r--nixos/modules/services/web-apps/mobilizon.nix4
-rw-r--r--nixos/modules/services/x11/desktop-managers/plasma5.nix4
-rw-r--r--nixos/modules/services/x11/extra-layouts.nix42
21 files changed, 109 insertions, 76 deletions
diff --git a/nixos/modules/services/backup/syncoid.nix b/nixos/modules/services/backup/syncoid.nix
index 0f375455e7ed..1a1df38617b5 100644
--- a/nixos/modules/services/backup/syncoid.nix
+++ b/nixos/modules/services/backup/syncoid.nix
@@ -369,7 +369,7 @@ in
PrivateDevices = true;
PrivateMounts = true;
PrivateNetwork = mkDefault false;
- PrivateUsers = true;
+ PrivateUsers = false; # Enabling this breaks on zfs-2.2.0
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
diff --git a/nixos/modules/services/continuous-integration/woodpecker/server.nix b/nixos/modules/services/continuous-integration/woodpecker/server.nix
index cae5ed7cf116..38b42f7288c0 100644
--- a/nixos/modules/services/continuous-integration/woodpecker/server.nix
+++ b/nixos/modules/services/continuous-integration/woodpecker/server.nix
@@ -31,9 +31,9 @@ in
description = lib.mdDoc "woodpecker-server config environment variables, for other options read the [documentation](https://woodpecker-ci.org/docs/administration/server-config)";
};
environmentFile = lib.mkOption {
- type = lib.types.nullOr lib.types.path;
- default = null;
- example = "/root/woodpecker-server.env";
+ type = with lib.types; coercedTo path (f: [ f ]) (listOf path);
+ default = [ ];
+ example = [ "/root/woodpecker-server.env" ];
description = lib.mdDoc ''
File to load environment variables
from. This is helpful for specifying secrets.
@@ -61,7 +61,7 @@ in
StateDirectoryMode = "0700";
UMask = "0007";
ConfigurationDirectory = "woodpecker-server";
- EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile;
+ EnvironmentFile = cfg.environmentFile;
ExecStart = "${cfg.package}/bin/woodpecker-server";
Restart = "on-failure";
RestartSec = 15;
diff --git a/nixos/modules/services/display-managers/greetd.nix b/nixos/modules/services/display-managers/greetd.nix
index 3a0f59f62afb..89cb81f3a78f 100644
--- a/nixos/modules/services/display-managers/greetd.nix
+++ b/nixos/modules/services/display-managers/greetd.nix
@@ -59,6 +59,7 @@ in
security.pam.services.greetd = {
allowNullPassword = true;
startSession = true;
+ enableGnomeKeyring = mkDefault config.services.gnome.gnome-keyring.enable;
};
# This prevents nixos-rebuild from killing greetd by activating getty again
diff --git a/nixos/modules/services/hardware/fwupd.nix b/nixos/modules/services/hardware/fwupd.nix
index 4e5913fd2751..7a938459d0cb 100644
--- a/nixos/modules/services/hardware/fwupd.nix
+++ b/nixos/modules/services/hardware/fwupd.nix
@@ -181,7 +181,18 @@ in {
# required to update the firmware of disks
services.udisks2.enable = true;
- systemd.packages = [ cfg.package ];
+ systemd = {
+ packages = [ cfg.package ];
+
+ # fwupd-refresh expects a user that we do not create, so just run with DynamicUser
+ # instead and ensure we take ownership of /var/lib/fwupd
+ services.fwupd-refresh.serviceConfig = {
+ DynamicUser = true;
+ StateDirectory = "fwupd";
+ };
+
+ timers.fwupd-refresh.wantedBy = [ "timers.target" ];
+ };
security.polkit.enable = true;
};
diff --git a/nixos/modules/services/hardware/throttled.nix b/nixos/modules/services/hardware/throttled.nix
index 9fa495886119..0f1f00348ee8 100644
--- a/nixos/modules/services/hardware/throttled.nix
+++ b/nixos/modules/services/hardware/throttled.nix
@@ -27,6 +27,7 @@ in {
then pkgs.writeText "throttled.conf" cfg.extraConfig
else "${pkgs.throttled}/etc/throttled.conf";
+ hardware.cpu.x86.msr.enable = true;
# Kernel 5.9 spams warnings whenever userspace writes to CPU MSRs.
# See https://github.com/erpalma/throttled/issues/215
hardware.cpu.x86.msr.settings.allow-writes =
diff --git a/nixos/modules/services/matrix/appservice-discord.nix b/nixos/modules/services/matrix/appservice-discord.nix
index f579c2529c0a..6ce8718c35d8 100644
--- a/nixos/modules/services/matrix/appservice-discord.nix
+++ b/nixos/modules/services/matrix/appservice-discord.nix
@@ -100,9 +100,9 @@ in {
serviceDependencies = mkOption {
type = with types; listOf str;
- default = optional config.services.matrix-synapse.enable "matrix-synapse.service";
+ default = optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
defaultText = literalExpression ''
- optional config.services.matrix-synapse.enable "matrix-synapse.service"
+ optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit
'';
description = lib.mdDoc ''
List of Systemd services to require and wait for when starting the application service,
diff --git a/nixos/modules/services/matrix/matrix-sliding-sync.nix b/nixos/modules/services/matrix/matrix-sliding-sync.nix
index 7e464d6ed589..9807cde40919 100644
--- a/nixos/modules/services/matrix/matrix-sliding-sync.nix
+++ b/nixos/modules/services/matrix/matrix-sliding-sync.nix
@@ -80,8 +80,11 @@ in
} ];
};
- systemd.services.matrix-sliding-sync = {
- after = lib.optional cfg.createDatabase "postgresql.service";
+ systemd.services.matrix-sliding-sync = rec {
+ after =
+ lib.optional cfg.createDatabase "postgresql.service"
+ ++ lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
+ wants = after;
wantedBy = [ "multi-user.target" ];
environment = cfg.settings;
serviceConfig = {
@@ -90,6 +93,8 @@ in
ExecStart = lib.getExe cfg.package;
StateDirectory = "matrix-sliding-sync";
WorkingDirectory = "%S/matrix-sliding-sync";
+ Restart = "on-failure";
+ RestartSec = "1s";
};
};
};
diff --git a/nixos/modules/services/matrix/mautrix-facebook.nix b/nixos/modules/services/matrix/mautrix-facebook.nix
index bab6865496dd..671040500df8 100644
--- a/nixos/modules/services/matrix/mautrix-facebook.nix
+++ b/nixos/modules/services/matrix/mautrix-facebook.nix
@@ -145,7 +145,7 @@ in {
wantedBy = [ "multi-user.target" ];
wants = [
"network-online.target"
- ] ++ optional config.services.matrix-synapse.enable "matrix-synapse.service"
+ ] ++ optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit
++ optional cfg.configurePostgresql "postgresql.service";
after = wants;
diff --git a/nixos/modules/services/matrix/mautrix-telegram.nix b/nixos/modules/services/matrix/mautrix-telegram.nix
index 97a6ba858e00..168c8bf436ac 100644
--- a/nixos/modules/services/matrix/mautrix-telegram.nix
+++ b/nixos/modules/services/matrix/mautrix-telegram.nix
@@ -122,9 +122,9 @@ in {
serviceDependencies = mkOption {
type = with types; listOf str;
- default = optional config.services.matrix-synapse.enable "matrix-synapse.service";
+ default = optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
defaultText = literalExpression ''
- optional config.services.matrix-synapse.enable "matrix-synapse.service"
+ optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit
'';
description = lib.mdDoc ''
List of Systemd services to require and wait for when starting the application service.
diff --git a/nixos/modules/services/matrix/mautrix-whatsapp.nix b/nixos/modules/services/matrix/mautrix-whatsapp.nix
index c4dc48213495..4b561a4b07a3 100644
--- a/nixos/modules/services/matrix/mautrix-whatsapp.nix
+++ b/nixos/modules/services/matrix/mautrix-whatsapp.nix
@@ -100,9 +100,9 @@ in {
serviceDependencies = lib.mkOption {
type = with lib.types; listOf str;
- default = lib.optional config.services.matrix-synapse.enable "matrix-synapse.service";
+ default = lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
defaultText = lib.literalExpression ''
- optional config.services.matrix-synapse.enable "matrix-synapse.service"
+ optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnits
'';
description = lib.mdDoc ''
List of Systemd services to require and wait for when starting the application service.
diff --git a/nixos/modules/services/matrix/mx-puppet-discord.nix b/nixos/modules/services/matrix/mx-puppet-discord.nix
index 36c9f8b122ea..70828804b556 100644
--- a/nixos/modules/services/matrix/mx-puppet-discord.nix
+++ b/nixos/modules/services/matrix/mx-puppet-discord.nix
@@ -66,9 +66,9 @@ in {
};
serviceDependencies = mkOption {
type = with types; listOf str;
- default = optional config.services.matrix-synapse.enable "matrix-synapse.service";
+ default = optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
defaultText = literalExpression ''
- optional config.services.matrix-synapse.enable "matrix-synapse.service"
+ optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit
'';
description = lib.mdDoc ''
List of Systemd services to require and wait for when starting the application service.
diff --git a/nixos/modules/services/matrix/synapse.nix b/nixos/modules/services/matrix/synapse.nix
index 12e27ef26ff3..9cc769c2d0db 100644
--- a/nixos/modules/services/matrix/synapse.nix
+++ b/nixos/modules/services/matrix/synapse.nix
@@ -296,6 +296,18 @@ in {
services.matrix-synapse = {
enable = mkEnableOption (lib.mdDoc "matrix.org synapse");
+ serviceUnit = lib.mkOption {
+ type = lib.types.str;
+ readOnly = true;
+ description = lib.mdDoc ''
+ The systemd unit (a service or a target) for other services to depend on if they
+ need to be started after matrix-synapse.
+
+ This option is useful as the actual parent unit for all matrix-synapse processes
+ changes when configuring workers.
+ '';
+ };
+
configFile = mkOption {
type = types.path;
readOnly = true;
@@ -1021,6 +1033,7 @@ in {
port = 9093;
});
+ services.matrix-synapse.serviceUnit = if hasWorkers then "matrix-synapse.target" else "matrix-synapse.service";
services.matrix-synapse.configFile = configFile;
services.matrix-synapse.package = wrapped;
diff --git a/nixos/modules/services/monitoring/grafana-image-renderer.nix b/nixos/modules/services/monitoring/grafana-image-renderer.nix
index 36258866646a..afe9eb4d7b95 100644
--- a/nixos/modules/services/monitoring/grafana-image-renderer.nix
+++ b/nixos/modules/services/monitoring/grafana-image-renderer.nix
@@ -108,7 +108,7 @@ in {
services.grafana.settings.rendering = mkIf cfg.provisionGrafana {
server_url = "http://localhost:${toString cfg.settings.service.port}/render";
- callback_url = "http://localhost:${toString config.services.grafana.settings.server.http_port}";
+ callback_url = "http://${config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}";
};
services.grafana-image-renderer.chromium = mkDefault pkgs.chromium;
diff --git a/nixos/modules/services/networking/hostapd.nix b/nixos/modules/services/networking/hostapd.nix
index ffb154463053..5bd8e1d4d7a0 100644
--- a/nixos/modules/services/networking/hostapd.nix
+++ b/nixos/modules/services/networking/hostapd.nix
@@ -899,25 +899,6 @@ in {
'';
};
};
-
- managementFrameProtection = mkOption {
- default = "required";
- type = types.enum ["disabled" "optional" "required"];
- apply = x:
- getAttr x {
- "disabled" = 0;
- "optional" = 1;
- "required" = 2;
- };
- description = mdDoc ''
- Management frame protection (MFP) authenticates management frames
- to prevent deauthentication (or related) attacks.
-
- - {var}`"disabled"`: No management frame protection
- - {var}`"optional"`: Use MFP if a connection allows it
- - {var}`"required"`: Force MFP for all clients
- '';
- };
};
config = let
@@ -943,7 +924,8 @@ in {
# IEEE 802.11i (authentication) related configuration
# Encrypt management frames to protect against deauthentication and similar attacks
- ieee80211w = bssCfg.managementFrameProtection;
+ ieee80211w = mkDefault 1;
+ sae_require_mfp = mkDefault 1;
# Only allow WPA by default and disable insecure WEP
auth_algs = mkDefault 1;
@@ -1185,14 +1167,6 @@ in {
message = ''hostapd radio ${radio} bss ${bss}: bssid must be specified manually (for now) since this radio uses multiple BSS.'';
}
{
- assertion = auth.mode == "wpa3-sae" -> bssCfg.managementFrameProtection == 2;
- message = ''hostapd radio ${radio} bss ${bss}: uses WPA3-SAE which requires managementFrameProtection="required"'';
- }
- {
- assertion = auth.mode == "wpa3-sae-transition" -> bssCfg.managementFrameProtection != 0;
- message = ''hostapd radio ${radio} bss ${bss}: uses WPA3-SAE in transition mode with WPA2-SHA256, which requires managementFrameProtection="optional" or ="required"'';
- }
- {
assertion = countWpaPasswordDefinitions <= 1;
message = ''hostapd radio ${radio} bss ${bss}: must use at most one WPA password option (wpaPassword, wpaPasswordFile, wpaPskFile)'';
}
diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix
index 0066c77438f4..038d574bd878 100644
--- a/nixos/modules/services/networking/prosody.nix
+++ b/nixos/modules/services/networking/prosody.nix
@@ -779,9 +779,6 @@ in
admins = ${toLua cfg.admins}
- -- we already build with libevent, so we can just enable it for a more performant server
- use_libevent = true
-
modules_enabled = {
${ lib.concatStringsSep "\n " (lib.mapAttrsToList
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index 279b26bb8957..25367f8e61d4 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -108,6 +108,13 @@ let
containsGutenprint = pkgs: length (filterGutenprint pkgs) > 0;
getGutenprint = pkgs: head (filterGutenprint pkgs);
+ parsePorts = addresses: let
+ splitAddress = addr: lib.strings.splitString ":" addr;
+ extractPort = addr: builtins.elemAt (builtins.tail (splitAddress addr)) 0;
+ toInt = str: lib.strings.toInt str;
+ in
+ builtins.map (address: toInt (extractPort address)) addresses;
+
in
{
@@ -172,6 +179,15 @@ in
'';
};
+ openFirewall = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to open the firewall for TCP/UDP ports specified in
+ listenAdrresses option.
+ '';
+ };
+
bindirCmds = mkOption {
type = types.lines;
internal = true;
@@ -463,6 +479,13 @@ in
security.pam.services.cups = {};
+ networking.firewall = let
+ listenPorts = parsePorts cfg.listenAddresses;
+ in mkIf cfg.openFirewall {
+ allowedTCPPorts = listenPorts;
+ allowedUDPPorts = listenPorts;
+ };
+
};
meta.maintainers = with lib.maintainers; [ matthewbauer ];
diff --git a/nixos/modules/services/web-apps/akkoma.nix b/nixos/modules/services/web-apps/akkoma.nix
index eaee70c712bb..5f9bbbd66374 100644
--- a/nixos/modules/services/web-apps/akkoma.nix
+++ b/nixos/modules/services/web-apps/akkoma.nix
@@ -86,7 +86,7 @@ let
# Erlang/Elixir uses a somewhat special format for IP addresses
erlAddr = addr: fileContents
(pkgs.runCommand addr {
- nativeBuildInputs = with pkgs; [ elixir ];
+ nativeBuildInputs = [ cfg.package.elixirPackage ];
code = ''
case :inet.parse_address('${addr}') do
{:ok, addr} -> IO.inspect addr
@@ -96,7 +96,7 @@ let
passAsFile = [ "code" ];
} ''elixir "$codePath" >"$out"'');
- format = pkgs.formats.elixirConf { };
+ format = pkgs.formats.elixirConf { elixir = cfg.package.elixirPackage; };
configFile = format.generate "config.exs"
(replaceSec
(attrsets.updateManyAttrsByPath [{
@@ -146,7 +146,7 @@ let
initSecretsScript = writeShell {
name = "akkoma-init-secrets";
- runtimeInputs = with pkgs; [ coreutils elixir ];
+ runtimeInputs = with pkgs; [ coreutils cfg.package.elixirPackage ];
text = let
key-base = web.secret_key_base;
jwt-signer = ex.":joken".":default_signer";
diff --git a/nixos/modules/services/web-apps/freshrss.nix b/nixos/modules/services/web-apps/freshrss.nix
index ffc05d0e41f8..8b4ea2aa53c9 100644
--- a/nixos/modules/services/web-apps/freshrss.nix
+++ b/nixos/modules/services/web-apps/freshrss.nix
@@ -220,7 +220,7 @@ in
"catch_workers_output" = true;
};
phpEnv = {
- FRESHRSS_DATA_PATH = "${cfg.dataDir}";
+ DATA_PATH = "${cfg.dataDir}";
};
};
};
@@ -267,7 +267,7 @@ in
WorkingDirectory = cfg.package;
};
environment = {
- FRESHRSS_DATA_PATH = cfg.dataDir;
+ DATA_PATH = cfg.dataDir;
};
script =
@@ -302,7 +302,7 @@ in
wantedBy = [ "multi-user.target" ];
startAt = "*:0/5";
environment = {
- FRESHRSS_DATA_PATH = cfg.dataDir;
+ DATA_PATH = cfg.dataDir;
};
serviceConfig = defaultServiceConfig //{
ExecStart = "${cfg.package}/app/actualize_script.php";
diff --git a/nixos/modules/services/web-apps/mobilizon.nix b/nixos/modules/services/web-apps/mobilizon.nix
index e9264a38f0e6..343c5cead2b1 100644
--- a/nixos/modules/services/web-apps/mobilizon.nix
+++ b/nixos/modules/services/web-apps/mobilizon.nix
@@ -8,7 +8,7 @@ let
user = "mobilizon";
group = "mobilizon";
- settingsFormat = pkgs.formats.elixirConf { elixir = pkgs.elixir_1_14; };
+ settingsFormat = pkgs.formats.elixirConf { elixir = cfg.package.elixirPackage; };
configFile = settingsFormat.generate "mobilizon-config.exs" cfg.settings;
@@ -309,7 +309,7 @@ in
genCookie = "IO.puts(Base.encode32(:crypto.strong_rand_bytes(32)))";
evalElixir = str: ''
- ${pkgs.elixir_1_14}/bin/elixir --eval '${str}'
+ ${cfg.package.elixirPackage}/bin/elixir --eval '${str}'
'';
in
''
diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix
index fc3287045710..361dbe879a18 100644
--- a/nixos/modules/services/x11/desktop-managers/plasma5.nix
+++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -29,7 +29,7 @@ let
libsForQt5 = pkgs.plasma5Packages;
inherit (libsForQt5) kdeGear kdeFrameworks plasma5;
inherit (lib)
- getBin optionalString literalExpression
+ getBin optionalAttrs optionalString literalExpression
mkRemovedOptionModule mkRenamedOptionModule
mkDefault mkIf mkMerge mkOption mkPackageOptionMD types;
@@ -178,7 +178,7 @@ in
capabilities = "cap_sys_nice+ep";
source = "${getBin plasma5.kwin}/bin/kwin_wayland";
};
- } // mkIf (!cfg.runUsingSystemd) {
+ } // optionalAttrs (!cfg.runUsingSystemd) {
start_kdeinit = {
setuid = true;
owner = "root";
diff --git a/nixos/modules/services/x11/extra-layouts.nix b/nixos/modules/services/x11/extra-layouts.nix
index 3941f50b7550..ab7e39739eeb 100644
--- a/nixos/modules/services/x11/extra-layouts.nix
+++ b/nixos/modules/services/x11/extra-layouts.nix
@@ -3,7 +3,7 @@
with lib;
let
- layouts = config.services.xserver.extraLayouts;
+ layouts = config.services.xserver.xkb.extraLayouts;
layoutOpts = {
options = {
@@ -15,10 +15,10 @@ let
languages = mkOption {
type = types.listOf types.str;
description =
- lib.mdDoc ''
- A list of languages provided by the layout.
- (Use ISO 639-2 codes, for example: "eng" for english)
- '';
+ lib.mdDoc ''
+ A list of languages provided by the layout.
+ (Use ISO 639-2 codes, for example: "eng" for english)
+ '';
};
compatFile = mkOption {
@@ -80,29 +80,37 @@ let
};
xkb_patched = pkgs.xorg.xkeyboardconfig_custom {
- layouts = config.services.xserver.extraLayouts;
+ layouts = config.services.xserver.xkb.extraLayouts;
};
in
{
+ imports = [
+ (lib.mkRenamedOptionModuleWith {
+ sinceRelease = 2311;
+ from = [ "services" "xserver" "extraLayouts" ];
+ to = [ "services" "xserver" "xkb" "extraLayouts" ];
+ })
+ ];
+
###### interface
- options.services.xserver = {
+ options.services.xserver.xkb = {
extraLayouts = mkOption {
type = types.attrsOf (types.submodule layoutOpts);
- default = {};
+ default = { };
example = literalExpression
- ''
- {
- mine = {
- description = "My custom xkb layout.";
- languages = [ "eng" ];
- symbolsFile = /path/to/my/layout;
- };
- }
- '';
+ ''
+ {
+ mine = {
+ description = "My custom xkb layout.";
+ languages = [ "eng" ];
+ symbolsFile = /path/to/my/layout;
+ };
+ }
+ '';
description = lib.mdDoc ''
Extra custom layouts that will be included in the xkb configuration.
Information on how to create a new layout can be found here: