···409409 (optionalString (cfg.config != null) copyConfig) +
410410 (optionalString (cfg.lovelaceConfig != null) copyLovelaceConfig)
411411 ;
412412+ environment.PYTHONPATH = package.pythonPath;
412413 serviceConfig = let
413414 # List of capabilities to equip home-assistant with, depending on configured components
414415 capabilities = lib.unique ([
+18-21
nixos/modules/services/misc/mbpfan.nix
···11{ config, lib, pkgs, ... }:
22-32with lib;
4354let
···1615 type = types.package;
1716 default = pkgs.mbpfan;
1817 defaultText = literalExpression "pkgs.mbpfan";
1919- description = lib.mdDoc ''
2020- The package used for the mbpfan daemon.
2121- '';
1818+ description = lib.mdDoc "The package used for the mbpfan daemon.";
2219 };
23202421 verbose = mkOption {
2522 type = types.bool;
2623 default = false;
2727- description = lib.mdDoc ''
2828- If true, sets the log level to verbose.
2929- '';
2424+ description = lib.mdDoc "If true, sets the log level to verbose.";
2525+ };
2626+2727+ aggressive = mkOption {
2828+ type = types.bool;
2929+ default = false;
3030+ description = lib.mdDoc "If true, favors higher default fan speeds.";
3031 };
31323233 settings = mkOption {
···3536 type = types.submodule {
3637 freeformType = settingsFormat.type;
37383838- options.general.min_fan1_speed = mkOption {
3939- type = types.nullOr types.int;
4040- default = 2000;
4141- description = lib.mdDoc ''
4242- You can check minimum and maximum fan limits with
4343- `cat /sys/devices/platform/applesmc.768/fan*_min` and
4444- `cat /sys/devices/platform/applesmc.768/fan*_max` respectively.
4545- Setting to null implies using default value from applesmc.
4646- '';
4747- };
4839 options.general.low_temp = mkOption {
4940 type = types.int;
5050- default = 55;
4141+ default = 63;
5142 description = lib.mdDoc "If temperature is below this, fans will run at minimum speed.";
5243 };
5344 options.general.high_temp = mkOption {
5445 type = types.int;
5555- default = 58;
4646+ default = 66;
5647 description = lib.mdDoc "If temperature is above this, fan speed will gradually increase.";
5748 };
5849 options.general.max_temp = mkOption {
···7970 ];
80718172 config = mkIf cfg.enable {
8282- boot.kernelModules = [ "coretemp" "applesmc" ];
7373+ services.mbpfan.settings = mkIf cfg.aggressive {
7474+ general.min_fan1_speed = mkDefault 2000;
7575+ general.low_temp = mkDefault 55;
7676+ general.high_temp = mkDefault 58;
7777+ general.max_temp = mkDefault 70;
7878+ };
83798484- environment.etc."mbpfan.conf".source = settingsFile;
8080+ boot.kernelModules = [ "coretemp" "applesmc" ];
8581 environment.systemPackages = [ cfg.package ];
8282+ environment.etc."mbpfan.conf".source = settingsFile;
86838784 systemd.services.mbpfan = {
8885 description = "A fan manager daemon for MacBook Pro";
+57-48
nixos/tests/home-assistant.nix
···2222 enable = true;
2323 inherit configDir;
24242525- # tests loading components by overriding the package
2525+ # provide dependencies through package overrides
2626 package = (pkgs.home-assistant.override {
2727 extraPackages = ps: with ps; [
2828 colorama
2929 ];
3030- extraComponents = [ "zha" ];
3131- }).overrideAttrs (oldAttrs: {
3232- doInstallCheck = false;
3030+ extraComponents = [
3131+ # test char-tty device allow propagation into the service
3232+ "zha"
3333+ ];
3334 });
34353535- # tests loading components from the module
3636+ # provide component dependencies explicitly from the module
3637 extraComponents = [
3737- "wake_on_lan"
3838+ "mqtt"
3839 ];
39404040- # test extra package passing from the module
4141+ # provide package for postgresql support
4142 extraPackages = python3Packages: with python3Packages; [
4243 psycopg2
4344 ];
···111112 };
112113113114 testScript = { nodes, ... }: let
114114- system = nodes.hass.config.system.build.toplevel;
115115+ system = nodes.hass.system.build.toplevel;
115116 in
116117 ''
117117- import re
118118 import json
119119120120 start_all()
121121122122- # Parse the package path out of the systemd unit, as we cannot
123123- # access the final package, that is overridden inside the module,
124124- # by any other means.
125125- pattern = re.compile(r"path=(?P<path>[\/a-z0-9-.]+)\/bin\/hass")
126126- response = hass.execute("systemctl show -p ExecStart home-assistant.service")[1]
127127- match = pattern.search(response)
128128- assert match
129129- package = match.group('path')
130122131131-132132- def get_journal_cursor(host) -> str:
133133- exit, out = host.execute("journalctl -u home-assistant.service -n1 -o json-pretty --output-fields=__CURSOR")
123123+ def get_journal_cursor() -> str:
124124+ exit, out = hass.execute("journalctl -u home-assistant.service -n1 -o json-pretty --output-fields=__CURSOR")
134125 assert exit == 0
135126 return json.loads(out)["__CURSOR"]
136127137128138138- def wait_for_homeassistant(host, cursor):
139139- host.wait_until_succeeds(f"journalctl --after-cursor='{cursor}' -u home-assistant.service | grep -q 'Home Assistant initialized in'")
129129+ def get_journal_since(cursor) -> str:
130130+ exit, out = hass.execute(f"journalctl --after-cursor='{cursor}' -u home-assistant.service")
131131+ assert exit == 0
132132+ return out
133133+134134+135135+ def get_unit_property(property) -> str:
136136+ exit, out = hass.execute(f"systemctl show --property={property} home-assistant.service")
137137+ assert exit == 0
138138+ return out
139139+140140+141141+ def wait_for_homeassistant(cursor):
142142+ hass.wait_until_succeeds(f"journalctl --after-cursor='{cursor}' -u home-assistant.service | grep -q 'Home Assistant initialized in'")
140143141144142145 hass.wait_for_unit("home-assistant.service")
143143- cursor = get_journal_cursor(hass)
146146+ cursor = get_journal_cursor()
144147145148 with subtest("Check that YAML configuration file is in place"):
146149 hass.succeed("test -L ${configDir}/configuration.yaml")
···148151 with subtest("Check the lovelace config is copied because lovelaceConfigWritable = true"):
149152 hass.succeed("test -f ${configDir}/ui-lovelace.yaml")
150153151151- with subtest("Check extraComponents and extraPackages are considered from the package"):
152152- hass.succeed(f"grep -q 'colorama' {package}/extra_packages")
153153- hass.succeed(f"grep -q 'zha' {package}/extra_components")
154154-155155- with subtest("Check extraComponents and extraPackages are considered from the module"):
156156- hass.succeed(f"grep -q 'psycopg2' {package}/extra_packages")
157157- hass.succeed(f"grep -q 'wake_on_lan' {package}/extra_components")
158158-159154 with subtest("Check that Home Assistant's web interface and API can be reached"):
160160- wait_for_homeassistant(hass, cursor)
155155+ wait_for_homeassistant(cursor)
161156 hass.wait_for_open_port(8123)
162157 hass.succeed("curl --fail http://localhost:8123/lovelace")
163158159159+ with subtest("Check that optional dependencies are in the PYTHONPATH"):
160160+ env = get_unit_property("Environment")
161161+ python_path = env.split("PYTHONPATH=")[1].split()[0]
162162+ for package in ["colorama", "paho-mqtt", "psycopg2"]:
163163+ assert package in python_path, f"{package} not in PYTHONPATH"
164164+165165+ with subtest("Check that declaratively configured components get setup"):
166166+ journal = get_journal_since(cursor)
167167+ for domain in ["emulated_hue", "wake_on_lan"]:
168168+ assert f"Setup of domain {domain} took" in journal, f"{domain} setup missing"
169169+164170 with subtest("Check that capabilities are passed for emulated_hue to bind to port 80"):
165171 hass.wait_for_open_port(80)
166172 hass.succeed("curl --fail http://localhost:80/description.xml")
···169175 hass.succeed("systemctl show -p DeviceAllow home-assistant.service | grep -q char-ttyUSB")
170176171177 with subtest("Check service reloads when configuration changes"):
172172- # store the old pid of the process
173173- pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
174174- cursor = get_journal_cursor(hass)
175175- hass.succeed("${system}/specialisation/differentName/bin/switch-to-configuration test")
176176- new_pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
177177- assert pid == new_pid, "The PID of the process should not change between process reloads"
178178- wait_for_homeassistant(hass, cursor)
178178+ pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
179179+ cursor = get_journal_cursor()
180180+ hass.succeed("${system}/specialisation/differentName/bin/switch-to-configuration test")
181181+ new_pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
182182+ assert pid == new_pid, "The PID of the process should not change between process reloads"
183183+ wait_for_homeassistant(cursor)
179184180180- with subtest("check service restarts when package changes"):
181181- pid = new_pid
182182- cursor = get_journal_cursor(hass)
183183- hass.succeed("${system}/specialisation/newFeature/bin/switch-to-configuration test")
184184- new_pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
185185- assert pid != new_pid, "The PID of the process shoudl change when the HA binary changes"
186186- wait_for_homeassistant(hass, cursor)
185185+ with subtest("Check service restarts when dependencies change"):
186186+ pid = new_pid
187187+ cursor = get_journal_cursor()
188188+ hass.succeed("${system}/specialisation/newFeature/bin/switch-to-configuration test")
189189+ new_pid = hass.succeed("systemctl show --property=MainPID home-assistant.service")
190190+ assert pid != new_pid, "The PID of the process should change when its PYTHONPATH changess"
191191+ wait_for_homeassistant(cursor)
192192+193193+ with subtest("Check that new components get setup after restart"):
194194+ journal = get_journal_since(cursor)
195195+ for domain in ["esphome"]:
196196+ assert f"Setup of domain {domain} took" in journal, f"{domain} setup missing"
187197188198 with subtest("Check that no errors were logged"):
189189- output_log = hass.succeed("cat ${configDir}/home-assistant.log")
190190- assert "ERROR" not in output_log
199199+ hass.fail("journalctl -u home-assistant -o cat | grep -q ERROR")
191200192201 with subtest("Check systemd unit hardening"):
193202 hass.log(hass.succeed("systemctl cat home-assistant.service"))
···2626, pulseaudioSupport ? mediaSupport
2727, libpulseaudio
2828, apulse
2929+, alsa-lib
29303031# Media support (implies audio support)
3132, mediaSupport ? true
···5758 libPath = lib.makeLibraryPath libPkgs;
58595960 libPkgs = [
6161+ alsa-lib
6062 atk
6163 cairo
6264 dbus
···8587 fteLibPath = lib.makeLibraryPath [ stdenv.cc.cc gmp ];
86888789 # Upstream source
8888- version = "11.5.8";
9090+ version = "12.0.3";
89919090- lang = "en-US";
9292+ lang = "ALL";
91939294 srcs = {
9395 x86_64-linux = fetchurl {
···9799 "https://tor.eff.org/dist/torbrowser/${version}/tor-browser-linux64-${version}_${lang}.tar.xz"
98100 "https://tor.calyxinstitute.org/dist/torbrowser/${version}/tor-browser-linux64-${version}_${lang}.tar.xz"
99101 ];
100100- sha256 = "sha256-/KK9oTijk5dEziAwp5966NaM2V4k1mtBjTJq88Ct7N0=";
102102+ hash = "sha256-bOGY/RdwD6O7QIuOiBw7OVnZfpumGGso6hwMJJwN2g0=";
101103 };
102104103105 i686-linux = fetchurl {
···107109 "https://tor.eff.org/dist/torbrowser/${version}/tor-browser-linux32-${version}_${lang}.tar.xz"
108110 "https://tor.calyxinstitute.org/dist/torbrowser/${version}/tor-browser-linux32-${version}_${lang}.tar.xz"
109111 ];
110110- sha256 = "sha256-TGdJ5yIeo0YQ4XSsb9lv3vuW6qEjhFe7KBmkjYO6fAc=";
112112+ hash = "sha256-t1tnEZtiRig2r8GNJpqT+J0XoxCLMyUsI9tX6aa0lYk=";
111113 };
112114 };
113115in
···291293 # TBB will fail if ownership is too permissive
292294 chmod 0700 "\$HOME/TorBrowser/Data/Tor"
293295294294- # Initialize the browser profile state. Note that the only data
295295- # copied from the Store payload is the initial bookmark file, which is
296296- # never updated once created. All other files under user's profile
297297- # dir are generated by TBB.
296296+ # Initialize the browser profile state.
297297+ # All files under user's profile dir are generated by TBB.
298298 mkdir -p "\$HOME/TorBrowser/Data/Browser/profile.default"
299299- cp -u --no-preserve=mode,owner "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/bookmarks.html" \
300300- "\$HOME/TorBrowser/Data/Browser/profile.default/bookmarks.html"
301299302300 # Clear some files if the last known store path is different from the new one
303301 : "\''${KNOWN_STORE_PATH:=\$HOME/known-store-path}"
···324322 # Font cache files capture store paths; clear them out on the off
325323 # chance that TBB would continue using old font files.
326324 rm -rf "\$HOME/.cache/fontconfig"
325325+326326+ # Workaround a bug in 12.0.X that Tor directories are not cleaned up and tor gets confused where its socket is
327327+ rm -rf \$XDG_RUNTIME_DIR/Tor*
327328328329 # Manually specify data paths (by default TB attempts to create these in the store)
329330 {
···148148 mutmut = throw "mutmut has been promoted to a top-level attribute"; # added 2022-10-02
149149 net2grid = gridnet; # add 2022-04-22
150150 nose-cover3 = throw "nose-cover3 has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; # added 2022-02-16
151151+ nose_progressive = throw "nose_progressive has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; #added 2023-02-21
151152 notifymuch = throw "notifymuch has been promoted to a top-level attribute"; # added 2022-10-02
152153 Nuitka = nuitka; # added 2023-02-19
153154 ordereddict = throw "ordereddict has been removed because it is only useful on unsupported python versions."; # added 2022-05-28