66 lines
1.7 KiB
Nix
66 lines
1.7 KiB
Nix
{ lib, pkgs, flakeRoot, ... }:
|
|
|
|
{ config, ... }:
|
|
|
|
let
|
|
# --- Program-specific variables ---
|
|
programName = "eww";
|
|
username = config.defaultUser or "henrov";
|
|
|
|
# Directory with all your eww assets inside the flake
|
|
programAssets = "${flakeRoot}/assets/system/conf/${programName}";
|
|
|
|
# Read all files in the assets directory
|
|
programFiles = builtins.attrNames (builtins.readDir programAssets);
|
|
|
|
# Generate Nix-friendly attributes for each file
|
|
files = lib.genAttrs programFiles (name: {
|
|
src = "${programAssets}/${name}";
|
|
});
|
|
in
|
|
{
|
|
# --- Top-level toggle for enabling eww ---
|
|
options.enableEww =
|
|
lib.mkEnableOption "Enable eww widgets";
|
|
|
|
# --- Apply configuration only if enabled ---
|
|
config = lib.mkIf (config.enableEww or false) {
|
|
# Top-level container for apps
|
|
myApps = {
|
|
eww = {
|
|
enable = true;
|
|
assetsDir = programAssets;
|
|
files = files;
|
|
user = username;
|
|
packages = [ "eww" ];
|
|
|
|
# --- Home Manager user config ---
|
|
homeManagerUsers = {
|
|
"${username}" = {
|
|
home.stateVersion = "26.05";
|
|
home.username = username;
|
|
home.homeDirectory = "/home/${username}";
|
|
|
|
# Deploy eww configs
|
|
home.file."${programAssets}" = {
|
|
source = programAssets;
|
|
recursive = true;
|
|
};
|
|
|
|
# Session variables
|
|
home.sessionVariables = {
|
|
EWW_BIN = "${pkgs.eww}/bin/eww";
|
|
};
|
|
|
|
# Wayland/Hyprland startup hooks
|
|
wayland.windowManager.hyprland.settings = lib.mkForce {
|
|
exec-once = [ "eww daemon" ];
|
|
exec = [ "eww open-many ${programAssets}/widgets" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|