{ lib, config, pkgs, ... }: let programName = "wofi"; username = config.defaultUser or "henrov"; assetPath = ../../../assets/system/conf/${programName}; in { # Deploy assets to ~/.config/wofi via Home Manager home-manager.users.${username}.home.file = if builtins.pathExists assetPath then lib.genAttrs (builtins.attrNames (builtins.readDir assetPath)) (name: { source = "${assetPath}/${name}"; target = ".config/${programName}/${name}"; }) else {}; # Optional systemd service to sync assets manually systemd.services."${programName}-sync" = { description = "Sync ${programName} configuration files"; wantedBy = [ "multi-user.target" ]; after = [ "network-online.target" ]; serviceConfig = { Type = "oneshot"; ExecStart = '' set -euo pipefail if [ -d "${assetPath}" ]; then mkdir -p "/home/${username}/.config/${programName}" cp -u ${lib.concatStringsSep " " (builtins.attrNames (builtins.readDir assetPath))} "${assetPath}/" "/home/${username}/.config/${programName}/" fi ''; }; restartTriggers = [ assetPath ]; path = []; }; }