0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

Merge master into staging-next

This commit is contained in:
github-actions[bot] 2024-05-03 12:01:32 +00:00 committed by GitHub
commit ae736c738d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
431 changed files with 1696 additions and 3266 deletions

View file

@ -380,6 +380,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
- `halloy` package was updated past 2024.5 which introduced a breaking change by switching the config format from YAML to TOML. See https://github.com/squidowl/halloy/releases/tag/2024.5 for details.
- The `wpaperd` package has a breaking change moving to 1.0.1, previous version 0.3.0 had 2 different configuration files, one for wpaperd and one for the wallpapers. Remove the former and move the latter (`wallpaper.toml`) to `config.toml`.
- Ada packages (libraries and tools) have been moved into the `gnatPackages` scope. `gnatPackages` uses the default GNAT compiler, `gnat12Packages` and `gnat13Packages` use the respective matching compiler version.
- Paths provided as `restartTriggers` and `reloadTriggers` for systemd units will now be copied into the nix store to make the behavior consistent.

View file

@ -4,41 +4,6 @@ with lib;
let
cfg = config.services.ebusd;
package = pkgs.ebusd;
arguments = [
"${package}/bin/ebusd"
"--foreground"
"--updatecheck=off"
"--device=${cfg.device}"
"--port=${toString cfg.port}"
"--configpath=${cfg.configpath}"
"--scanconfig=${cfg.scanconfig}"
"--log=all:${cfg.logs.all}"
"--log=main:${cfg.logs.main}"
"--log=network:${cfg.logs.network}"
"--log=bus:${cfg.logs.bus}"
"--log=update:${cfg.logs.update}"
"--log=other:${cfg.logs.other}"
] ++ lib.optionals cfg.readonly [
"--readonly"
] ++ lib.optionals cfg.mqtt.enable [
"--mqtthost=${cfg.mqtt.host}"
"--mqttport=${toString cfg.mqtt.port}"
"--mqttuser=${cfg.mqtt.user}"
"--mqttpass=${cfg.mqtt.password}"
] ++ lib.optionals cfg.mqtt.home-assistant [
"--mqttint=${package}/etc/ebusd/mqtt-hassio.cfg"
"--mqttjson"
] ++ lib.optionals cfg.mqtt.retain [
"--mqttretain"
] ++ cfg.extraArguments;
usesDev = hasPrefix "/" cfg.device;
command = concatStringsSep " " arguments;
in
{
meta.maintainers = with maintainers; [ nathan-gs ];
@ -46,6 +11,8 @@ in
options.services.ebusd = {
enable = mkEnableOption "ebusd, a daemon for communication with eBUS heating systems";
package = mkPackageOptionMD pkgs "ebusd" { };
device = mkOption {
type = types.str;
default = "";
@ -57,7 +24,8 @@ in
ens:DEVICE for enhanced high speed serial device (only adapter v3 and newer with firmware since 20220731),
DEVICE for serial device (normal speed, for all other serial adapters like adapter v2 as well as adapter v3 in non-enhanced mode), or
[udp:]IP:PORT for network device.
https://github.com/john30/ebusd/wiki/2.-Run#device-options
Source: <https://github.com/john30/ebusd/wiki/2.-Run#device-options>
'';
};
@ -81,7 +49,7 @@ in
type = types.str;
default = "https://cfg.ebusd.eu/";
description = ''
Read CSV config files from PATH (local folder or HTTPS URL) [https://cfg.ebusd.eu/]
Directory to read CSV config files from. This can be a local folder or a URL.
'';
};
@ -95,65 +63,21 @@ in
'';
};
logs = {
main = mkOption {
type = types.enum [ "none" "error" "notice" "info" "debug"];
default = "info";
description = ''
Only write log for matching AREAs (main|network|bus|update|other|all) below or equal to LEVEL (none|error|notice|info|debug) [all:notice].
'';
};
network = mkOption {
type = types.enum [ "none" "error" "notice" "info" "debug"];
default = "info";
description = ''
Only write log for matching AREAs (main|network|bus|update|other|all) below or equal to LEVEL (none|error|notice|info|debug) [all:notice].
'';
};
bus = mkOption {
type = types.enum [ "none" "error" "notice" "info" "debug"];
default = "info";
description = ''
Only write log for matching AREAs (main|network|bus|update|other|all) below or equal to LEVEL (none|error|notice|info|debug) [all:notice].
'';
};
update = mkOption {
type = types.enum [ "none" "error" "notice" "info" "debug"];
default = "info";
description = ''
Only write log for matching AREAs (main|network|bus|update|other|all) below or equal to LEVEL (none|error|notice|info|debug) [all:notice].
'';
};
other = mkOption {
type = types.enum [ "none" "error" "notice" "info" "debug"];
default = "info";
description = ''
Only write log for matching AREAs (main|network|bus|update|other|all) below or equal to LEVEL (none|error|notice|info|debug) [all:notice].
'';
};
all = mkOption {
type = types.enum [ "none" "error" "notice" "info" "debug"];
default = "info";
description = ''
Only write log for matching AREAs (main|network|bus|update|other|all) below or equal to LEVEL (none|error|notice|info|debug) [all:notice].
'';
};
};
logs = let
# "all" must come first so it can be overridden by more specific areas
areas = [ "all" "main" "network" "bus" "update" "other" ];
levels = [ "none" "error" "notice" "info" "debug" ];
in listToAttrs (map (area: nameValuePair area (mkOption {
type = types.enum levels;
default = "notice";
example = "debug";
description = ''
Only write log for matching `AREA`s (${concatStringsSep "|" areas}) below or equal to `LEVEL` (${concatStringsSep "|" levels})
'';
})) areas);
mqtt = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Adds support for MQTT
'';
};
enable = mkEnableOption "support for MQTT";
host = mkOption {
type = types.str;
@ -179,13 +103,7 @@ in
'';
};
retain = mkOption {
type = types.bool;
default = false;
description = ''
Set the retain flag on all topics instead of only selected global ones
'';
};
retain = mkEnableOption "set the retain flag on all topics instead of only selected global ones";
user = mkOption {
type = types.str;
@ -200,7 +118,6 @@ in
The MQTT password.
'';
};
};
extraArguments = mkOption {
@ -210,25 +127,44 @@ in
Extra arguments to the ebus daemon
'';
};
};
config = mkIf (cfg.enable) {
config = let
usesDev = hasPrefix "/" cfg.device;
in mkIf cfg.enable {
systemd.services.ebusd = {
description = "EBUSd Service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = command;
ExecStart = let
args = cli.toGNUCommandLineShell { } (foldr (a: b: a // b) { } [
{
inherit (cfg) device port configpath scanconfig readonly;
foreground = true;
updatecheck = "off";
log = mapAttrsToList (name: value: "${name}:${value}") cfg.logs;
mqttretain = cfg.mqtt.retain;
}
(optionalAttrs cfg.mqtt.enable {
mqtthost = cfg.mqtt.host;
mqttport = cfg.mqtt.port;
mqttuser = cfg.mqtt.user;
mqttpass = cfg.mqtt.password;
})
(optionalAttrs cfg.mqtt.home-assistant {
mqttint = "${cfg.package}/etc/ebusd/mqtt-hassio.cfg";
mqttjson = true;
})
]);
in "${cfg.package}/bin/ebusd ${args} ${escapeShellArgs cfg.extraArguments}";
DynamicUser = true;
Restart = "on-failure";
# Hardening
CapabilityBoundingSet = "";
DeviceAllow = lib.optionals usesDev [
cfg.device
] ;
DeviceAllow = optionals usesDev [ cfg.device ];
DevicePolicy = "closed";
LockPersonality = true;
MemoryDenyWriteExecute = false;
@ -254,9 +190,7 @@ in
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
SupplementaryGroups = [
"dialout"
];
SupplementaryGroups = [ "dialout" ];
SystemCallArchitectures = "native";
SystemCallFilter = [
"@system-service @pkey"
@ -265,6 +199,5 @@ in
UMask = "0077";
};
};
};
}

View file

@ -41,6 +41,10 @@ in {
wantedBy = [ "multi-user.target" ];
stopIfChanged = false;
preStart = ''
${lib.getExe pkgs.promtail} -config.file=${prettyJSON cfg.configuration} -check-syntax
'';
serviceConfig = {
Restart = "on-failure";
TimeoutStopSec = 10;

View file

@ -9,7 +9,7 @@ let
configFile = format.generate "conduit.toml" cfg.settings;
in
{
meta.maintainers = with maintainers; [ pstn piegames ];
meta.maintainers = with maintainers; [ pstn ];
options.services.matrix-conduit = {
enable = mkEnableOption "matrix-conduit";

View file

@ -210,5 +210,5 @@ in
};
};
meta.maintainers = [ lib.maintainers.piegames ];
meta.maintainers = [ ];
}