wayle: add module

Co-authored-by: Perchun Pak <github@perchun.it>

(cherry-picked from commit 83b3ecce2e)
This commit is contained in:
Isaac Shiells Thomas
2026-04-22 12:09:23 -06:00
committed by Austin Horstman
parent e29db51cc0
commit e1fd7350f4
5 changed files with 225 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
{ pkgs, ... }:
{
time = "2026-03-20T02:34:29+00:00";
condition = pkgs.stdenv.hostPlatform.isLinux;
message = ''
A new module is available: 'services.wayle'.
Wayle is a fast, configurable desktop environment shell for Wayland
compositors. Built in Rust with Relm4 and focused on performance,
modularity, and a great user experience. A successor to HyprPanel without
the pain or dependency on Hyprland.
'';
}

140
modules/services/wayle.nix Normal file
View File

@@ -0,0 +1,140 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (builtins) elem;
inherit (lib.attrsets) recursiveUpdate;
inherit (lib) lists getExe';
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption mkOption mkPackageOption;
cfg = config.services.wayle;
tomlFormat = pkgs.formats.toml { };
in
{
meta.maintainers = with lib.maintainers; [
perchun
];
options.services.wayle = {
enable = mkEnableOption "wayle shell";
package = mkPackageOption pkgs "wayle" { };
autoInstallDependencies = mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Whether to automatically install soft dependencies used by wayle that
will be required based on your config.
'';
};
settings = mkOption {
inherit (tomlFormat) type;
description = ''
Standard configuration options for wayle.
'';
default = { };
example = {
styling = {
theme-provider = "wayle";
palette = {
bg = "#16161e";
fg = "#c0caf5";
primary = "#7aa2f7";
};
};
bar = {
scale = 1;
location = "top";
rounding = "sm";
layout = [
{
monitor = "*";
left = [ "clock" ];
center = [ "media" ];
right = [ "battery" ];
}
];
};
modules.clock = {
format = "%H:%M";
icon-show = true;
label-show = true;
};
};
};
};
config = mkIf cfg.enable (
let
# Define default settings.
# This is not used to generate the config.toml file for wayle, only for
# internal module configuration that require (possibly user unset)
# default settings. These are the same defaults wayle uses.
settings_with_fallbacks = recursiveUpdate {
wallpaper.engine-enabled = false;
styling.theme-provider = "wayle";
} cfg.settings;
in
{
assertions = [
(lib.hm.assertions.assertPlatform "services.wayle" pkgs lib.platforms.linux)
];
home.packages = (
[ cfg.package ]
# Install the appropriate theme-provider, if set.
++ (lists.optional (
cfg.autoInstallDependencies
&& elem settings_with_fallbacks.styling.theme-provider [
"matugen"
"wallust"
"pywal"
]
) pkgs.${settings_with_fallbacks.styling.theme-provider})
);
# Main config file.
xdg.configFile."wayle/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "wayle-config" cfg.settings;
};
# Systemd service for main wayle shell.
systemd.user.services.wayle = {
Unit = {
Description = ''
Wayland Elements - A compositor agnostic shell with extensive customization
'';
Documentation = "https://github.com/wayle-rs/wayle";
PartOf = [ config.wayland.systemd.target ];
After = [ config.wayland.systemd.target ];
ConditionEnvironment = "WAYLAND_DISPLAY";
};
Service = {
ExecStart = "${getExe' cfg.package "wayle"} shell";
Restart = "on-failure";
};
Install = {
WantedBy = [ config.wayland.systemd.target ];
};
};
# Wallpaper-engine dependency.
services.swww.enable = mkIf (
cfg.autoInstallDependencies && settings_with_fallbacks.wallpaper.engine-enabled
) (lib.mkDefault true);
}
);
}

View File

@@ -0,0 +1,44 @@
{ config, ... }:
{
services.wayle = {
enable = true;
package = config.lib.test.mkStubPackage { name = "wayle"; };
settings = {
styling = {
theme-provider = "wayle";
palette = {
bg = "#16161e";
fg = "#c0caf5";
primary = "#7aa2f7";
};
};
bar = {
scale = 1;
location = "top";
rounding = "sm";
layout = {
monitor = "*";
left = [ "clock" ];
center = [ "media" ];
right = [ "battery" ];
};
};
modules.clock = {
format = "%H:%M";
icon-show = true;
label-show = true;
};
};
};
nmt.script = ''
assertFileContent \
"home-files/.config/wayle/config.toml" \
${./basic-config.toml}
'';
}

View File

@@ -0,0 +1,23 @@
[bar]
location = "top"
rounding = "sm"
scale = 1
[bar.layout]
center = ["media"]
left = ["clock"]
monitor = "*"
right = ["battery"]
[modules.clock]
format = "%H:%M"
icon-show = true
label-show = true
[styling]
theme-provider = "wayle"
[styling.palette]
bg = "#16161e"
fg = "#c0caf5"
primary = "#7aa2f7"

View File

@@ -0,0 +1,5 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
wayle-basic-config = ./basic-config.nix;
}