My entire NixOS config or something!
1{
2 inputs,
3 pkgs,
4 lib,
5 ...
6}:
7{
8 imports = [
9 inputs.nixvim.homeModules.nixvim
10 ];
11
12 home.stateVersion = "26.05";
13
14 programs.plasma = {
15 enable = true;
16 };
17
18 programs.bash.enable = true;
19
20 # Terminal tools
21 programs.yazi = {
22 enable = true;
23 enableBashIntegration = true; # Use 'y' in bash!
24 }; # programs.yazi
25 programs.ripgrep.enable = true;
26
27 programs.firefox = {
28 enable = true;
29
30 profiles.default = {
31 search = {
32 force = true;
33 engines =
34 let
35 mkEngineForceFavicon = aliases: queryUrl: iconUrl: {
36 definedAliases = aliases;
37 icon = iconUrl;
38 urls = [ { template = queryUrl; } ];
39 };
40 mkEngine =
41 aliases: queryUrl: iconExt:
42 (mkEngineForceFavicon aliases queryUrl (
43 let
44 noPath = lib.strings.concatStrings (
45 lib.strings.intersperse "/" (lib.lists.take 3 (lib.strings.splitString "/" queryUrl))
46 );
47 in
48 "${noPath}/favicon.${iconExt}"
49 ));
50 mkModrinth =
51 aliases: type: mkEngine aliases "https://modrinth.com/discover/${type}?q={searchTerms}" "ico";
52 in
53 {
54 # Dev
55 "GitHub Repos" =
56 mkEngineForceFavicon [ "@gh" "@github" ]
57 "https://github.com/search?type=repositories&q={searchTerms}"
58 "https://github.githubassets.com/favicons/favicon-dark.svg";
59
60 "SourceGraph" = mkEngine [
61 "@sg"
62 "@sourcegraph"
63 ] "https://sourcegraph.com/search?q={searchTerms}" "png";
64
65 ## Web
66 "MDN Web Docs" = mkEngine [
67 "@mdn"
68 ] "https://developer.mozilla.org/en-US/search?q={searchTerms}" "ico";
69 "Can I Use" = mkEngineForceFavicon [
70 "@ciu"
71 "@baseline"
72 ] "https://caniuse.com/?search={searchTerms}" "https://caniuse.com/img/favicon-128.png";
73 "NPM" = mkEngine [ "@npm" ] "https://www.npmx.dev/search?q={searchTerms}" "ico";
74 "Iconify" = mkEngine [
75 "@iconify"
76 "@icons"
77 ] "https://icon-sets.iconify.design/?query={searchTerms}" "ico";
78 "Astro" = mkEngineForceFavicon [
79 "@astro"
80 ] "https://a.stro.cc/{searchTerms}" "https://docs.astro.build/favicon.svg";
81 "Porkbun" = mkEngine [ "@porkbun" ] "https://porkbun.com/checkout/search?q={searchTerms}" "ico";
82 "Http.Cat" = mkEngine [ "@cat" "@hcat" "@httpcat" ] "https://http.cat/{searchTerms}" "ico";
83
84 ## Rust
85 "Crates.io" = mkEngine [
86 "@crates"
87 "@cratesio"
88 "@cargo"
89 ] "https://crates.io/search?q={searchTerms}" "ico";
90 "Rust Docs" =
91 mkEngineForceFavicon [ "@rust" "@rustdocs" "@ruststd" ]
92 "https://doc.rust-lang.org/std/index.html?search={searchTerms}"
93 "https://doc.rust-lang.org/static.files/favicon-2c020d218678b618.svg";
94 "Docsrs" = mkEngine [ "@docsrs" ] "https://docs.rs/releases/search?query={searchTerms}" "ico";
95
96 ## Python
97 "PyPI" = mkEngineForceFavicon [
98 "@pypi"
99 "@pip"
100 ] "https://pypi.org/search/?q={searchTerms}" "https://pypi.org/static/images/favicon.35549fe8.ico";
101
102 ## .NET
103 "NuGet" = mkEngine [ "@nuget" ] "https://www.nuget.org/packages?q={searchTerms}" "ico";
104
105 ## Linux Stuff
106 "Kernel Docs" = mkEngine [
107 "@lnx"
108 "@linux"
109 "@kernel"
110 ] "https://www.kernel.org/doc/html/latest/search.html?q={searchTerms}" "ico";
111 "Arch Wiki" = mkEngine [
112 "@aw"
113 "@arch"
114 ] "https://wiki.archlinux.org/index.php?title=Special%3ASearch&search={searchTerms}" "ico";
115 "Nerd Fonts" =
116 mkEngineForceFavicon [ "@nf" "@nerdfonts" ] "https://www.nerdfonts.com/cheat-sheet?q={searchTerms}"
117 "https://www.nerdfonts.com/assets/img/favicon.ico";
118
119 ### Haskell
120 "Hoogle Base" = mkEngine [
121 "@h"
122 "@hoogle"
123 ] "https://hoogle.haskell.org/?scope=package%3Abase&hoogle={searchTerms}" "png";
124 "Hoogle All" = mkEngine [
125 "@ha"
126 "@hoogall"
127 ] "https://hoogle.haskell.org/?hoogle={searchTerms}" "png";
128
129 ### Nix
130 "Nix Packages" = mkEngine [
131 "@nixpkgs"
132 ] "https://search.nixos.org/packages?channel=unstable&size=500&query={searchTerms}" "png";
133 "NixOS Options" = mkEngine [
134 "@nixos"
135 ] "https://search.nixos.org/options?channel=unstable&size=500&query={searchTerms}" "png";
136 "NixOS Wiki" = mkEngine [ "@nixwiki" ] "https://nixos.wiki/index.php?search={searchTerms}" "png";
137 "Home Manager Options" =
138 mkEngineForceFavicon [ "@hm" ]
139 "https://home-manager-options.extranix.com/?release=master&query={searchTerms}"
140 "https://home-manager-options.extranix.com/images/favicon.png";
141 "Noogle" = mkEngine [
142 "@noogle"
143 "@nixlib"
144 ] "https://noogle.dev/q?limit=100&term={searchTerms}" "png";
145 "SourceGraph Nix" =
146 mkEngine [ "@sgn" "@yoink" ]
147 "https://sourcegraph.com/search?q=lang:Nix+-repo:NixOS/*+-repo:nix-community/*+{searchTerms}"
148 "png";
149 "Nixpkgs Issues" =
150 mkEngineForceFavicon [ "@nixissues" ]
151 "https://github.com/NixOS/nixpkgs/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen+{searchTerms}"
152 "https://github.githubassets.com/favicons/favicon-dark.svg";
153 "NixVim Options" =
154 mkEngineForceFavicon [ "@nixvim" ]
155 "https://nix-community.github.io/nixvim/search/?option_scope=0&query={searchTerms}"
156 "https://nix-community.github.io/nixvim/search/favicon.ico";
157
158 # Media
159 "youtube" = mkEngine [ "@yt" ] "https://www.youtube.com/results?search_query={searchTerms}" "ico";
160 "Spotify" =
161 mkEngineForceFavicon [ "@sp" "@spotify" ] "https://open.spotify.com/search/{searchTerms}"
162 "https://open.spotifycdn.com/cdn/images/favicon16.1c487bff.png";
163 "Netflix" = mkEngine [ "@nfx" ] "https://www.netflix.com/search?q={searchTerms}" "ico";
164 "IMDb" = mkEngine [ "@imdb" ] "https://www.imdb.com/find?q={searchTerms}" "ico";
165
166 # Minecraft
167 "Modrinth" = mkModrinth [ "@mr" ] "mods";
168 "Modrinth Resource Packs" = mkModrinth [ "@mrr" ] "resourcepacks";
169 "Modrinth Data Packs" = mkModrinth [ "@mrd" ] "datapacks";
170
171 # Misc
172 "Firefox Add-ons" = mkEngine [
173 "@addons"
174 ] "https://addons.mozilla.org/en-US/firefox/search/?q={searchTerms}" "ico";
175 "Urban Dictionary" = mkEngine [
176 "@ud"
177 "@urban"
178 ] "https://www.urbandictionary.com/define.php?term={searchTerms}" "ico";
179 "Google Translate" = mkEngine [
180 "@translate"
181 ] "https://translate.google.com/?sl=auto&tl=en&text={searchTerms}&op=translate" "ico";
182
183 # Overrides
184 "History".metaData.alias = "@h";
185 "Bookmarks".metaData.alias = "@b";
186 "Tabs".metaData.alias = "@t";
187 "bing".metaData.hidden = true;
188 "amazondotcom-us".metaData.alias = "@amz";
189 "google".metaData.alias = "@g";
190 "wikipedia".metaData.alias = "@w";
191 "ddg".metaData.alias = "@ddg";
192 }; # end of let-in for search
193 }; # programs.firefox.profiles.default.search
194 }; # programs.firefox.profiles.default
195 policies = {
196 ExtensionSettings = {
197 "uBlock0@raymondhill.net" = {
198 install_url = "https://addons.mozilla.org/firefox/downloads/latest/uBlock0@raymondhill.net/latest.xpi";
199 installation_mode = "force_installed";
200 }; # uBlock settings
201 "{a9c2ad37-e940-4892-8dce-cd73c6cbbc0c}" = {
202 install_url = "https://addons.mozilla.org/firefox/downloads/latest/{a9c2ad37-e940-4892-8dce-cd73c6cbbc0c}/latest.xpi";
203 installation_mode = "force_installed";
204 }; # Feedbro settings
205 }; # programs.firefox.policies.ExtensionSettings
206 }; # programs.firefox.policies
207 }; # programs.firefox
208
209 # Neovim config with nixvim
210 programs.nixvim = {
211 enable = true;
212 defaultEditor = true;
213 viAlias = true;
214 vimAlias = true;
215 colorschemes.catppuccin.enable = true;
216 colorschemes.catppuccin.autoLoad = true;
217 plugins.lspconfig.enable = true;
218 plugins.treesitter = {
219 enable = true;
220 settings = {
221 highlight.enable = true;
222 };
223 };
224 lsp = {
225 servers.ruff.enable = true; # Python
226 servers.rust_analyzer.enable = true; # Rust
227 servers.tinymist.enable = true; # Typst
228 servers.html.enable = true;
229 servers.typos_lsp.enable = true; # Language typos
230 servers.emmet_language_server.enable = true; # Emmet
231 };
232 plugins.lspsaga.enable = true;
233 plugins.web-devicons.enable = true;
234 plugins.dropbar.enable = true;
235 plugins.guess-indent.enable = true;
236 plugins.conform-nvim = {
237 enable = true;
238 autoInstall.enable = true;
239 settings.formatters_by_ft = {
240 nix = [ "nixfmt" ];
241 python = [ "ruff_format" ];
242 rust = [ "rustfmt" ];
243 typst = [ "typstyle" ];
244 html = [ "prettier" ];
245 typescriptreact = [ "oxfmt" ];
246 lua = [ "stylua" ];
247 css = [ "prettier" ];
248 java = [ "google-java-format" ];
249 };
250 luaConfig.post = ''
251 vim.api.nvim_create_user_command("Format", function(args)
252 local range = nil
253 if args.count ~= -1 then
254 local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
255 range = {
256 start = { args.line1, 0 },
257 ["end"] = { args.line2, end_line:len() },
258 }
259 end
260 require("conform").format({ async = true, lsp_format = "fallback", range = range })
261 end, { range = true })
262 '';
263 };
264 plugins.cmp = {
265 enable = true;
266 autoEnableSources = true; # Scans the settings.sources array, enabling if available
267 settings = {
268 sources = [
269 { name = "nvim_lsp"; }
270 { name = "path"; }
271 { name = "buffer"; }
272 { name = "spell"; }
273 ];
274
275 mapping = {
276 "<Tab>" = "cmp.mapping.confirm({ select = true })";
277 "<C-k>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
278 "<C-j>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
279 };
280 };
281 };
282 plugins.toggleterm = {
283 enable = true;
284 settings.open_mapping = "[[<C-\\>]]";
285 };
286 };
287
288 # VCS
289 programs.jujutsu = {
290 enable = true;
291 settings = {
292 user = {
293 name = "Demetrius Semanko";
294 email = "demetrius@demsem.dev";
295 };
296 ui = {
297 default-command = [
298 "log"
299 "--reversed"
300 "-r"
301 "ancestors(@, 10)"
302 ];
303 editor = "nvim";
304 };
305 aliases = {
306 "dm" = [
307 "desc"
308 "-m"
309 ];
310 };
311 };
312 };
313 # Git
314 programs.git.enable = true;
315 # GitHub
316 programs.gh = {
317 enable = true;
318 settings = {
319 git_protocol = "ssh";
320 };
321 hosts = {
322 "github.com" = {
323 user = "DemetriusSemanko";
324 };
325 };
326 };
327
328 # Compilers, whatever
329 programs.gcc.enable = true;
330 programs.java.enable = true;
331 programs.cargo.enable = true;
332 programs.npm.enable = true;
333
334 # Nix-specific
335 programs.nh = {
336 enable = true;
337 clean = {
338 enable = true;
339 dates = "weekly";
340 }; # programs.nh.clean
341 }; # programs.nh
342
343 home.packages = [
344 pkgs.nix-inspect
345 pkgs.nerd-fonts.fira-code
346 pkgs.newcomputermodern
347 pkgs.ghc
348 pkgs.haskellPackages.QuickCheck
349 ];
350}