Flake for my NixOS devices

Using treefmt

bwc9876.dev 3fa4880e e99f6362

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