2023-11-13 04:31:54 +01:00
|
|
|
# A big chunk of this was taken from fuxefan's config:
|
|
|
|
# https://github.com/fufexan/dotfiles/blob/main/home/programs/eww/default.nix
|
2023-08-14 13:49:55 +02:00
|
|
|
{ config
|
|
|
|
, pkgs
|
|
|
|
, lib
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
let
|
2023-11-13 04:31:54 +01:00
|
|
|
reloadScript = pkgs.writeShellScript "reload_eww" ''
|
2023-08-14 13:49:55 +02:00
|
|
|
systemctl --user restart eww.service
|
|
|
|
'';
|
|
|
|
|
|
|
|
cfg = config.programs.eww-hyprland;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.eww-hyprland = {
|
|
|
|
enable = lib.mkEnableOption "eww Hyprland config";
|
|
|
|
|
|
|
|
package = lib.mkOption {
|
|
|
|
type = lib.types.nullOr lib.types.package;
|
|
|
|
default = pkgs.eww-wayland;
|
|
|
|
defaultText = lib.literalExpression "pkgs.eww-wayland";
|
|
|
|
description = "Eww package to use.";
|
|
|
|
};
|
|
|
|
|
|
|
|
autoReload = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
defaultText = lib.literalExpression "false";
|
|
|
|
description = "Whether to restart the eww daemon and windows on change.";
|
|
|
|
};
|
|
|
|
|
|
|
|
dependencies = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.package;
|
|
|
|
default = [ ];
|
|
|
|
defaultText = lib.literalExpression "[]";
|
|
|
|
description = "Extra packages eww should have access to.";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraConfig = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
|
|
|
default = null;
|
|
|
|
description = "Extra configuration for eww.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
# remove nix files
|
|
|
|
xdg.configFile."eww/eww.yuck" = {
|
|
|
|
text = cfg.extraConfig or "";
|
|
|
|
|
|
|
|
onChange =
|
|
|
|
if cfg.autoReload
|
2023-11-13 04:31:54 +01:00
|
|
|
then reloadScript.outPath
|
2023-08-14 13:49:55 +02:00
|
|
|
else "";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.user.services.eww = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Eww Daemon";
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
Service = {
|
|
|
|
Environment = "PATH=/run/wrappers/bin:${lib.makeBinPath cfg.dependencies}";
|
|
|
|
ExecStart = "${cfg.package}/bin/eww daemon --no-daemonize";
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|