Skip to content

Commit c4c9593

Browse files
authored
Merge pull request #184 from knuton/bump-nixpkgs-2405
Bump nixpkgs to 24.11
2 parents 9de2b83 + 2f436c4 commit c4c9593

19 files changed

+217
-57
lines changed

application.nix

+30-14
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ rec {
2323

2424
module = { config, lib, pkgs, ... }:
2525
let
26+
sessionName = "kiosk-browser";
27+
2628
selectDisplay = pkgs.writeShellApplication {
2729
name = "select-display";
2830
runtimeInputs = with pkgs; [
@@ -41,6 +43,18 @@ rec {
4143
./application/limit-vtes.nix
4244
];
4345

46+
boot.blacklistedKernelModules = [
47+
# Blacklist NFC modules conflicting with CCID/PCSC
48+
# https://ludovicrousseau.blogspot.com/2013/11/linux-nfc-driver-conflicts-with-ccid.html
49+
"pn533_usb"
50+
"pn533"
51+
"nfc"
52+
53+
# Disable any USB sound cards to create a closed world where the audio
54+
# landscape on the standard devices is completely predictable.
55+
"snd_usb_audio"
56+
];
57+
4458
# Kiosk runs as a non-privileged user
4559
users.users.play = {
4660
isNormalUser = true;
@@ -64,9 +78,11 @@ rec {
6478
# System-wide packages
6579
environment.systemPackages = with pkgs; [ breeze-contrast-cursor-theme ];
6680

81+
# Avoid bloating system image size
82+
services.speechd.enable = false;
83+
6784
# Kiosk session
68-
services.xserver = let sessionName = "kiosk-browser";
69-
in {
85+
services.xserver = {
7086
enable = true;
7187

7288
desktopManager = {
@@ -103,27 +119,28 @@ rec {
103119
};
104120

105121
displayManager = {
106-
# Always automatically log in play user
107122
lightdm = {
108123
enable = true;
109124
greeter.enable = false;
110125
autoLogin.timeout = 0;
111126
};
112127

113-
autoLogin = {
114-
enable = true;
115-
user = "play";
116-
};
117-
118-
defaultSession = sessionName;
119-
120128
sessionCommands = ''
121129
${pkgs.xorg.xrdb}/bin/xrdb -merge <<EOF
122130
Xcursor.theme: ${pkgs.breeze-contrast-cursor-theme.themeName}
123131
EOF
124132
'';
125133
};
126134
};
135+
services.displayManager = {
136+
# Always automatically log in play user
137+
autoLogin = {
138+
enable = true;
139+
user = "play";
140+
};
141+
142+
defaultSession = sessionName;
143+
};
127144

128145
# Firewall configuration
129146
networking.firewall = {
@@ -166,15 +183,16 @@ rec {
166183
};
167184

168185
# Audio
169-
sound.enable = true;
186+
services.pipewire.enable = false;
187+
170188
hardware.pulseaudio = {
171189
enable = true;
172190
extraConfig = ''
173191
# Use HDMI output
174192
set-card-profile 0 output:hdmi-stereo
175193
# Respond to changes in connected outputs
176194
load-module module-switch-on-port-available
177-
load-module module-switch-on-connect
195+
load-module module-switch-on-connect blacklist=""
178196
'';
179197
};
180198

@@ -183,8 +201,6 @@ rec {
183201

184202
# Enable pcscd for smart card identification
185203
services.pcscd.enable = true;
186-
# Blacklist NFC modules conflicting with CCID (https://ludovicrousseau.blogspot.com/2013/11/linux-nfc-driver-conflicts-with-ccid.html)
187-
boot.blacklistedKernelModules = [ "pn533_usb" "pn533" "nfc" ];
188204
# Allow play user to access pcsc
189205
security.polkit.extraConfig = ''
190206
polkit.addRule(function(action, subject) {

controller/.ocamlformat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 0.26.1
1+
version = 0.27.0
22

33
profile = ocamlformat
44

controller/bindings/connman/connman.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,8 @@ module Service = struct
684684
Lwt.fail_with
685685
(Printf.sprintf
686686
"Connection failed, unknown error reported by manager: %s\n\
687-
DBus connect exception: %s" err (Printexc.to_string exn)
687+
DBus connect exception: %s"
688+
err (Printexc.to_string exn)
688689
)
689690
| Error exn, Some (AgentError err) ->
690691
Lwt.fail_with

controller/dune-project

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(lang dune 3.11)
1+
(lang dune 3.16)

kiosk/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ python3Packages.buildPythonApplication rec {
2323
nativeBuildInputs = [
2424
mypy
2525
qt6.wrapQtAppsHook
26+
wrapGAppsHook
2627
];
2728

2829
propagatedBuildInputs = with python3Packages; [

kiosk/kiosk_browser/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
import os
23
import logging
34
import signal
45
from PyQt6.QtCore import Qt, QUrl
@@ -7,10 +8,22 @@
78

89
from kiosk_browser import main_widget
910

11+
# Workaround for https://bugreports.qt.io/browse/QTBUG-130273 in Qt 6.8.1
12+
# Should be fixed with QT 6.8.2
13+
# Note: doing this via env variables rather than passing `--webEngineArgs`,
14+
# because the env variable overrides the args (and so is easy to break in tests,
15+
# etc)
16+
def tempFixAudioIssues():
17+
curFlags = os.environ.get('QTWEBENGINE_CHROMIUM_FLAGS', "")
18+
os.environ['QTWEBENGINE_CHROMIUM_FLAGS'] = curFlags + " --disable-features=FFmpegAllowLists"
19+
20+
1021
def start(kiosk_url, settings_url, toggle_settings_key, fullscreen = True):
1122

1223
logging.basicConfig(level=logging.INFO)
1324

25+
tempFixAudioIssues()
26+
1427
app = QApplication(sys.argv)
1528
app.setApplicationName("kiosk-browser")
1629

kiosk/kiosk_browser/browser_widget.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def _view(self, status):
145145

146146
def user_agent_with_system(user_agent, system_name, system_version):
147147
"""Inject a specific system into a user agent string"""
148-
pattern = re.compile('(Mozilla/5.0) \(([^\)]*)\)(.*)')
148+
pattern = re.compile(r'(Mozilla/5.0) \(([^\)]*)\)(.*)')
149149
m = pattern.match(user_agent)
150150

151151
if m == None:

kiosk/kiosk_browser/dialogable_widget.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def title_line(
117117
font-size: 16px;
118118
""")
119119

120-
button = QtWidgets.QPushButton("", dialog)
120+
button = QtWidgets.QPushButton("×", dialog)
121121
button.setCursor(QtGui.QCursor(QtCore.Qt.CursorShape.PointingHandCursor))
122122
button.setStyleSheet("""
123123
QPushButton {

pkgs/default.nix

+4-12
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
let
44

55
nixpkgs = builtins.fetchTarball {
6-
# nixos-23.11 2024-03-18
7-
url = "https://github.com/nixos/nixpkgs/archive/614b4613980a522ba49f0d194531beddbb7220d3.tar.gz";
8-
sha256 = "1kipdjdjcd1brm5a9lzlhffrgyid0byaqwfnpzlmw3q825z7nj6w";
6+
# release-24.11 2025-02-10
7+
url = "https://github.com/NixOS/nixpkgs/archive/edd84e9bffdf1c0ceba05c0d868356f28a1eb7de.tar.gz";
8+
sha256 = "1gb61gahkq74hqiw8kbr9j0qwf2wlwnsvhb7z68zhm8wa27grqr0";
99
};
1010

1111
overlay =
@@ -15,7 +15,7 @@ let
1515

1616
rauc = (import ./rauc) super;
1717

18-
ocamlPackages = super.ocamlPackages.overrideScope' (self: super: {
18+
ocamlPackages = super.ocamlPackages.overrideScope (self: super: {
1919
semver = self.callPackage ./ocaml-modules/semver {};
2020
obus = self.callPackage ./ocaml-modules/obus {};
2121
opium = self.callPackage ./ocaml-modules/opium {};
@@ -25,14 +25,6 @@ let
2525
./ocaml-modules/ppx_protocol_conv_jsonm {};
2626
});
2727

28-
# fixes getExe warning, used in tests
29-
# Should be obsolete after upgrading to nixpkgs 24.05: https://github.com/NixOS/nixpkgs/pull/273952
30-
tinyproxy = super.tinyproxy.overrideAttrs (_: prev: {
31-
meta = prev.meta // {
32-
mainProgram = "tinyproxy";
33-
};
34-
});
35-
3628
};
3729

3830
in

testing/end-to-end/profile.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
];
77

88
config = {
9-
# don't need opengl for running tests, reduces image size vastly
10-
hardware.opengl.enable = false;
9+
# disable hardware-accelerated graphics, reduces image size vastly
10+
hardware.graphics.enable = false;
1111

1212
# test-instrumentation.nix sets this in the boot as kernel param,
1313
# but since we are booting with a custom GRUB config it has no effect,

testing/end-to-end/tests/application/kiosk-persistence-helpers.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import asyncio
55
import pyppeteer # type: ignore
66
import tempfile
7+
import atexit
78

89
# Forward external `port` to 127.0.0.1:port and add firewall exception to allow
910
# external access to internal services in PlayOS
@@ -46,9 +47,10 @@ async def retry_until_no_exception(func, retries=3, sleep=3.0):
4647
# due to nix sandboxing, network access is isolated, so
4748
# we run a minimal HTTP server for opening in the kiosk
4849
def run_stub_server(port):
49-
d = tempfile.TemporaryDirectory()
50+
d = tempfile.TemporaryDirectory(delete=False)
51+
atexit.register(d.cleanup)
5052
with open(f"{d.name}/index.html", "w") as f:
51-
f.write("Hello world")
53+
f.write("Hello world\n")
5254

5355
class Handler(http.server.SimpleHTTPRequestHandler):
5456
def __init__(self, *args, **kwargs):

testing/end-to-end/tests/application/kiosk-persistence.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ with TestPrecondition("PlayOS is booted, controller is running"):
152152
playos.wait_for_unit('playos-controller.service')
153153
154154
with TestPrecondition("VM can reach HTTP stub server"):
155-
playos.succeed("curl --fail '${kioskUrl}'")
155+
playos.succeed("curl --fail '${kioskUrl}'", timeout=3)
156156
157157
with TestCase("xserver and kiosk are running"):
158158
playos.wait_for_x()
159-
playos.succeed("pgrep -f kiosk-browser > /dev/null")
159+
playos.succeed("pgrep --full kiosk-browser > /dev/null")
160160
161161
with TestCase("Kiosk's debug port open, web storage is persisted") as t:
162162
page = aio.run(connect_and_get_kiosk_page())

testing/integration/controller-system-buttons.nix

+8-4
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@ pkgs.testers.runNixOSTest {
6464
# produces the reboot/shutdown log messages used in `wait_for_console_text`
6565
playos.wait_for_unit("systemd-logind.service")
6666
67+
# Executes curl without waiting for it to complete or return an exit status.
68+
# This avoids issues with test-driver choking on non-decodable output.
69+
def curl_POST_ignore_output(url):
70+
playos.execute(f"curl -X POST {url} >&2", check_output = False)
6771
6872
playos.start(allow_reboot=True)
6973
wait_for_http()
7074
7175
# ===== Reboot works
7276
with subtest("Reboot works"):
73-
playos.succeed("curl -X POST http://localhost:3333/system/reboot >&2")
77+
curl_POST_ignore_output("http://localhost:3333/system/reboot")
7478
playos.wait_for_console_text("systemd.*The system will reboot now!")
7579
7680
manual_restart()
@@ -84,7 +88,7 @@ pkgs.testers.runNixOSTest {
8488
--property ActiveState \
8589
playos-wipe-persistent-data.service | grep 'ActiveState=inactive'
8690
""")
87-
playos.succeed("curl -X POST http://localhost:3333/system/factory-reset >&2")
91+
curl_POST_ignore_output("http://localhost:3333/system/factory-reset")
8892
playos.wait_for_console_text("systemd.*Starting playos-wipe-persistent-data.service.")
8993
playos.wait_for_console_text("systemd.*The system will reboot now!")
9094
@@ -93,15 +97,15 @@ pkgs.testers.runNixOSTest {
9397
# ===== Switch slot works
9498
9599
with subtest("Switch slot works"):
96-
playos.succeed("curl -X POST http://localhost:3333/system/switch/system.b >&2")
100+
curl_POST_ignore_output("http://localhost:3333/system/switch/system.b")
97101
playos.wait_for_console_text("rauc mark: activated slot system.b")
98102
playos.wait_for_console_text("systemd.*The system will reboot now!")
99103
100104
manual_restart()
101105
102106
# ===== Shutdown works
103107
with subtest("Shutdown works"):
104-
playos.succeed("curl -X POST http://localhost:3333/system/shutdown >&2")
108+
curl_POST_ignore_output("http://localhost:3333/system/shutdown")
105109
playos.wait_for_console_text("systemd.*System is powering down.")
106110
playos.crash() # avoids "Broken pipe" test failure
107111
'';

testing/integration/controller-wifi.nix

+6-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ pkgs.testers.runNixOSTest {
4848
services.connman.networkInterfaceBlacklist =
4949
allSimulatedAPInterfaces;
5050

51-
systemd.services."connman".after = [ "hostapd.service" ];
52-
5351
# allow accesing controller GUI from the test runner
5452
networking.firewall.enable = mkForce false;
5553
virtualisation.forwardPorts = [
@@ -99,12 +97,17 @@ pkgs.testers.runNixOSTest {
9997
# enable 802.11 simulation
10098
boot.kernelModules = [ "mac80211_hwsim" ];
10199

100+
systemd.services.hostapd = {
101+
preStart = "${pkgs.util-linux}/bin/rfkill unblock all";
102+
};
103+
102104
# wireless access points
103105
services.hostapd = {
104106
enable = true;
105107
# note: do not change this to wlan1 or other id, weird failures appear
106108
radios.wlan0 = {
107109
band = "2g";
110+
channel = 7;
108111
countryCode = "US";
109112
networks = {
110113
wlan0 = {
@@ -196,7 +199,7 @@ def wait_for_http():
196199
playos.wait_for_unit("playos-controller.service")
197200
playos.wait_until_succeeds("curl --fail http://localhost:3333/")
198201
199-
def service_req(service, endpoint, data=None, timeout=15):
202+
def service_req(service, endpoint, data=None, timeout=30):
200203
headers = {'Accept': 'application/json'}
201204
return requests.post(
202205
"http://localhost:13333/network/{id}/{endpoint}".format(

0 commit comments

Comments
 (0)