Merge pull request #212199 from OPNA2608/init/miriway

miriway: init at unstable-2022-12-18

Nick Cao 3ab1fd29 0dbdc44d

Changed files
+270
nixos
pkgs
applications
window-managers
miriway
top-level
+1
nixos/modules/module-list.nix
···
./programs/mdevctl.nix
./programs/mepo.nix
./programs/mininet.nix
+
./programs/miriway.nix
./programs/mosh.nix
./programs/msmtp.nix
./programs/mtr.nix
+60
nixos/modules/programs/miriway.nix
···
+
{ config, pkgs, lib, ... }:
+
+
let
+
cfg = config.programs.miriway;
+
in {
+
options.programs.miriway = {
+
enable = lib.mkEnableOption (lib.mdDoc ''
+
Miriway, a Mir based Wayland compositor. You can manually launch Miriway by
+
executing "exec miriway" on a TTY, or launch it from a display manager. Copy
+
/etc/xdg/xdg-miriway/miriway-shell.config to ~/.config/miriway-shell.config
+
to modify the default configuration. See <https://github.com/Miriway/Miriway>,
+
and "miriway --help" for more information'');
+
+
config = lib.mkOption {
+
type = lib.types.lines;
+
default = ''
+
x11-window-title=Miriway (Mir-on-X)
+
idle-timeout=600
+
ctrl-alt=t:miriway-terminal # Default "terminal emulator finder"
+
+
shell-component=dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY
+
'';
+
example = ''
+
idle-timeout=300
+
ctrl-alt=t:weston-terminal
+
add-wayland-extensions=all
+
+
shell-components=dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY
+
+
shell-component=waybar
+
shell-component=wbg Pictures/wallpaper
+
+
shell-meta=a:synapse
+
'';
+
description = lib.mdDoc ''
+
Miriway's config. This will be installed system-wide.
+
The default will install the miriway package's barebones example config.
+
'';
+
};
+
};
+
+
config = lib.mkIf cfg.enable {
+
environment = {
+
systemPackages = [ pkgs.miriway ];
+
etc = {
+
"xdg/xdg-miriway/miriway-shell.config".text = cfg.config;
+
};
+
};
+
+
hardware.opengl.enable = lib.mkDefault true;
+
fonts.enableDefaultFonts = lib.mkDefault true;
+
programs.dconf.enable = lib.mkDefault true;
+
programs.xwayland.enable = lib.mkDefault true;
+
+
# To make the Miriway session available if a display manager like SDDM is enabled:
+
services.xserver.displayManager.sessionPackages = [ pkgs.miriway ];
+
};
+
+
meta.maintainers = with lib.maintainers; [ OPNA2608 ];
+
}
+1
nixos/tests/all-tests.nix
···
minidlna = handleTest ./minidlna.nix {};
miniflux = handleTest ./miniflux.nix {};
minio = handleTest ./minio.nix {};
+
miriway = handleTest ./miriway.nix {};
misc = handleTest ./misc.nix {};
mjolnir = handleTest ./matrix/mjolnir.nix {};
mod_perl = handleTest ./mod_perl.nix {};
+126
nixos/tests/miriway.nix
···
+
import ./make-test-python.nix ({ pkgs, lib, ... }: {
+
name = "miriway";
+
+
meta = {
+
maintainers = with lib.maintainers; [ OPNA2608 ];
+
# FIXME On ARM Miriway inside the VM doesn't receive keyboard inputs, why?
+
broken = pkgs.stdenv.hostPlatform.isAarch;
+
};
+
+
nodes.machine = { config, ... }: {
+
imports = [
+
./common/auto.nix
+
./common/user-account.nix
+
];
+
+
# Seems to very rarely get interrupted by oom-killer
+
virtualisation.memorySize = 2047;
+
+
test-support.displayManager.auto = {
+
enable = true;
+
user = "alice";
+
};
+
+
services.xserver = {
+
enable = true;
+
displayManager.defaultSession = lib.mkForce "miriway";
+
};
+
+
programs.miriway = {
+
enable = true;
+
config = ''
+
add-wayland-extensions=all
+
+
ctrl-alt=t:foot --maximized
+
ctrl-alt=a:env WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY=invalid 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".text = lib.generators.toINI { } {
+
main = {
+
font = "inconsolata:size=16";
+
};
+
colors = rec {
+
foreground = "000000";
+
background = "ffffff";
+
regular2 = foreground;
+
};
+
};
+
etc."xdg/alacritty/alacritty.yml".text = lib.generators.toYAML { } {
+
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.fonts = [ pkgs.inconsolata ];
+
};
+
+
enableOCR = true;
+
+
testScript = { nodes, ... }: ''
+
start_all()
+
machine.wait_for_unit("multi-user.target")
+
+
# 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("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")
+
# Only succeeds when a mouse is moved inside an interactive session?
+
# machine.send_chars("exit\n")
+
# machine.wait_until_fails("pgrep foot")
+
machine.succeed("pkill foot")
+
+
# Test XWayland
+
machine.send_key("ctrl-alt-a")
+
machine.wait_for_text("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")
+
# Only succeeds when a mouse is moved inside an interactive session?
+
# machine.send_chars("exit\n")
+
# machine.wait_until_fails("pgrep alacritty")
+
machine.succeed("pkill alacritty")
+
'';
+
})
+80
pkgs/applications/window-managers/miriway/default.nix
···
+
{ stdenv
+
, lib
+
, fetchFromGitHub
+
, unstableGitUpdater
+
, nixosTests
+
, cmake
+
, pkg-config
+
, mir
+
, libxkbcommon
+
}:
+
+
stdenv.mkDerivation rec {
+
pname = "miriway";
+
version = "unstable-2022-12-18";
+
+
src = fetchFromGitHub {
+
owner = "Miriway";
+
repo = "Miriway";
+
rev = "d294c303cb99b7becb0d6686be9a09f0a1f57596";
+
hash = "sha256-H+IZgI1IQxNl5yAygbDKXkyXajGHV/mp9gEqZcp0TeE=";
+
};
+
+
postPatch = ''
+
substituteInPlace CMakeLists.txt \
+
--replace "\''${CMAKE_INSTALL_PREFIX}/bin" "\''${CMAKE_INSTALL_BINDIR}" \
+
--replace "/usr/share" "\''${CMAKE_INSTALL_DATADIR}" \
+
--replace "/etc" "\''${CMAKE_INSTALL_SYSCONFDIR}"
+
+
sed -i -e '/project(/a include(GNUInstallDirs)' CMakeLists.txt
+
'';
+
+
strictDeps = true;
+
+
nativeBuildInputs = [
+
cmake
+
pkg-config
+
];
+
+
buildInputs = [
+
mir
+
libxkbcommon
+
];
+
+
passthru = {
+
updateScript = unstableGitUpdater { };
+
providedSessions = [ "miriway" ];
+
tests = {
+
inherit (nixosTests) miriway;
+
};
+
};
+
+
meta = with lib; {
+
description = "Mir based Wayland compositor";
+
longDescription = ''
+
Miriway is a starting point for creating a Wayland based desktop environment using Mir.
+
+
At the core of Miriway is miriway-shell, a Mir based Wayland compositor that provides:
+
+
- A "floating windows" window managament policy;
+
- Support for Wayland (and via Xwayland) X11 applications;
+
- Dynamic workspaces;
+
- Additional Wayland support for "shell components" such as panels and docs; and,
+
- Configurable shortcuts for launching standard apps such as launcher and terminal emulator.
+
+
In addition to miriway-shell, Miriway has:
+
+
- A "terminal emulator finder" script miriway-terminal, that works with most terminal emulators;
+
- A launch script miriway to simplify starting Miriway;
+
- A default configuration file miriway-shell.config; and,
+
- A greeter configuration miriway.desktop so Miriway can be selected at login
+
+
Miriway has been tested with shell components from several desktop environments and there are notes on
+
enabling these in miriway-shell.config.
+
'';
+
homepage = "https://github.com/Miriway/Miriway";
+
license = licenses.gpl3Only;
+
platforms = platforms.linux;
+
maintainers = with maintainers; [ OPNA2608 ];
+
};
+
}
+2
pkgs/top-level/all-packages.nix
···
mir = callPackage ../servers/mir { };
+
miriway = callPackage ../applications/window-managers/miriway { };
+
icinga2 = callPackage ../servers/monitoring/icinga2 { };
icinga2-agent = callPackage ../servers/monitoring/icinga2 {