0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

Merge staging-next into staging

This commit is contained in:
nixpkgs-ci[bot] 2025-03-31 12:06:34 +00:00 committed by GitHub
commit 86e22e1e80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
73 changed files with 1358 additions and 2797 deletions

View file

@ -715,7 +715,7 @@ in {
miniflux = handleTest ./miniflux.nix {};
minio = handleTest ./minio.nix {};
miracle-wm = runTest ./miracle-wm.nix;
miriway = handleTest ./miriway.nix {};
miriway = runTest ./miriway.nix;
misc = handleTest ./misc.nix {};
misskey = handleTest ./misskey.nix {};
mjolnir = handleTest ./matrix/mjolnir.nix {};
@ -734,7 +734,7 @@ in {
moodle = handleTest ./moodle.nix {};
moonraker = handleTest ./moonraker.nix {};
mopidy = handleTest ./mopidy.nix {};
morph-browser = handleTest ./morph-browser.nix { };
morph-browser = runTest ./morph-browser.nix;
morty = handleTest ./morty.nix {};
mosquitto = handleTest ./mosquitto.nix {};
moosefs = handleTest ./moosefs.nix {};
@ -974,6 +974,7 @@ in {
postfix-raise-smtpd-tls-security-level = handleTest ./postfix-raise-smtpd-tls-security-level.nix {};
postfixadmin = handleTest ./postfixadmin.nix {};
postgresql = handleTest ./postgresql {};
postgrest = runTest ./postgrest.nix;
powerdns = handleTest ./powerdns.nix {};
powerdns-admin = handleTest ./powerdns-admin.nix {};
power-profiles-daemon = handleTest ./power-profiles-daemon.nix {};

View file

@ -1,148 +1,146 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "miriway";
{ pkgs, lib, ... }:
{
name = "miriway";
meta = {
maintainers = with lib.maintainers; [ OPNA2608 ];
};
meta = {
maintainers = with lib.maintainers; [ OPNA2608 ];
};
nodes.machine =
{ config, ... }:
{
imports = [
./common/auto.nix
./common/user-account.nix
];
nodes.machine =
{ config, ... }:
{
imports = [
./common/auto.nix
./common/user-account.nix
];
# Seems to very rarely get interrupted by oom-killer
virtualisation.memorySize = 2047;
# Seems to very rarely get interrupted by oom-killer
virtualisation.memorySize = 2047;
test-support.displayManager.auto = {
enable = true;
user = "alice";
};
programs.ydotool.enable = true;
services.xserver.enable = true;
services.displayManager.defaultSession = lib.mkForce "miriway";
programs.miriway = {
enable = true;
config = ''
add-wayland-extensions=all
enable-x11=
ctrl-alt=t:foot --maximized
ctrl-alt=a:env WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY= alacritty --option window.startup_mode=\"maximized\"
shell-component=dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY
shell-component=foot --maximized
'';
};
environment = {
shellAliases = {
test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok";
test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok";
};
systemPackages = with pkgs; [
mesa-demos
wayland-utils
foot
alacritty
];
# To help with OCR
etc."xdg/foot/foot.ini".source = (pkgs.formats.ini { }).generate "foot.ini" {
main = {
font = "inconsolata:size=16";
};
colors = rec {
foreground = "000000";
background = "ffffff";
regular2 = foreground;
};
};
etc."xdg/alacritty/alacritty.toml".source = (pkgs.formats.toml { }).generate "alacritty.toml" {
font = rec {
normal.family = "Inconsolata";
bold.family = normal.family;
italic.family = normal.family;
bold_italic.family = normal.family;
size = 16;
};
colors = rec {
primary = {
foreground = "0x000000";
background = "0xffffff";
};
normal = {
green = primary.foreground;
};
};
};
};
fonts.packages = [ pkgs.inconsolata ];
test-support.displayManager.auto = {
enable = true;
user = "alice";
};
enableOCR = true;
programs.ydotool.enable = true;
testScript =
{ nodes, ... }:
''
start_all()
machine.wait_for_unit("multi-user.target")
services.xserver.enable = true;
services.displayManager.defaultSession = lib.mkForce "miriway";
# Wait for Miriway to complete startup
machine.wait_for_file("/run/user/1000/wayland-0")
machine.succeed("pgrep miriway-shell")
machine.screenshot("miriway_launched")
programs.miriway = {
enable = true;
config = ''
add-wayland-extensions=all
enable-x11=
# Test Wayland
# We let Miriway start the first terminal, as we might get stuck if it's not ready to process the first keybind
# machine.send_key("ctrl-alt-t")
machine.wait_for_text(r"(alice|machine)")
machine.send_chars("test-wayland\n")
machine.wait_for_file("/tmp/test-wayland-exit-ok")
machine.copy_from_vm("/tmp/test-wayland.out")
machine.screenshot("foot_wayland_info")
ctrl-alt=t:foot --maximized
ctrl-alt=a:env WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY= alacritty --option window.startup_mode=\"maximized\"
# please actually register that we want to close the window
machine.succeed("ydotool mousemove -- 10 10")
machine.sleep(3)
shell-component=dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY
machine.send_chars("exit\n")
shell-component=foot --maximized
'';
};
# please actually register that we want to close the window
machine.succeed("ydotool mousemove -- 10 10")
machine.sleep(3)
environment = {
shellAliases = {
test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok";
test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok";
};
machine.wait_until_fails("pgrep foot")
systemPackages = with pkgs; [
mesa-demos
wayland-utils
foot
alacritty
];
# Test XWayland
machine.send_key("ctrl-alt-a")
machine.wait_for_text(r"(alice|machine)")
machine.send_chars("test-x11\n")
machine.wait_for_file("/tmp/test-x11-exit-ok")
machine.copy_from_vm("/tmp/test-x11.out")
machine.screenshot("alacritty_glinfo")
# To help with OCR
etc."xdg/foot/foot.ini".source = (pkgs.formats.ini { }).generate "foot.ini" {
main = {
font = "inconsolata:size=16";
};
colors = rec {
foreground = "000000";
background = "ffffff";
regular2 = foreground;
};
};
etc."xdg/alacritty/alacritty.toml".source = (pkgs.formats.toml { }).generate "alacritty.toml" {
font = rec {
normal.family = "Inconsolata";
bold.family = normal.family;
italic.family = normal.family;
bold_italic.family = normal.family;
size = 16;
};
colors = rec {
primary = {
foreground = "0x000000";
background = "0xffffff";
};
normal = {
green = primary.foreground;
};
};
};
};
# please actually register that we want to close the window
machine.succeed("ydotool mousemove -- 10 10")
machine.sleep(3)
fonts.packages = [ pkgs.inconsolata ];
};
machine.send_chars("exit\n")
enableOCR = true;
# please actually register that we want to close the window
machine.succeed("ydotool mousemove -- 10 10")
machine.sleep(3)
testScript =
{ nodes, ... }:
''
start_all()
machine.wait_for_unit("multi-user.target")
machine.wait_until_fails("pgrep alacritty")
'';
}
)
# Wait for Miriway to complete startup
machine.wait_for_file("/run/user/1000/wayland-0")
machine.succeed("pgrep miriway-shell")
machine.screenshot("miriway_launched")
# Test Wayland
# We let Miriway start the first terminal, as we might get stuck if it's not ready to process the first keybind
# machine.send_key("ctrl-alt-t")
machine.wait_for_text(r"(alice|machine)")
machine.send_chars("test-wayland\n")
machine.wait_for_file("/tmp/test-wayland-exit-ok")
machine.copy_from_vm("/tmp/test-wayland.out")
machine.screenshot("foot_wayland_info")
# please actually register that we want to close the window
machine.succeed("ydotool mousemove -- 10 10")
machine.sleep(3)
machine.send_chars("exit\n")
# please actually register that we want to close the window
machine.succeed("ydotool mousemove -- 10 10")
machine.sleep(3)
machine.wait_until_fails("pgrep foot")
# Test XWayland
machine.send_key("ctrl-alt-a")
machine.wait_for_text(r"(alice|machine)")
machine.send_chars("test-x11\n")
machine.wait_for_file("/tmp/test-x11-exit-ok")
machine.copy_from_vm("/tmp/test-x11.out")
machine.screenshot("alacritty_glinfo")
# please actually register that we want to close the window
machine.succeed("ydotool mousemove -- 10 10")
machine.sleep(3)
machine.send_chars("exit\n")
# please actually register that we want to close the window
machine.succeed("ydotool mousemove -- 10 10")
machine.sleep(3)
machine.wait_until_fails("pgrep alacritty")
'';
}

View file

@ -1,57 +1,55 @@
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "morph-browser-standalone";
meta.maintainers = lib.teams.lomiri.members;
{ pkgs, lib, ... }:
{
name = "morph-browser-standalone";
meta.maintainers = lib.teams.lomiri.members;
nodes.machine =
{ config, pkgs, ... }:
{
imports = [
./common/x11.nix
nodes.machine =
{ config, pkgs, ... }:
{
imports = [
./common/x11.nix
];
services.xserver.enable = true;
environment = {
systemPackages = with pkgs.lomiri; [
suru-icon-theme
morph-browser
];
services.xserver.enable = true;
environment = {
systemPackages = with pkgs.lomiri; [
suru-icon-theme
morph-browser
];
variables = {
UITK_ICON_THEME = "suru";
};
variables = {
UITK_ICON_THEME = "suru";
};
i18n.supportedLocales = [ "all" ];
fonts.packages = with pkgs; [
# Intended font & helps with OCR
ubuntu-classic
];
};
enableOCR = true;
i18n.supportedLocales = [ "all" ];
testScript = ''
machine.wait_for_x()
fonts.packages = with pkgs; [
# Intended font & helps with OCR
ubuntu-classic
];
};
with subtest("morph browser launches"):
machine.execute("morph-browser >&2 &")
machine.wait_for_text(r"Web Browser|New|sites|Bookmarks")
machine.screenshot("morph_open")
enableOCR = true;
with subtest("morph browser displays HTML"):
machine.send_chars("file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html\n")
machine.wait_for_text("Valgrind Documentation")
machine.screenshot("morph_htmlcontent")
testScript = ''
machine.wait_for_x()
machine.succeed("pkill -f morph-browser")
with subtest("morph browser launches"):
machine.execute("morph-browser >&2 &")
machine.wait_for_text(r"Web Browser|New|sites|Bookmarks")
machine.screenshot("morph_open")
with subtest("morph browser localisation works"):
machine.execute("env LANG=de_DE.UTF-8 morph-browser >&2 &")
machine.wait_for_text(r"Web-Browser|Neuer|Seiten|Lesezeichen")
machine.screenshot("morph_localised")
'';
}
)
with subtest("morph browser displays HTML"):
machine.send_chars("file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html\n")
machine.wait_for_text("Valgrind Documentation")
machine.screenshot("morph_htmlcontent")
machine.succeed("pkill -f morph-browser")
with subtest("morph browser localisation works"):
machine.execute("env LANG=de_DE.UTF-8 morph-browser >&2 &")
machine.wait_for_text(r"Web-Browser|Neuer|Seiten|Lesezeichen")
machine.screenshot("morph_localised")
'';
}

88
nixos/tests/postgrest.nix Normal file
View file

@ -0,0 +1,88 @@
{ lib, ... }:
{
name = "postgrest";
meta = {
maintainers = with lib.maintainers; [ wolfgangwalther ];
};
nodes.machine =
{
config,
lib,
pkgs,
...
}:
{
services.postgresql = {
enable = true;
initialScript = pkgs.writeText "init.sql" ''
CREATE ROLE postgrest LOGIN NOINHERIT;
CREATE ROLE anon ROLE postgrest;
CREATE ROLE postgrest_with_password LOGIN NOINHERIT PASSWORD 'password';
CREATE ROLE authenticated ROLE postgrest_with_password;
'';
};
services.postgrest = {
enable = true;
settings = {
admin-server-port = 3001;
db-anon-role = "anon";
db-uri.dbname = "postgres";
};
};
specialisation.withSecrets.configuration = {
services.postgresql.enableTCPIP = true;
services.postgrest = {
pgpassFile = "/run/secrets/.pgpass";
jwtSecretFile = "/run/secrets/jwt.secret";
settings.db-uri.host = "localhost";
settings.db-uri.user = "postgrest_with_password";
settings.server-port = 3000;
settings.server-unix-socket = null;
};
};
};
extraPythonPackages = p: [ p.pyjwt ];
testScript =
{ nodes, ... }:
let
withSecrets = "${nodes.machine.system.build.toplevel}/specialisation/withSecrets";
in
''
import jwt
machine.wait_for_unit("postgresql.service")
def wait_for_postgrest():
machine.wait_for_unit("postgrest.service")
machine.wait_until_succeeds("curl --fail -s http://localhost:3001/ready", timeout=30)
with subtest("anonymous access"):
wait_for_postgrest()
machine.succeed(
"curl --fail-with-body --no-progress-meter --unix-socket /run/postgrest/postgrest.sock http://localhost",
timeout=2
)
machine.execute("""
mkdir -p /run/secrets
echo "*:*:*:*:password" > /run/secrets/.pgpass
echo reallyreallyreallyreallyverysafe > /run/secrets/jwt.secret
""")
with subtest("authenticated access"):
machine.succeed("${withSecrets}/bin/switch-to-configuration test >&2")
wait_for_postgrest()
token = jwt.encode({ "role": "authenticated" }, "reallyreallyreallyreallyverysafe")
machine.succeed(
f"curl --fail-with-body --no-progress-meter -H 'Authorization: Bearer {token}' http://localhost:3000",
timeout=2
)
'';
}