treewide: add stylix.testbed.ui.{command,application} options (#1110)
Link: https://github.com/danth/stylix/pull/1110 Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: awwpotato <awwpotato@voidq.com>
This commit is contained in:
parent
de0870f075
commit
8a35410a28
24 changed files with 112 additions and 79 deletions
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.alacritty;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "Alacritty";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.cavalier;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "org.nickvision.cavalier";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.chromium;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "chromium-browser";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "discord";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.vesktop;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "vesktop";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.emacs;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "emacs";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ let
|
|||
profileName = "stylix";
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "firefox";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ let
|
|||
profileName = "stylix";
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "firefox";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.foot;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "foot";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.gedit;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "org.gnome.gedit";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ let
|
|||
package = pkgs.ghostty;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "com.mitchellh.ghostty";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ let
|
|||
port = 1234;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "firefox";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.gnome-text-editor;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "org.gnome.TextEditor";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.halloy;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "org.squidowl.halloy";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.kitty;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "kitty";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ let
|
|||
package = pkgs.mpv;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "mpv";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ let
|
|||
package = pkgs.mpv;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "mpv";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ let
|
|||
package = pkgs.mpv;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "mpv";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.qutebrowser;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "org.qutebrowser.qutebrowser";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ let
|
|||
package = pkgs.vscodium;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "codium";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.wezterm;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "org.wezfurlong.wezterm";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "yazi";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ let
|
|||
package = pkgs.zathura;
|
||||
in
|
||||
{
|
||||
stylix.testbed.application = {
|
||||
enable = true;
|
||||
stylix.testbed.ui.application = {
|
||||
name = "org.pwmt.zathura";
|
||||
inherit package;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,39 +40,82 @@ let
|
|||
applicationModule =
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
options.stylix.testbed.application = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable a standard configuration for testing individual
|
||||
applications.
|
||||
options.stylix.testbed.ui = lib.mkOption {
|
||||
type = lib.types.nullOr (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable a standard configuration for testing graphical
|
||||
applications.
|
||||
|
||||
This will automatically log in as the `${username}` user, then launch
|
||||
the application from its desktop entry.
|
||||
This will automatically log in as the `${username}` user and launch
|
||||
an application or command.
|
||||
|
||||
This is currently based on GNOME, but the specific desktop environment
|
||||
used may change in the future.
|
||||
'';
|
||||
};
|
||||
This is currently based on GNOME, but the specific desktop environment
|
||||
used may change in the future.
|
||||
'';
|
||||
};
|
||||
application = lib.mkOption {
|
||||
description = ''
|
||||
Options defining an application to be launched using its provided
|
||||
`.desktop` entry.
|
||||
'';
|
||||
type = lib.types.nullOr (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The name of the desktop entry for the application, without the
|
||||
`.desktop` extension.
|
||||
'';
|
||||
};
|
||||
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The name of the desktop entry for the application, without the
|
||||
`.desktop` extension.
|
||||
'';
|
||||
};
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
description = ''
|
||||
The application being tested.
|
||||
'';
|
||||
};
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
description = ''
|
||||
The package providing the binary and desktop entry of the
|
||||
application being tested.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
command = lib.mkOption {
|
||||
type = lib.types.nullOr (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
text = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
The command which will be run once the graphical environment has
|
||||
loaded.
|
||||
'';
|
||||
};
|
||||
useTerminal = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Whether or not to spawn a terminal when running the command.
|
||||
'';
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = null;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.stylix.testbed.application.enable {
|
||||
config = lib.mkIf (config.stylix.testbed.ui != null) {
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
displayManager.gdm.enable = true;
|
||||
|
|
@ -87,11 +130,24 @@ let
|
|||
# Disable the GNOME tutorial which pops up on first login.
|
||||
environment.gnome.excludePackages = [ pkgs.gnome-tour ];
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.makeAutostartItem {
|
||||
inherit (config.stylix.testbed.application) name package;
|
||||
})
|
||||
];
|
||||
# for use when application is set
|
||||
environment.systemPackages =
|
||||
lib.optional (config.stylix.testbed.ui.command != null) (
|
||||
pkgs.makeAutostartItem {
|
||||
name = "stylix-testbed";
|
||||
package = pkgs.makeDesktopItem {
|
||||
name = "stylix-testbed";
|
||||
desktopName = "stylix-testbed";
|
||||
exec = config.stylix.testbed.ui.command.text;
|
||||
terminal = config.stylix.testbed.ui.command.useTerminal;
|
||||
};
|
||||
}
|
||||
)
|
||||
++ lib.optional (config.stylix.testbed.ui.application != null) (
|
||||
pkgs.makeAutostartItem {
|
||||
inherit (config.stylix.testbed.ui.application) name package;
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue