nixos/retroarch: add RetroArch as a desktop session
This commit is contained in:
parent
f80278219f
commit
d282f448ff
4 changed files with 91 additions and 1 deletions
|
@ -19,7 +19,7 @@ in
|
||||||
# E.g., if Plasma 5 is enabled, it supersedes xterm.
|
# E.g., if Plasma 5 is enabled, it supersedes xterm.
|
||||||
imports = [
|
imports = [
|
||||||
./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix
|
./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix
|
||||||
./lxqt.nix ./enlightenment.nix ./gnome.nix ./kodi.nix
|
./lxqt.nix ./enlightenment.nix ./gnome.nix ./retroarch.nix ./kodi.nix
|
||||||
./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix
|
./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix
|
||||||
./cinnamon.nix
|
./cinnamon.nix
|
||||||
];
|
];
|
||||||
|
|
40
nixos/modules/services/x11/desktop-managers/retroarch.nix
Normal file
40
nixos/modules/services/x11/desktop-managers/retroarch.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let cfg = config.services.xserver.desktopManager.retroarch;
|
||||||
|
|
||||||
|
in {
|
||||||
|
options.services.xserver.desktopManager.retroarch = {
|
||||||
|
enable = mkEnableOption "RetroArch";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.retroarch;
|
||||||
|
defaultText = literalExpression "pkgs.retroarch";
|
||||||
|
example = literalExpression "pkgs.retroarch-full";
|
||||||
|
description = "RetroArch package to use.";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraArgs = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
|
example = [ "--verbose" "--host" ];
|
||||||
|
description = "Extra arguments to pass to RetroArch.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.xserver.desktopManager.session = [{
|
||||||
|
name = "RetroArch";
|
||||||
|
start = ''
|
||||||
|
${cfg.package}/bin/retroarch -f ${escapeShellArgs cfg.extraArgs} &
|
||||||
|
waitPID=$!
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
};
|
||||||
|
|
||||||
|
meta.maintainers = with maintainers; [ j0hax ];
|
||||||
|
}
|
|
@ -439,6 +439,7 @@ in
|
||||||
resolv = handleTest ./resolv.nix {};
|
resolv = handleTest ./resolv.nix {};
|
||||||
restartByActivationScript = handleTest ./restart-by-activation-script.nix {};
|
restartByActivationScript = handleTest ./restart-by-activation-script.nix {};
|
||||||
restic = handleTest ./restic.nix {};
|
restic = handleTest ./restic.nix {};
|
||||||
|
retroarch = handleTest ./retroarch.nix {};
|
||||||
riak = handleTest ./riak.nix {};
|
riak = handleTest ./riak.nix {};
|
||||||
robustirc-bridge = handleTest ./robustirc-bridge.nix {};
|
robustirc-bridge = handleTest ./robustirc-bridge.nix {};
|
||||||
roundcube = handleTest ./roundcube.nix {};
|
roundcube = handleTest ./roundcube.nix {};
|
||||||
|
|
49
nixos/tests/retroarch.nix
Normal file
49
nixos/tests/retroarch.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
import ./make-test-python.nix ({ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "retroarch";
|
||||||
|
meta = with pkgs.lib.maintainers; { maintainers = [ j0hax ]; };
|
||||||
|
|
||||||
|
machine = { ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./common/user-account.nix ];
|
||||||
|
services.xserver.enable = true;
|
||||||
|
services.xserver.desktopManager.retroarch = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.retroarchFull;
|
||||||
|
};
|
||||||
|
services.xserver.displayManager = {
|
||||||
|
sddm.enable = true;
|
||||||
|
defaultSession = "RetroArch";
|
||||||
|
autoLogin = {
|
||||||
|
enable = true;
|
||||||
|
user = "alice";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = { nodes, ... }:
|
||||||
|
let
|
||||||
|
user = nodes.machine.config.users.users.alice;
|
||||||
|
xdo = "${pkgs.xdotool}/bin/xdotool";
|
||||||
|
in ''
|
||||||
|
with subtest("Wait for login"):
|
||||||
|
start_all()
|
||||||
|
machine.wait_for_file("${user.home}/.Xauthority")
|
||||||
|
machine.succeed("xauth merge ${user.home}/.Xauthority")
|
||||||
|
|
||||||
|
with subtest("Check RetroArch started"):
|
||||||
|
machine.wait_until_succeeds("pgrep retroarch")
|
||||||
|
machine.wait_for_window("^RetroArch ")
|
||||||
|
|
||||||
|
with subtest("Check configuration created"):
|
||||||
|
machine.wait_for_file("${user.home}/.config/retroarch/retroarch.cfg")
|
||||||
|
|
||||||
|
with subtest("Wait to get a screenshot"):
|
||||||
|
machine.execute(
|
||||||
|
"${xdo} key Alt+F1 sleep 10"
|
||||||
|
)
|
||||||
|
machine.screenshot("screen")
|
||||||
|
'';
|
||||||
|
})
|
Loading…
Reference in a new issue