86 lines
1.9 KiB
Nix
86 lines
1.9 KiB
Nix
{ lib, config, flakeRoot, ... }:
|
|
|
|
let
|
|
# --- Program definition ---
|
|
programName = "hyprland";
|
|
|
|
# --- Assets ---
|
|
programAssets = "${flakeRoot}/assets/hyprland/conf/hypr";
|
|
|
|
programFiles =
|
|
if builtins.pathExists programAssets
|
|
then builtins.readDir programAssets
|
|
else {};
|
|
|
|
fileNames = builtins.attrNames programFiles;
|
|
|
|
# Exclude main config (handled separately)
|
|
otherFiles = lib.filter (name: name != "hyprland.conf") fileNames;
|
|
|
|
# Generate file mappings
|
|
files = lib.genAttrs otherFiles (name: {
|
|
src = "${programAssets}/${name}";
|
|
});
|
|
|
|
# Main config (inline)
|
|
mainConfigPath = "${programAssets}/hyprland.conf";
|
|
|
|
# Enable toggle (must match option)
|
|
enableProgram = config.enableHyprland or true;
|
|
|
|
# Resolve user safely
|
|
user = config.defaultUser or "henrov";
|
|
in
|
|
{
|
|
# --- Option ---
|
|
options.enableHyprland =
|
|
lib.mkEnableOption "Enable Hyprland desktop";
|
|
|
|
# --- Config ---
|
|
config = lib.mkIf enableProgram {
|
|
|
|
# --- Dendritic app definition ---
|
|
mySystem.${programName} = {
|
|
enable = true;
|
|
assetsDir = programAssets;
|
|
files = files;
|
|
inherit user;
|
|
|
|
compositor = "hyprland";
|
|
};
|
|
|
|
# --- System-level enable ---
|
|
programs.hyprland.enable = true;
|
|
|
|
# --- Home Manager wiring ---
|
|
home-manager.users.${user} = {
|
|
|
|
home.stateVersion = "26.05";
|
|
home.username = user;
|
|
home.homeDirectory = "/home/${user}";
|
|
|
|
wayland.windowManager.hyprland = {
|
|
enable = true;
|
|
|
|
settings.general."col.active_border" =
|
|
lib.mkForce "0xff97cbcd 0xff89b4fa";
|
|
};
|
|
|
|
# --- Config files ---
|
|
xdg.configFile =
|
|
(lib.mapAttrs' (name: value: {
|
|
name = "hypr/${name}";
|
|
value.source = value.src;
|
|
}) files)
|
|
// {
|
|
"hypr/hyprland.conf".text =
|
|
if builtins.pathExists mainConfigPath
|
|
then builtins.readFile mainConfigPath
|
|
else "";
|
|
|
|
"hypr/.keep".text = "";
|
|
};
|
|
};
|
|
};
|
|
}
|