Regenerated

This commit is contained in:
2026-03-19 14:46:57 +00:00
parent 79320391ce
commit ad771e919c
29 changed files with 57 additions and 1389 deletions
+57 -24
View File
@@ -939,51 +939,61 @@ This file sets up wayland
{ lib, config, ... }:
let
# --- Program definition ---
programName = "wayland";
# --- Module variables ---
moduleName = "wayland";
username = config.defaultUser or "henrov";
# Assets directory (optional)
assetPath =
if builtins.pathExists ../../../assets/system/conf/${moduleName}
then ../../../assets/system/conf/${moduleName}
else null;
# Assets (optional, kept for consistency with template)
programAssets = ../../../assets/system/conf/${programName};
programFiles =
if builtins.pathExists programAssets
then builtins.readDir programAssets
if assetPath != null
then builtins.readDir assetPath
else {};
files = lib.genAttrs (builtins.attrNames programFiles) (name: {
src = "${programAssets}/${name}";
src = "${assetPath}/${name}";
});
# Enable toggle (must match option name)
# Top-level toggle for this module
enableProgram = config.enableWayland or true;
# Resolve user safely (outside mkIf)
user = config.defaultUser or "henrov";
in
{
# --- Option ---
options.enableWayland =
lib.mkEnableOption "Enable Wayland + portals";
# --- Declare the top-level toggle ---
options.enableWayland = lib.mkEnableOption "Enable Wayland + portals";
# --- Config ---
# --- Only apply configuration if enabled ---
config = lib.mkIf enableProgram {
# --- Dendritic app definition ---
mySystem.${programName} = {
enable = true;
assetsDir = programAssets;
files = files;
inherit user;
# Example dendritic container (flat, self-contained)
wayland = {
enable = true;
user = username;
assetsDir = assetPath;
files = files;
# Wayland-specific metadata
portals = [ "hyprland" ];
};
# --- Actual system wiring ---
home-manager.users.${user} = {
# Deploy assets to user's XDG config if they exist
home-manager.users.${username} = lib.mkIf assetPath != null {
xdg.configFile =
lib.mapAttrs' (name: value: {
name = "${moduleName}/${name}";
value.source = value.src;
}) files;
};
# Example portal + packages configuration
home-manager.users.${username} = {
xdg.portal = {
enable = true;
# pkgs is unavoidable here (real package dependency)
# Only reference pkgs if unavoidable
extraPortals = [
config.pkgs.xdg-desktop-portal-hyprland
];
@@ -997,6 +1007,29 @@ in
config.pkgs.uwsm
];
};
# Optional systemd service to sync configs (if needed)
systemd.services."${moduleName}-sync" = {
description = "Sync ${moduleName} configuration";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = ''
set -euo pipefail
if [ -d "${assetPath}" ]; then
for f in ${lib.concatStringsSep " " (builtins.attrNames files)}; do
cp -u "${assetPath}/$f" "/home/${username}/.config/${moduleName}/$f"
done
fi
'';
};
restartTriggers = [ assetPath ];
path = [];
};
};
}
#+END_SRC