Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/src/testbeds.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ uses.
- `enable` defaults to true; allows for conditionally disabling a testbed
- `ui` and all of its suboptions are optional. Setting any will enable a
graphical environment.
- `graphicalEnvironment` defaults to "gnome"; takes the string name of the graphical
environment to be used for the testbed. See
`stylix/testbed/graphicalEnvironments` for a complete list of available
graphical environments.
- `command` takes a command to be run once the graphical environment
has loaded
- `text` takes the string of the command
Expand Down
18 changes: 7 additions & 11 deletions modules/bspwm/testbeds/bspwm.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{ lib, pkgs, ... }:
{ pkgs, ... }:

{
services.xserver = {
enable = true;
windowManager.bspwm.enable = true;
};

home-manager.sharedModules = lib.singleton {
xsession.windowManager.bspwm = {
enable = true;
stylix.testbed.ui = {
graphicalEnvironment = "bspwm";

# We need something to open a window so that we can check the window borders
startupPrograms = [ "${lib.getExe pkgs.kitty}" ];
# We need something to open a window so that we can check the window borders
application = {
name = "kitty";
package = pkgs.kitty;
};
};
}
5 changes: 1 addition & 4 deletions modules/gnome/testbeds/gnome.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
services = {
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
};
stylix.testbed.ui.graphicalEnvironment = "gnome";
}
16 changes: 7 additions & 9 deletions modules/hyprland/testbeds/hyprland.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{ lib, pkgs, ... }:
{ pkgs, ... }:

{
environment.loginShellInit = lib.getExe pkgs.hyprland;
programs.hyprland.enable = true;
stylix.testbed.ui = {
graphicalEnvironment = "hyprland";

home-manager.sharedModules = lib.singleton {
wayland.windowManager.hyprland = {
enable = true;

# We need something to open a window so that we can check the window borders
settings.bind = [ "ALT, RETURN, exec, ${lib.getExe pkgs.foot}" ];
# We need something to open a window so that we can check the window borders
application = {
name = "kitty";
package = pkgs.kitty;
};
};
}
11 changes: 7 additions & 4 deletions modules/kde/testbeds/kde.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
services = {
displayManager.sddm.enable = true;

desktopManager.plasma6.enable = true;
lib,
...
}:
{
config = {
stylix.testbed.ui.graphicalEnvironment = "kde";
services.displayManager.autoLogin.enable = lib.mkForce false;
};
}
32 changes: 15 additions & 17 deletions modules/mako/testbeds/mako.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
{ lib, pkgs, ... }:

{
# We use Hyprland because Gnome has its own notification daemon
environment.loginShellInit = lib.getExe pkgs.hyprland;
programs.hyprland.enable = true;
stylix.testbed.ui = {
# We use Hyprland because Gnome has its own notification daemon
graphicalEnvironment = "hyprland";
command.text =
# Run as a single command to ensure the same order between executions
lib.concatMapStringsSep " && "
(
urgency: "${lib.getExe pkgs.libnotify} --urgency ${urgency} ${urgency} urgency"
)
[
"low"
"normal"
"critical"
];
};

home-manager.sharedModules = lib.singleton {
services.mako.enable = true;
wayland.windowManager.hyprland = {
enable = true;
settings.exec-once =
# Run as a single command to ensure the same order between executions
lib.concatMapStringsSep " && "
(
urgency: "${lib.getExe pkgs.libnotify} --urgency ${urgency} ${urgency} urgency"
)
[
"low"
"normal"
"critical"
];
};
};
}
5 changes: 5 additions & 0 deletions stylix/testbed/available-graphical-environments.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ lib }:
lib.pipe ./graphical-environments [
builtins.readDir
(lib.mapAttrsToList (name: _: lib.removeSuffix ".nix" name))
]
28 changes: 16 additions & 12 deletions stylix/testbed/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@ let
system = lib.nixosSystem {
inherit (pkgs) system;

modules = [
./modules/common.nix
./modules/enable.nix
./modules/application.nix
inputs.self.nixosModules.stylix
inputs.home-manager.nixosModules.home-manager
testbed
modules =
[
./modules/common.nix
./modules/enable.nix
./modules/application.nix
inputs.self.nixosModules.stylix
inputs.home-manager.nixosModules.home-manager
testbed

# modules for external targets
inputs.nvf.nixosModules.default
inputs.nixvim.nixosModules.nixvim
inputs.spicetify-nix.nixosModules.spicetify
];
# modules for external targets
inputs.nvf.nixosModules.default
inputs.nixvim.nixosModules.nixvim
inputs.spicetify-nix.nixosModules.spicetify
]
++ map (name: import ./graphical-environments/${name}.nix) (
import ./available-graphical-environments.nix { inherit lib; }
);
};
in
pkgs.writeShellApplication {
Expand Down
31 changes: 31 additions & 0 deletions stylix/testbed/graphical-environments/bspwm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
config,
lib,
pkgs,
...
}:
{
config =
lib.mkIf (config.stylix.testbed.ui.graphicalEnvironment or null == "bspwm")
{
services.xserver = {
enable = true;
windowManager.bspwm.enable = true;
};

environment.systemPackages = [
# dex looks for `x-terminal-emulator` when running a terminal program
(pkgs.writeShellScriptBin "x-terminal-emulator" ''exec ${lib.getExe pkgs.kitty} "$@"'')
];

home-manager.sharedModules = lib.singleton {
programs.kitty.enable = true;
xsession.windowManager.bspwm = {
enable = true;
startupPrograms = [
"find /run/current-system/sw/etc/xdg/autostart/ -type f -or -type l | xargs -P0 -L1 ${lib.getExe pkgs.dex}"
];
};
};
};
}
20 changes: 20 additions & 0 deletions stylix/testbed/graphical-environments/gnome.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
config,
lib,
pkgs,
...
}:
{
config =
lib.mkIf (config.stylix.testbed.ui.graphicalEnvironment or null == "gnome")
{
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};

# Disable the GNOME tutorial which pops up on first login.
environment.gnome.excludePackages = [ pkgs.gnome-tour ];
};
}
32 changes: 32 additions & 0 deletions stylix/testbed/graphical-environments/hyprland.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}:
{
config =
lib.mkIf (config.stylix.testbed.ui.graphicalEnvironment or null == "hyprland")
{
environment.loginShellInit = lib.getExe pkgs.hyprland;
programs.hyprland.enable = true;
environment.systemPackages = [
# dex looks for `x-terminal-emulator` when running a terminal program
(pkgs.writeShellScriptBin "x-terminal-emulator" ''exec ${lib.getExe pkgs.kitty} "$@"'')
];

home-manager.sharedModules = lib.singleton {
programs.kitty.enable = true;
wayland.windowManager.hyprland = {
enable = true;
settings = {
exec-once = "find /run/current-system/sw/etc/xdg/autostart/ -type f -or -type l | xargs -P0 -L1 ${lib.getExe pkgs.dex}";
ecosystem = {
no_update_news = true;
no_donation_nag = true;
};
};
};
};
};
}
15 changes: 15 additions & 0 deletions stylix/testbed/graphical-environments/kde.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
config,
lib,
...
}:
{
config =
lib.mkIf (config.stylix.testbed.ui.graphicalEnvironment or null == "kde")
{
services = {
displayManager.sddm.enable = true;
desktopManager.plasma6.enable = true;
};
};
}
15 changes: 7 additions & 8 deletions stylix/testbed/modules/application.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ in
used may change in the future.
'';
};
graphicalEnvironment = lib.mkOption {
type = lib.types.enum (
import ../available-graphical-environments.nix { inherit lib; }
);
default = "gnome";
description = "The graphical environment to use.";
};
application = lib.mkOption {
description = ''
Options defining an application to be launched using its provided
Expand Down Expand Up @@ -84,19 +91,11 @@ in
};

config = lib.mkIf (config.stylix.testbed.ui != null) {
services = {
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};

services.displayManager.autoLogin = {
enable = true;
user = user.username;
};

# Disable the GNOME tutorial which pops up on first login.
environment.gnome.excludePackages = [ pkgs.gnome-tour ];

# for use when application is set
environment.systemPackages =
lib.optional (config.stylix.testbed.ui.command != null) (
Expand Down
Loading