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-09-05 00:13:11 +00:00 committed by GitHub
commit 74cdd9c9b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
139 changed files with 2148 additions and 14562 deletions

View file

@ -32,9 +32,6 @@ with lib;
# there is no power management backend such as upower).
powerManagement.enable = true;
# Enable sound in graphical iso's.
hardware.pulseaudio.enable = true;
# VM guest additions to improve host-guest interaction
services.spice-vdagentd.enable = true;
services.qemuGuest.enable = true;

View file

@ -44,6 +44,49 @@ let
};
initrdRelease = pkgs.writeText "initrd-release" (attrsToText initrdReleaseContents);
checkRelease = version:
let
parts = lib.versions.splitVersion version;
isVersion = lib.length parts == 2 && lib.all (p: lib.stringLength p == 2) parts;
majorVersion = lib.toIntBase10 (lib.elemAt parts 0);
minorVersion = lib.elemAt parts 1;
versionPatterns = [
# only 13.10
{ fromMajor = 13; minor = [ "10" ]; }
# 14.04 and 14.12
{ fromMajor = 14; minor = [ "04" "12" ]; }
# only 15.09
{ fromMajor = 15; minor = [ "09" ]; }
# 16.03 to 20.09
{ fromMajor = 16; minor = [ "03" "09" ]; }
# from 21.05
{ fromMajor = 21; minor = [ "05" "11" ]; }
];
# find the versioning pattern that applies by looking for the first
# major version newer than `majorVersion`, and picking the previous pattern
patternIndex = lib.lists.findFirstIndex
({ fromMajor, ... }: fromMajor > majorVersion)
(lib.length versionPatterns)
versionPatterns;
validMinorVersions =
if patternIndex == 0
then []
else (lib.elemAt versionPatterns (patternIndex - 1)).minor;
correctMinorVersion = lib.elem minorVersion validMinorVersions;
notNewerThanNixpkgs = lib.versionAtLeast trivial.release version;
in isVersion && correctMinorVersion && notNewerThanNixpkgs;
releaseType = types.addCheck
(types.strMatching "[[:digit:]]{2}\\.[[:digit:]]{2}")
checkRelease // {
name = "nixosRelease";
description = "NixOS release version, e.g. \"${trivial.release}\"";
descriptionClass = "nonRestrictiveClause";
};
in
{
imports = [
@ -70,7 +113,7 @@ in
release = mkOption {
readOnly = true;
type = types.str;
type = releaseType;
default = trivial.release;
description = "The NixOS release (e.g. `16.03`).";
};
@ -151,7 +194,7 @@ in
};
stateVersion = mkOption {
type = types.str;
type = releaseType;
# TODO Remove this and drop the default of the option so people are forced to set it.
# Doing this also means fixing the comment in nixos/modules/testing/test-instrumentation.nix
apply = v:

View file

@ -14,8 +14,5 @@
libinput.enable = true; # for touchpad support on many laptops
};
# Enable sound in virtualbox appliances.
hardware.pulseaudio.enable = true;
environment.systemPackages = [ pkgs.mesa-demos pkgs.firefox ];
}

View file

@ -196,8 +196,9 @@ in {
programs.gamescope.enable = lib.mkDefault cfg.gamescopeSession.enable;
services.displayManager.sessionPackages = lib.mkIf cfg.gamescopeSession.enable [ gamescopeSessionFile ];
# optionally enable 32bit pulseaudio support if pulseaudio is enabled
# enable 32bit pulseaudio/pipewire support if needed
hardware.pulseaudio.support32Bit = config.hardware.pulseaudio.enable;
services.pipewire.alsa.support32Bit = config.services.pipewire.alsa.enable;
hardware.steam-hardware.enable = true;

View file

@ -50,7 +50,6 @@ in {
};
};
hardware.pulseaudio.enable = lib.mkDefault true;
networking.networkmanager.enable = lib.mkDefault true;
systemd.packages = with pkgs.lomiri; [

View file

@ -55,6 +55,12 @@ in
services.speechd.enable = lib.mkDefault true;
services.pipewire = {
enable = lib.mkDefault true;
pulse.enable = lib.mkDefault true;
alsa.enable = lib.mkDefault true;
};
systemd.defaultUnit = lib.mkIf (xcfg.autorun || dmcfg.enable) "graphical.target";
xdg = {

View file

@ -1,11 +1,8 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.unpoller;
configFile = pkgs.writeText "unpoller.json" (generators.toJSON {} {
configFile = pkgs.writeText "unpoller.json" (lib.generators.toJSON {} {
inherit (cfg) poller influxdb loki prometheus unifi;
});
@ -15,26 +12,26 @@ in {
];
options.services.unpoller = {
enable = mkEnableOption "unpoller";
enable = lib.mkEnableOption "unpoller";
poller = {
debug = mkOption {
type = types.bool;
debug = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Turns on line numbers, microsecond logging, and a per-device log.
This may be noisy if you have a lot of devices. It adds one line per device.
'';
};
quiet = mkOption {
type = types.bool;
quiet = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Turns off per-interval logs. Only startup and error logs will be emitted.
'';
};
plugins = mkOption {
type = with types; listOf str;
plugins = lib.mkOption {
type = with lib.types; listOf str;
default = [];
description = ''
Load additional plugins.
@ -43,22 +40,22 @@ in {
};
prometheus = {
disable = mkOption {
type = types.bool;
disable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to disable the prometheus output plugin.
'';
};
http_listen = mkOption {
type = types.str;
http_listen = lib.mkOption {
type = lib.types.str;
default = "[::]:9130";
description = ''
Bind the prometheus exporter to this IP or hostname.
'';
};
report_errors = mkOption {
type = types.bool;
report_errors = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to report errors.
@ -67,53 +64,53 @@ in {
};
influxdb = {
disable = mkOption {
type = types.bool;
disable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to disable the influxdb output plugin.
'';
};
url = mkOption {
type = types.str;
url = lib.mkOption {
type = lib.types.str;
default = "http://127.0.0.1:8086";
description = ''
URL of the influxdb host.
'';
};
user = mkOption {
type = types.str;
user = lib.mkOption {
type = lib.types.str;
default = "unifipoller";
description = ''
Username for the influxdb.
'';
};
pass = mkOption {
type = types.path;
pass = lib.mkOption {
type = lib.types.path;
default = pkgs.writeText "unpoller-influxdb-default.password" "unifipoller";
defaultText = literalExpression "unpoller-influxdb-default.password";
defaultText = lib.literalExpression "unpoller-influxdb-default.password";
description = ''
Path of a file containing the password for influxdb.
This file needs to be readable by the unifi-poller user.
'';
apply = v: "file://${v}";
};
db = mkOption {
type = types.str;
db = lib.mkOption {
type = lib.types.str;
default = "unifi";
description = ''
Database name. Database should exist.
'';
};
verify_ssl = mkOption {
type = types.bool;
verify_ssl = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Verify the influxdb's certificate.
'';
};
interval = mkOption {
type = types.str;
interval = lib.mkOption {
type = lib.types.str;
default = "30s";
description = ''
Setting this lower than the Unifi controller's refresh
@ -123,22 +120,22 @@ in {
};
loki = {
url = mkOption {
type = types.str;
url = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
URL of the Loki host.
'';
};
user = mkOption {
type = types.str;
user = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
Username for Loki.
'';
};
pass = mkOption {
type = types.path;
pass = lib.mkOption {
type = lib.types.path;
default = pkgs.writeText "unpoller-loki-default.password" "";
defaultText = "unpoller-influxdb-default.password";
description = ''
@ -147,29 +144,29 @@ in {
'';
apply = v: "file://${v}";
};
verify_ssl = mkOption {
type = types.bool;
verify_ssl = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Verify Loki's certificate.
'';
};
tenant_id = mkOption {
type = types.str;
tenant_id = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
Tenant ID to use in Loki.
'';
};
interval = mkOption {
type = types.str;
interval = lib.mkOption {
type = lib.types.str;
default = "2m";
description = ''
How often the events are polled and pushed to Loki.
'';
};
timeout = mkOption {
type = types.str;
timeout = lib.mkOption {
type = lib.types.str;
default = "10s";
description = ''
Should be increased in case of timeout errors.
@ -179,92 +176,92 @@ in {
unifi = let
controllerOptions = {
user = mkOption {
type = types.str;
user = lib.mkOption {
type = lib.types.str;
default = "unifi";
description = ''
Unifi service user name.
'';
};
pass = mkOption {
type = types.path;
pass = lib.mkOption {
type = lib.types.path;
default = pkgs.writeText "unpoller-unifi-default.password" "unifi";
defaultText = literalExpression "unpoller-unifi-default.password";
defaultText = lib.literalExpression "unpoller-unifi-default.password";
description = ''
Path of a file containing the password for the unifi service user.
This file needs to be readable by the unifi-poller user.
'';
apply = v: "file://${v}";
};
url = mkOption {
type = types.str;
url = lib.mkOption {
type = lib.types.str;
default = "https://unifi:8443";
description = ''
URL of the Unifi controller.
'';
};
sites = mkOption {
type = with types; either (enum [ "default" "all" ]) (listOf str);
sites = lib.mkOption {
type = with lib.types; either (enum [ "default" "all" ]) (listOf str);
default = "all";
description = ''
List of site names for which statistics should be exported.
Or the string "default" for the default site or the string "all" for all sites.
'';
apply = toList;
apply = lib.toList;
};
save_ids = mkOption {
type = types.bool;
save_ids = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Collect and save data from the intrusion detection system to influxdb and Loki.
'';
};
save_events = mkOption {
type = types.bool;
save_events = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Collect and save data from UniFi events to influxdb and Loki.
'';
};
save_alarms = mkOption {
type = types.bool;
save_alarms = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Collect and save data from UniFi alarms to influxdb and Loki.
'';
};
save_anomalies = mkOption {
type = types.bool;
save_anomalies = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Collect and save data from UniFi anomalies to influxdb and Loki.
'';
};
save_dpi = mkOption {
type = types.bool;
save_dpi = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Collect and save data from deep packet inspection.
Adds around 150 data points and impacts performance.
'';
};
save_sites = mkOption {
type = types.bool;
save_sites = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Collect and save site data.
'';
};
hash_pii = mkOption {
type = types.bool;
hash_pii = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Hash, with md5, client names and MAC addresses. This attempts
to protect personally identifiable information.
'';
};
verify_ssl = mkOption {
type = types.bool;
verify_ssl = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Verify the Unifi controller's certificate.
@ -273,8 +270,8 @@ in {
};
in {
dynamic = mkOption {
type = types.bool;
dynamic = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Let prometheus select which controller to poll when scraping.
@ -284,18 +281,18 @@ in {
defaults = controllerOptions;
controllers = mkOption {
type = with types; listOf (submodule { options = controllerOptions; });
controllers = lib.mkOption {
type = with lib.types; listOf (submodule { options = controllerOptions; });
default = [];
description = ''
List of Unifi controllers to poll. Use defaults if empty.
'';
apply = map (flip removeAttrs [ "_module" ]);
apply = map (lib.flip removeAttrs [ "_module" ]);
};
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
users.groups.unifi-poller = { };
users.users.unifi-poller = {
description = "unifi-poller Service User";

View file

@ -204,7 +204,6 @@ in {
programs.nm-applet.indicator = true; # Budgie uses AppIndicators.
hardware.bluetooth.enable = mkDefault true; # for Budgie's Status Indicator and BCC's Bluetooth panel.
hardware.pulseaudio.enable = mkDefault true; # for Budgie's Status Indicator and BCC's Sound panel.
xdg.portal.enable = mkDefault true; # for BCC's Applications panel.
xdg.portal.extraPortals = with pkgs; [

View file

@ -97,7 +97,6 @@ in
# Default services
services.blueman.enable = mkDefault (notExcluded pkgs.blueman);
hardware.bluetooth.enable = mkDefault true;
hardware.pulseaudio.enable = mkDefault true;
security.polkit.enable = true;
services.accounts-daemon.enable = true;
services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));

View file

@ -47,7 +47,6 @@ in
'';
hardware.bluetooth.enable = mkDefault true;
hardware.pulseaudio.enable = mkDefault true;
security.polkit.enable = true;
services.deepin.dde-daemon.enable = mkForce true;

View file

@ -255,7 +255,6 @@ in
(lib.mkIf serviceCfg.core-os-services.enable {
hardware.bluetooth.enable = mkDefault true;
hardware.pulseaudio.enable = mkDefault true;
programs.dconf.enable = true;
security.polkit.enable = true;
services.accounts-daemon.enable = true;

View file

@ -130,7 +130,6 @@ in
# Default services
hardware.bluetooth.enable = mkDefault true;
hardware.pulseaudio.enable = mkDefault true;
security.polkit.enable = true;
services.accounts-daemon.enable = true;
services.bamf.enable = true;

View file

@ -380,7 +380,6 @@ in
xdg.portal.extraPortals = [ pkgs.plasma5Packages.xdg-desktop-portal-kde ];
xdg.portal.configPackages = mkDefault [ pkgs.plasma5Packages.xdg-desktop-portal-kde ];
# xdg-desktop-portal-kde expects PipeWire to be running.
# This does not, by default, replace PulseAudio.
services.pipewire.enable = mkDefault true;
# Update the start menu for each user that is currently logged in
@ -476,7 +475,7 @@ in
{
# The user interface breaks without pulse
assertion = config.hardware.pulseaudio.enable || (config.services.pipewire.enable && config.services.pipewire.pulse.enable);
message = "Plasma Mobile requires pulseaudio.";
message = "Plasma Mobile requires a Pulseaudio compatible sound server.";
}
];
@ -512,7 +511,6 @@ in
# The following services are needed or the UI is broken.
hardware.bluetooth.enable = true;
hardware.pulseaudio.enable = true;
networking.networkmanager.enable = true;
# Required for autorotate
hardware.sensor.iio.enable = lib.mkDefault true;