dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
| 1 | # The config files in ../../config that no Home Manager module writes, put where |
| 2 | # the programs read them: scripts, stylesheets and themes edited by hand, and |
| 3 | # the configs apps save themselves. The rest are set through the modules in |
| 4 | # desktop.nix, apps.nix, theming.nix and shell.nix. |
| 5 | { |
| 6 | config, |
| 7 | lib, |
| 8 | ... |
| 9 | }: |
| 10 | let |
| 11 | inherit (config.lib.dot) link; |
| 12 | |
| 13 | # Configs the programs write themselves (MangoHud, btop, micro, apps that |
| 14 | # register URL handlers): copied in only when missing, and never overwritten, |
| 15 | # so changes made in the app stick. Your existing files in /home win. |
| 16 | seeds = { |
| 17 | ".config/btop/btop.conf" = "btop/btop.conf"; |
| 18 | ".config/MangoHud/MangoHud.conf" = "MangoHud/MangoHud.conf"; |
| 19 | ".config/vkBasalt/vkBasalt.conf" = "vkBasalt/vkBasalt.conf"; |
| 20 | ".config/vkSumi/vkSumi.conf" = "vkSumi/vkSumi.conf"; |
| 21 | ".config/micro/settings.json" = "micro/settings.json"; |
| 22 | ".config/micro/bindings.json" = "micro/bindings.json"; |
| 23 | ".config/mimeapps.list" = "mimeapps.list"; |
| 24 | }; |
| 25 | |
| 26 | # Linked whole to the checkout before Home Manager modules wrote files in them |
| 27 | # (and kdeglobals, now set with kwriteconfig6). |
| 28 | oldLinks = [ |
| 29 | "hypr" |
| 30 | "waybar" |
| 31 | "fuzzel" |
| 32 | "kitty" |
| 33 | "dunst" |
| 34 | "nvim" |
| 35 | "qt6ct" |
| 36 | "kdeglobals" |
| 37 | ]; |
| 38 | in |
| 39 | { |
| 40 | xdg.configFile = { |
| 41 | # Started by services.nix: the apps opened at login, the clipboard bridge. |
| 42 | "hypr/scripts".source = link "hypr/scripts"; |
| 43 | # Waybar's flyouts (Eww) and the scripts its modules and the flyouts run. |
| 44 | "waybar/eww".source = link "waybar/eww"; |
| 45 | "waybar/scripts".source = link "waybar/scripts"; |
| 46 | # Hyprland's mod + Return; reads favorites next to itself. |
| 47 | "fuzzel/launch".source = link "fuzzel/launch"; |
| 48 | "fuzzel/favorites".source = link "fuzzel/favorites"; |
| 49 | "philly/theme.css".source = link "philly/theme.css"; |
| 50 | |
| 51 | "micro/colorschemes".source = ../../config/micro/colorschemes; |
| 52 | }; |
| 53 | |
| 54 | home.file.".p10k.zsh".source = link "zsh/p10k.zsh"; |
| 55 | |
| 56 | home.activation = { |
| 57 | # The folders above were links into the checkout. Home Manager checks for |
| 58 | # files in its way before it removes old links, so through such a link it |
| 59 | # would find the checkout's own files (waybar/eww, hypr/scripts) and move |
| 60 | # them aside in the repo. Remove the old links first; afterwards these are |
| 61 | # real folders and this does nothing. |
| 62 | dropOldLinks = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ( |
| 63 | lib.concatMapStrings (name: '' |
| 64 | if [ -L "/" ]; then |
| 65 | run rm "/" |
| 66 | fi |
| 67 | '') oldLinks |
| 68 | ); |
| 69 | |
| 70 | seedConfigs = lib.hm.dag.entryAfter [ "writeBoundary" ] ( |
| 71 | lib.concatStrings ( |
| 72 | lib.mapAttrsToList (target: rel: '' |
| 73 | if [ ! -e "$HOME/" ]; then |
| 74 | run mkdir -p "$(dirname "$HOME/")" |
| 75 | run install -m644 "$HOME/" |
| 76 | fi |
| 77 | '') seeds |
| 78 | ) |
| 79 | ); |
| 80 | }; |
| 81 | } |