stylix: allow choosing testbed desktop (#1222)
Allow choosing the testbed desktop, ideally as a temporary solution until migrating to the cage environment. Link: https://github.com/nix-community/stylix/pull/1222 Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com> Reviewed-by: awwpotato <awwpotato@voidq.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
436ad797df
commit
8c854fe383
13 changed files with 167 additions and 65 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
{ lib, pkgs, ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
windowManager.bspwm.enable = true;
|
||||
};
|
||||
stylix.testbed.ui = {
|
||||
graphicalEnvironment = "bspwm";
|
||||
|
||||
home-manager.sharedModules = lib.singleton {
|
||||
xsession.windowManager.bspwm = {
|
||||
enable = true;
|
||||
|
||||
# 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
{
|
||||
services = {
|
||||
desktopManager.gnome.enable = true;
|
||||
displayManager.gdm.enable = true;
|
||||
};
|
||||
stylix.testbed.ui.graphicalEnvironment = "gnome";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
stylix/testbed/available-graphical-environments.nix
Normal file
5
stylix/testbed/available-graphical-environments.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ lib }:
|
||||
lib.pipe ./graphical-environments [
|
||||
builtins.readDir
|
||||
(lib.mapAttrsToList (name: _: lib.removeSuffix ".nix" name))
|
||||
]
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
31
stylix/testbed/graphical-environments/bspwm.nix
Normal file
31
stylix/testbed/graphical-environments/bspwm.nix
Normal file
|
|
@ -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
stylix/testbed/graphical-environments/gnome.nix
Normal file
20
stylix/testbed/graphical-environments/gnome.nix
Normal file
|
|
@ -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
stylix/testbed/graphical-environments/hyprland.nix
Normal file
32
stylix/testbed/graphical-environments/hyprland.nix
Normal file
|
|
@ -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
stylix/testbed/graphical-environments/kde.nix
Normal file
15
stylix/testbed/graphical-environments/kde.nix
Normal file
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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) (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue