dot

vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks

95 lines3714 bytesNix
1# The config files in ../../config, put where the programs read them. This
2# replaces symlink.sh from the old dotfiles repo.
3{
4 config,
5 lib,
6 pkgs,
7 ...
8}:
9let
10 cfg = config.dot;
11
12 # A file or directory of config/: linked to the checkout when liveConfig is
13 # on (edits apply at once), copied into the store otherwise.
14 link =
15 rel:
16 if cfg.liveConfig then
17 config.lib.file.mkOutOfStoreSymlink "${cfg.repoPath}/config/${rel}"
18 else
19 ../../config + "/${rel}";
20
21 # Configs the programs write themselves (GOverlay, btop, micro, apps that
22 # register URL handlers): copied in only when missing, and never overwritten,
23 # so changes made in the app stick. Your existing files in /home win.
24 seeds = {
25 ".config/btop/btop.conf" = "btop/btop.conf";
26 ".config/MangoHud/MangoHud.conf" = "MangoHud/MangoHud.conf";
27 ".config/vkBasalt/vkBasalt.conf" = "vkBasalt/vkBasalt.conf";
28 ".config/vkSumi/vkSumi.conf" = "vkSumi/vkSumi.conf";
29 ".config/micro/settings.json" = "micro/settings.json";
30 ".config/micro/bindings.json" = "micro/bindings.json";
31 ".config/mimeapps.list" = "mimeapps.list";
32 };
33in
34{
35 xdg.configFile = {
36 "hypr".source = link "hypr";
37 "waybar".source = link "waybar";
38 "dunst".source = link "dunst";
39 "kitty".source = link "kitty";
40 "fuzzel".source = link "fuzzel";
41 "nvim".source = link "nvim";
42 "qt6ct".source = link "qt6ct";
43 "kdeglobals".source = link "kde/kdeglobals";
44 "philly/theme.css".source = link "philly/theme.css";
45
46 # Kvantum: the active theme is KvArcDark# (your customised copy of KvArcDark,
47 # made with Kvantum Manager; it uses the stock theme's artwork). RiceDark is
48 # the tweaked theme from the old repo, with the stock KvArcDark artwork
49 # copied in under its name, as kvantum/install.sh did.
50 "Kvantum/kvantum.kvconfig".source = link "kvantum/kvantum.kvconfig";
51 "Kvantum/KvArcDark#/KvArcDark#.kvconfig".source = link "kvantum/KvArcDark#.kvconfig";
52 "Kvantum/RiceDark/RiceDark.kvconfig".source = link "kvantum/RiceDark.kvconfig";
53 "Kvantum/RiceDark/RiceDark.svg".source =
54 "${pkgs.kdePackages.qtstyleplugin-kvantum}/share/Kvantum/KvArcDark/KvArcDark.svg";
55
56 "micro/colorschemes".source = ../../config/micro/colorschemes;
57 };
58
59 home.file.".p10k.zsh".source = link "zsh/p10k.zsh";
60
61 home.activation = {
62 seedConfigs = lib.hm.dag.entryAfter [ "writeBoundary" ] (
63 lib.concatStrings (
64 lib.mapAttrsToList (target: rel: ''
65 if [ ! -e "$HOME/${target}" ]; then
66 run mkdir -p "$(dirname "$HOME/${target}")"
67 run install -m644 ${../../config + "/${rel}"} "$HOME/${target}"
68 fi
69 '') seeds
70 )
71 );
72
73 # Firefox: user.js and userChrome.css in the default profile, which Firefox
74 # creates itself (Home Manager's own Firefox module would make a new profile
75 # and take over profiles.ini). Same as symlink.sh did.
76 firefoxProfile = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
77 ini="$HOME/.config/mozilla/firefox/profiles.ini"
78 if [ -f "$ini" ]; then
79 profile=$(${pkgs.gawk}/bin/awk -F= '
80 /^\[Install/ { install = 1; next }
81 /^\[/ { install = 0 }
82 install && $1 == "Default" { print $2; exit }
83 ' "$ini")
84 if [ -n "$profile" ]; then
85 dir="$HOME/.config/mozilla/firefox/$profile"
86 run mkdir -p "$dir/chrome"
87 run ln -sfn ${link "firefox/user.js"} "$dir/user.js"
88 run ln -sfn ${link "firefox/userChrome.css"} "$dir/chrome/userChrome.css"
89 fi
90 else
91 warnEcho "Firefox has no profile yet: start Firefox once, then run home-manager switch (or nixos-rebuild switch) again."
92 fi
93 '';
94 };
95}