# The config files in ../../config that no Home Manager module writes, put where # the programs read them: scripts, stylesheets and themes edited by hand, and # the configs apps save themselves. The rest are set through the modules in # desktop.nix, apps.nix, theming.nix and shell.nix. { config, lib, ... }: let inherit (config.lib.dot) link; # Configs the programs write themselves (MangoHud, btop, micro, apps that # register URL handlers): copied in only when missing, and never overwritten, # so changes made in the app stick. Your existing files in /home win. seeds = { ".config/btop/btop.conf" = "btop/btop.conf"; ".config/MangoHud/MangoHud.conf" = "MangoHud/MangoHud.conf"; ".config/vkBasalt/vkBasalt.conf" = "vkBasalt/vkBasalt.conf"; ".config/vkSumi/vkSumi.conf" = "vkSumi/vkSumi.conf"; ".config/micro/settings.json" = "micro/settings.json"; ".config/micro/bindings.json" = "micro/bindings.json"; ".config/mimeapps.list" = "mimeapps.list"; }; # Linked whole to the checkout before Home Manager modules wrote files in them # (and kdeglobals, now set with kwriteconfig6). oldLinks = [ "hypr" "waybar" "fuzzel" "kitty" "dunst" "nvim" "qt6ct" "kdeglobals" ]; in { xdg.configFile = { # Started by services.nix: the apps opened at login, the clipboard bridge. "hypr/scripts".source = link "hypr/scripts"; # Waybar's flyouts (Eww) and the scripts its modules and the flyouts run. "waybar/eww".source = link "waybar/eww"; "waybar/scripts".source = link "waybar/scripts"; # Hyprland's mod + Return; reads favorites next to itself. "fuzzel/launch".source = link "fuzzel/launch"; "fuzzel/favorites".source = link "fuzzel/favorites"; "philly/theme.css".source = link "philly/theme.css"; "micro/colorschemes".source = ../../config/micro/colorschemes; }; home.file.".p10k.zsh".source = link "zsh/p10k.zsh"; home.activation = { # The folders above were links into the checkout. Home Manager checks for # files in its way before it removes old links, so through such a link it # would find the checkout's own files (waybar/eww, hypr/scripts) and move # them aside in the repo. Remove the old links first; afterwards these are # real folders and this does nothing. dropOldLinks = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ( lib.concatMapStrings (name: '' if [ -L "${config.xdg.configHome}/${name}" ]; then run rm "${config.xdg.configHome}/${name}" fi '') oldLinks ); seedConfigs = lib.hm.dag.entryAfter [ "writeBoundary" ] ( lib.concatStrings ( lib.mapAttrsToList (target: rel: '' if [ ! -e "$HOME/${target}" ]; then run mkdir -p "$(dirname "$HOME/${target}")" run install -m644 ${../../config + "/${rel}"} "$HOME/${target}" fi '') seeds ) ); }; }