Flake for my NixOS devices

Using treefmt

bwc9876.dev 3fa4880e e99f6362

verified
+152 -105
+44
flake.lock
··· 228 228 "type": "github" 229 229 } 230 230 }, 231 + "flakelight-treefmt": { 232 + "inputs": { 233 + "flakelight": [ 234 + "flakelight" 235 + ], 236 + "treefmt-nix": "treefmt-nix" 237 + }, 238 + "locked": { 239 + "lastModified": 1768308527, 240 + "narHash": "sha256-u4U7H+LQ1UBBK7OcyTqmxJ3WSQYCrk+DHhDUcfvAb/c=", 241 + "owner": "m15a", 242 + "repo": "flakelight-treefmt", 243 + "rev": "f21f17f1df3f96cb812c64853fc6687bc1e7d1e9", 244 + "type": "github" 245 + }, 246 + "original": { 247 + "owner": "m15a", 248 + "repo": "flakelight-treefmt", 249 + "type": "github" 250 + } 251 + }, 231 252 "flakelight_2": { 232 253 "inputs": { 233 254 "nixpkgs": [ ··· 737 758 "catppuccin": "catppuccin", 738 759 "fenix": "fenix", 739 760 "flakelight": "flakelight_2", 761 + "flakelight-treefmt": "flakelight-treefmt", 740 762 "gh-grader-preview": "gh-grader-preview", 741 763 "hm": "hm", 742 764 "imperm": "imperm", ··· 852 874 "original": { 853 875 "owner": "nix-systems", 854 876 "repo": "default", 877 + "type": "github" 878 + } 879 + }, 880 + "treefmt-nix": { 881 + "inputs": { 882 + "nixpkgs": [ 883 + "flakelight-treefmt", 884 + "flakelight", 885 + "nixpkgs" 886 + ] 887 + }, 888 + "locked": { 889 + "lastModified": 1768158989, 890 + "narHash": "sha256-67vyT1+xClLldnumAzCTBvU0jLZ1YBcf4vANRWP3+Ak=", 891 + "owner": "numtide", 892 + "repo": "treefmt-nix", 893 + "rev": "e96d59dff5c0d7fddb9d113ba108f03c3ef99eca", 894 + "type": "github" 895 + }, 896 + "original": { 897 + "owner": "numtide", 898 + "repo": "treefmt-nix", 855 899 "type": "github" 856 900 } 857 901 },
+12 -4
flake.nix
··· 5 5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 6 flakelight.url = "github:nix-community/flakelight"; 7 7 flakelight.inputs.nixpkgs.follows = "nixpkgs"; 8 + flakelight-treefmt.url = "github:m15a/flakelight-treefmt"; 9 + flakelight-treefmt.inputs.flakelight.follows = "flakelight"; 8 10 nix-index-db.url = "github:nix-community/nix-index-database"; 9 11 nix-index-db.inputs.nixpkgs.follows = "nixpkgs"; 10 12 hm.url = "github:nix-community/home-manager"; ··· 47 49 self, 48 50 nixpkgs, 49 51 flakelight, 52 + flakelight-treefmt, 50 53 nix-index-db, 51 54 hm, 52 55 nixos-hardware, ··· 64 67 musnix, 65 68 }: 66 69 flakelight ./. { 70 + inherit inputs; 67 71 imports = [ 72 + flakelight-treefmt.flakelightModules.default 68 73 spoon.flakelightModules.repl 69 74 spoon.flakelightModules.ubercheck 70 75 ]; 71 - inherit inputs; 72 - formatters = pkgs: { 73 - "*.nix" = "alejandra ."; 74 - "*.sh" = "shfmt -w ."; 76 + 77 + treefmtConfig = {pkgs, ...}: { 78 + programs = { 79 + alejandra.enable = true; 80 + just.enable = true; 81 + shfmt.enable = true; 82 + }; 75 83 }; 76 84 77 85 nixDir = ./.;
+12 -15
homeModules/nvim.nix
··· 51 51 no_italics = false; 52 52 term_colors = true; 53 53 integrations = { 54 - alpha = true; 55 - dropbar.enabled = true; 56 54 fidget = true; 57 55 markdown = true; 58 - dap = true; 59 56 ufo = true; 60 57 rainbow_delimiters = true; 61 58 lsp_trouble = true; ··· 368 365 options.desc = "Recent Files"; 369 366 } 370 367 { 371 - key = "f"; 368 + key = "l"; 372 369 action = "live_grep"; 373 370 options.desc = "Live Grep"; 374 371 } ··· 534 531 # Color-coded matching symbols 535 532 rainbow-delimiters.enable = true; 536 533 537 - # dropbar = { 538 - # enable = true; 539 - # settings = { 540 - # bar.padding.right = 5; 541 - # bar.padding.left = 1; 542 - # }; 543 - # }; 544 - 545 534 # Line number column + LSP + folding + etc. 546 535 statuscol = { 547 536 enable = true; ··· 710 699 # Formatting code using multiple providers 711 700 conform-nvim = { 712 701 enable = true; 713 - settings.default_format_opts = { 714 - lsp_format = "prefer"; 702 + settings = { 703 + formatters.treefmt = { 704 + require_cwd = false; 705 + }; 706 + formatters_by_ft = { 707 + "*" = ["treefmt"]; 708 + }; 709 + default_format_opts = { 710 + lsp_format = "fallback"; 711 + }; 715 712 }; 716 713 # Taken from https://github.com/stevearc/conform.nvim/blob/master/doc/recipes.md#format-command 717 714 luaConfig.post = '' ··· 724 721 ["end"] = { args.line2, end_line:len() }, 725 722 } 726 723 end 727 - require("conform").format({ async = true, lsp_format = "fallback", range = range }) 724 + require("conform").format({ range = range, timeout_ms = 5000 }) 728 725 end, { range = true }) 729 726 ''; 730 727 };
+12 -14
justfile
··· 1 - GARGS := if env("SPOON_PATH", "") != "" {"--override-input spoon \"$SPOON_PATH\""} else { "" } 1 + GARGS := if env("SPOON_PATH", "") != "" { "--override-input spoon \"$SPOON_PATH\"" } else { "" } 2 2 3 3 _default: 4 4 @{{ just_executable() }} --list --unsorted --justfile {{ justfile() }} 5 5 6 - [private] 7 6 alias u := update 7 + 8 8 # u: update all inputs 9 9 update: 10 10 nix flake update 11 11 12 - [private] 13 12 alias b := build 13 + 14 14 # b: build the configuration 15 15 build: 16 16 nh os build -k . {{ GARGS }} 17 17 18 - [private] 19 18 alias bt := boot 19 + 20 20 # bt: make the configuration the boot default without activating it 21 21 boot: 22 22 nh os boot -k . {{ GARGS }} 23 23 24 - [private] 25 24 alias s := switch 25 + 26 26 # s: activate configuration & add to boot menu 27 - switch: 27 + switch: 28 28 nh os switch -k --ask . {{ GARGS }} 29 29 30 - [private] 31 30 alias c := check 31 + 32 32 # c: run all checks for the current system 33 33 check *ARGS: 34 34 nom build --show-trace ".#uberCheck.$(nix eval --impure --raw --expr 'builtins.currentSystem')" --keep-going {{ GARGS }} {{ ARGS }} 35 35 36 - [private] 37 36 alias d := deploy 37 + 38 38 # d: deploy the given host 39 39 deploy ACTION="switch" HOST="black-mesa": 40 40 NIX_SSHOPTS="-p 8069" nixos-rebuild {{ ACTION }} --flake .#{{ HOST }} --build-host {{ HOST }}.lan --target-host {{ HOST }}.lan --sudo --override-input spoon "git+https://codeberg.org/spoonbaker/mono?ref=devel" --refresh 41 41 42 - [private] 43 42 alias f := format 43 + 44 44 # f: format this flake 45 45 format: 46 46 nix fmt 47 47 48 - [private] 49 48 alias r := repl 49 + 50 50 # r: start a debugging repl 51 51 repl: 52 52 nix repl {{ GARGS }} .#repl 53 53 54 - [private] 55 54 alias gc := garbage-collect 55 + 56 56 # gc: run a garbage collection 57 57 garbage-collect: 58 58 nh clean all 59 59 60 - [private] 61 60 alias iso := generate-iso 61 + 62 62 generate-iso: 63 63 nom build .#nixosConfigurations.installer.config.system.build.isoImage 64 - 65 -
+72 -72
res/waybar.css
··· 1 1 @import "catppuccin.css"; 2 2 3 3 * { 4 - font-family: sans-serif; 4 + font-family: sans-serif; 5 5 } 6 6 7 7 window#waybar { 8 - background: rgba(49, 50, 68, 0.65); 9 - color: @text; 8 + background: rgba(49, 50, 68, 0.65); 9 + color: @text; 10 10 } 11 11 12 - .modules-left>*>*, 13 - .modules-right>*>* { 14 - font-size: 1.5rem; 15 - background: @crust; 16 - border: 2px solid @base; 17 - border-radius: 5rem; 18 - padding: 5px 15px; 19 - margin: 5px 2px; 12 + .modules-left > * > *, 13 + .modules-right > * > * { 14 + font-size: 1.5rem; 15 + background: @crust; 16 + border: 2px solid @base; 17 + border-radius: 5rem; 18 + padding: 5px 15px; 19 + margin: 5px 2px; 20 20 } 21 21 22 22 #bluetooth.disabled { 23 - border-color: @red; 23 + border-color: @red; 24 24 } 25 25 26 - #waybar .modules-left>*:first-child>* { 27 - margin-left: 25px; 26 + #waybar .modules-left > *:first-child > * { 27 + margin-left: 25px; 28 28 } 29 29 30 - #waybar .modules-right>*:last-child>* { 31 - margin-right: 25px; 30 + #waybar .modules-right > *:last-child > * { 31 + margin-right: 25px; 32 32 } 33 33 34 34 #waybar .modules-left, 35 35 #waybar .modules-right { 36 - margin-top: 10px; 37 - margin-bottom: 5px; 36 + margin-top: 10px; 37 + margin-bottom: 5px; 38 38 } 39 39 40 40 #waybar .modules-center { 41 - margin-top: 5px; 42 - margin-bottom: 5px; 41 + margin-top: 5px; 42 + margin-bottom: 5px; 43 43 } 44 44 45 45 #battery.warning { 46 - border-color: @yellow; 46 + border-color: @yellow; 47 47 } 48 48 49 49 #battery.critical { 50 - border-color: @red; 50 + border-color: @red; 51 51 } 52 52 53 - *>#battery.charging { 54 - border-color: @green; 53 + * > #battery.charging { 54 + border-color: @green; 55 55 } 56 56 57 57 #taskbar, 58 58 #workspaces { 59 - padding: 10px; 60 - border-radius: 5rem; 61 - border: none; 62 - background: none; 59 + padding: 10px; 60 + border-radius: 5rem; 61 + border: none; 62 + background: none; 63 63 } 64 64 65 65 #taskbar button, 66 66 #workspaces button { 67 - color: @text; 68 - border-radius: 5rem; 69 - padding: 5px 15px; 70 - margin: 0 5px; 71 - background: @crust; 72 - border: 2px solid @base; 67 + color: @text; 68 + border-radius: 5rem; 69 + padding: 5px 15px; 70 + margin: 0 5px; 71 + background: @crust; 72 + border: 2px solid @base; 73 73 } 74 74 75 75 #taskbar button:hover, 76 76 #workspaces button:hover { 77 - background: @mantle; 77 + background: @mantle; 78 78 } 79 79 80 80 #workspaces button { 81 - font-size: 1.5rem; 81 + font-size: 1.5rem; 82 82 } 83 83 84 84 #cpu, 85 85 #memory, 86 86 #temperature { 87 - font-size: 1.5rem; 88 - padding: 10px 25px; 87 + font-size: 1.5rem; 88 + padding: 10px 25px; 89 89 } 90 90 91 91 #cpu.warning, 92 92 #memory.warning { 93 - border-color: @yellow; 93 + border-color: @yellow; 94 94 } 95 95 96 96 #cpu.critical, 97 97 #memory.critical, 98 98 #temperature.critical { 99 - border-color: @red; 99 + border-color: @red; 100 100 } 101 101 102 102 #workspaces button.active { 103 - border: 2px solid @sapphire; 103 + border: 2px solid @sapphire; 104 104 } 105 105 106 106 #taskbar button.active { 107 - border: 2px solid @sapphire; 107 + border: 2px solid @sapphire; 108 108 } 109 109 110 110 #idle_inhibitor.activated { 111 - border-color: @mauve; 111 + border-color: @mauve; 112 112 } 113 113 114 114 #custom-notification.notification { 115 - border-color: @sapphire; 115 + border-color: @sapphire; 116 116 } 117 117 118 118 #custom-notification.dnd-none, 119 119 #custom-notification.dnd-notification, 120 120 #custom-notification.dnd-inhibited-none, 121 121 #custom-notification.dnd-inhibited-notification { 122 - border-color: @red; 122 + border-color: @red; 123 123 } 124 124 125 125 #custom-notification.inhibited-none, 126 126 #custom-notification.inhibited-notification { 127 - border-color: @mauve; 127 + border-color: @mauve; 128 128 } 129 129 130 130 #network.disconnected { 131 - border-color: @red; 131 + border-color: @red; 132 132 } 133 133 134 134 #privacy { 135 - background: none; 136 - border: none; 137 - margin: 0; 138 - padding: 0; 135 + background: none; 136 + border: none; 137 + margin: 0; 138 + padding: 0; 139 139 } 140 140 141 141 #privacy-item { 142 - font-size: 1.5rem; 143 - border-radius: 5rem; 144 - padding: 5px 15px; 145 - margin: 5px 2px; 146 - border: 2px solid @red; 147 - background-color: @crust; 142 + font-size: 1.5rem; 143 + border-radius: 5rem; 144 + padding: 5px 15px; 145 + margin: 5px 2px; 146 + border: 2px solid @red; 147 + background-color: @crust; 148 148 } 149 149 150 150 #custom-weather.VeryCloudy, 151 151 #custom-weather.Cloudy, 152 152 #custom-weather.Fog { 153 - border-color: @overlay0; 153 + border-color: @overlay0; 154 154 } 155 155 156 156 #custom-weather.HeavyRain, ··· 160 160 #custom-weather.HeavyShowers, 161 161 #custom-weather.LightRain, 162 162 #custom-weather.LightShowers { 163 - border-color: @blue; 163 + border-color: @blue; 164 164 } 165 165 166 166 #custom-weather.HeavySnow, ··· 169 169 #custom-weather.Snow, 170 170 #custom-weather.LightSnowShowers, 171 171 #custom-weather.LightSleetShowers { 172 - border-color: @text; 172 + border-color: @text; 173 173 } 174 174 175 175 #custom-weather.Clear, 176 176 #custom-weather.Sunny { 177 - border-color: @yellow; 177 + border-color: @yellow; 178 178 } 179 179 180 180 #custom-weather.PartlyCloudy { 181 - border-color: @flamingo; 181 + border-color: @flamingo; 182 182 } 183 183 184 184 #custom-weather.PartlyCloudy.night { 185 - border-color: @lavender; 185 + border-color: @lavender; 186 186 } 187 187 188 188 #custom-weather.Clear.night, 189 189 #custom-weather.Sunny.night { 190 - border-color: @mauve; 190 + border-color: @mauve; 191 191 } 192 192 193 193 #custom-news.utd { 194 - font-size: 1.5rem; 194 + font-size: 1.5rem; 195 195 } 196 196 197 197 #custom-news.unread { 198 - border-color: @sapphire; 198 + border-color: @sapphire; 199 199 } 200 200 201 201 #mpris { 202 - opacity: 0; 202 + opacity: 0; 203 203 } 204 204 205 205 #mpris.paused { 206 - opacity: 1; 206 + opacity: 1; 207 207 } 208 208 209 209 #mpris.playing { 210 - opacity: 1; 211 - border-color: @sapphire; 210 + opacity: 1; 211 + border-color: @sapphire; 212 212 } 213 213 214 214 #mpris.playing.spotify { 215 - border-color: #33B980; 215 + border-color: #33b980; 216 216 } 217 217 218 218 #mpris.paused.kdeconnect { 219 - opacity: 0; 219 + opacity: 0; 220 220 }