From 7282fcd409ce48cf53ad61034fc232510b2785fd Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Fri, 8 Aug 2025 13:08:25 +0200 Subject: [PATCH 1/9] nvim: formatting and minor fixes --- .../nvim/lua/thegeneralist/lazy/blink.lua | 158 +++++++-------- .../nvim/lua/thegeneralist/lazy/init.lua | 187 +++++++++--------- .../nvim/lua/thegeneralist/lazy/lsp.lua | 1 - .../nvim/lua/thegeneralist/lazy/nullls.lua | 77 ++++---- .../dotfiles/nvim/lua/thegeneralist/remap.lua | 19 +- 5 files changed, 225 insertions(+), 217 deletions(-) diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua index 3fc3e92..dcdc4c3 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua @@ -1,84 +1,88 @@ return { - { - "saghen/blink.cmp", - dependencies = { "rafamadriz/friendly-snippets" }, - version = "1.*", - opts = { - -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) - -- 'super-tab' for mappings similar to vscode (tab to accept) - -- 'enter' for enter to accept - -- 'none' for no mappings - -- - -- All presets have the following mappings: - -- C-space: Open menu or open docs if already open - -- C-n/C-p or Up/Down: Select next/previous item - -- C-e: Hide menu - -- C-k: Toggle signature help (if signature.enabled = true) - -- - -- See :h blink-cmp-config-keymap for defining your own keymap - keymap = { preset = "default" }, + { + "saghen/blink.cmp", + dependencies = { "rafamadriz/friendly-snippets" }, + version = "1.*", + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + preset = "default", + [""] = { "select_and_accept" }, + [""] = { "select_next", "fallback_to_mappings" }, + }, - appearance = { - nerd_font_variant = "mono", - }, + appearance = { + nerd_font_variant = "mono", + }, - -- (Default) Only show the documentation popup when manually triggered - completion = { documentation = { auto_show = false } }, + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, - -- Default list of enabled providers defined so that you can extend it - -- elsewhere in your config, without redefining it, due to `opts_extend` - sources = { - default = { "lsp", "path", "snippets", "buffer" }, - }, + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, - -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance - -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, - -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` - -- - -- See the fuzzy documentation for more information - fuzzy = { implementation = "prefer_rust_with_warning" }, - }, - opts_extend = { "sources.default" }, - }, + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, + }, - -- { - -- 'neovim/nvim-lspconfig', - -- dependencies = { - -- 'saghen/blink.cmp', - -- 'williamboman/mason.nvim', - -- 'mason-org/mason-registry', - -- 'williamboman/mason-lspconfig.nvim', - -- 'L3MON4D3/LuaSnip', - -- 'saadparwaiz1/cmp_luasnip', - -- 'j-hui/fidget.nvim', - -- }, - -- - -- -- example using `opts` for defining servers - -- opts = { - -- servers = { - -- lua_ls = {} - -- } - -- }, - -- config = function(_, opts) - -- require("fidget").setup({}) - -- require("mason").setup() - -- - -- local lspconfig = require('mason-lspconfig') - -- for server, config in pairs(opts.servers) do - -- -- passing config.capabilities to blink.cmp merges with the capabilities in your - -- -- `opts[server].capabilities, if you've defined it - -- print('configuring server:', server) - -- config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) - -- require("lspconfig")[server].setup(config) - -- end - -- end - -- - -- example calling setup directly for each LSP - -- config = function() - -- local capabilities = require('blink.cmp').get_lsp_capabilities() - -- local lspconfig = require('lspconfig') - -- - -- lspconfig['lua_ls'].setup({ capabilities = capabilities }) - -- end - -- }, + -- { + -- 'neovim/nvim-lspconfig', + -- dependencies = { + -- 'saghen/blink.cmp', + -- 'williamboman/mason.nvim', + -- 'mason-org/mason-registry', + -- 'williamboman/mason-lspconfig.nvim', + -- 'L3MON4D3/LuaSnip', + -- 'saadparwaiz1/cmp_luasnip', + -- 'j-hui/fidget.nvim', + -- }, + -- + -- -- example using `opts` for defining servers + -- opts = { + -- servers = { + -- lua_ls = {} + -- } + -- }, + -- config = function(_, opts) + -- require("fidget").setup({}) + -- require("mason").setup() + -- + -- local lspconfig = require('mason-lspconfig') + -- for server, config in pairs(opts.servers) do + -- -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- -- `opts[server].capabilities, if you've defined it + -- print('configuring server:', server) + -- config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) + -- require("lspconfig")[server].setup(config) + -- end + -- end + -- + -- example calling setup directly for each LSP + -- config = function() + -- local capabilities = require('blink.cmp').get_lsp_capabilities() + -- local lspconfig = require('lspconfig') + -- + -- lspconfig['lua_ls'].setup({ capabilities = capabilities }) + -- end + -- }, } diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/init.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/init.lua index fb7a1a6..6cc7027 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/init.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/init.lua @@ -1,101 +1,106 @@ return { - { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - ---@module "ibl" - ---@type ibl.config - opts = {}, - }, - --[[ { + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + ---@module "ibl" + ---@type ibl.config + opts = {}, + }, + --[[ { 'boganworld/crackboard.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { session_key = 'redacted', }, }, ]] - { - "onsails/lspkind-nvim", - }, - -- { - -- "ziglang/zig.vim", - -- }, - { - "nvim-lua/plenary.nvim", - name = "plenary", - }, - { - "stevearc/oil.nvim", - config = function() - require("oil").setup() - end, - }, - -- { - -- -- https://github.com/zbirenbaum/copilot.lua - -- "zbirenbaum/copilot.lua", - -- cmd = "Copilot", - -- event = "InsertEnter", - -- config = function() - -- require("copilot").setup({ - -- panel = { - -- keymap = { - -- jump_prev = "]]", - -- jump_next = "[[", - -- accept = "", - -- refresh = "gr", - -- open = "", - -- }, - -- }, - -- suggestion = { - -- auto_trigger = true, - -- keymap = { - -- accept = "", - -- }, - -- }, - -- }) - -- -- vim.keymap.set("n", "cpe", "Copilot enable") - -- -- vim.keymap.set("n", "cpd", "Copilot disable") - -- end, - -- }, - { - "github/copilot.vim", - config = function() - -- set cpd and cpe to disable/enable copilot - vim.keymap.set("n", "cpe", "Copilot enable") - vim.keymap.set("n", "cpd", "Copilot disable") - end, - }, - -- { - -- "Exafunction/codeium.nvim", - -- dependencies = { - -- "nvim-lua/plenary.nvim", - -- "hrsh7th/nvim-cmp", - -- }, - -- config = function() - -- require("codeium").setup({ - -- -- https://github.com/Exafunction/codeium.vim - -- }) - -- end - -- }, - { - "ldelossa/gh.nvim", - dependencies = { - "ldelossa/litee.nvim", - }, - }, - "eandrju/cellular-automaton.nvim", - "gpanders/editorconfig.nvim", + { + "onsails/lspkind-nvim", + }, + -- { + -- "ziglang/zig.vim", + -- }, + { + "nvim-lua/plenary.nvim", + name = "plenary", + }, + { + "stevearc/oil.nvim", + config = function() + require("oil").setup() + end, + }, + -- { + -- -- https://github.com/zbirenbaum/copilot.lua + -- "zbirenbaum/copilot.lua", + -- cmd = "Copilot", + -- event = "InsertEnter", + -- config = function() + -- require("copilot").setup({ + -- panel = { + -- keymap = { + -- jump_prev = "]]", + -- jump_next = "[[", + -- accept = "", + -- refresh = "gr", + -- open = "", + -- }, + -- }, + -- suggestion = { + -- auto_trigger = true, + -- keymap = { + -- accept = "", + -- }, + -- }, + -- }) + -- -- vim.keymap.set("n", "cpe", "Copilot enable") + -- -- vim.keymap.set("n", "cpd", "Copilot disable") + -- end, + -- }, + { + "github/copilot.vim", + config = function() + -- set cpd and cpe to disable/enable copilot + vim.keymap.set("n", "cpe", "Copilot enable") + vim.keymap.set("n", "cpd", "Copilot disable") + vim.keymap.set("i", "", 'copilot#Accept("\\")', { + expr = true, + replace_keycodes = false, + }) + vim.g.copilot_no_tab_map = true + end, + }, + -- { + -- "Exafunction/codeium.nvim", + -- dependencies = { + -- "nvim-lua/plenary.nvim", + -- "hrsh7th/nvim-cmp", + -- }, + -- config = function() + -- require("codeium").setup({ + -- -- https://github.com/Exafunction/codeium.vim + -- }) + -- end + -- }, + { + "ldelossa/gh.nvim", + dependencies = { + "ldelossa/litee.nvim", + }, + }, + "eandrju/cellular-automaton.nvim", + "gpanders/editorconfig.nvim", - -- Useful for getting pretty icons, but requires a Nerd Font. - { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, - "lambdalisue/nerdfont.vim", - "junegunn/vim-easy-align", - "rcarriga/nvim-notify", + -- Useful for getting pretty icons, but requires a Nerd Font. + { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, + "lambdalisue/nerdfont.vim", + "junegunn/vim-easy-align", + "rcarriga/nvim-notify", - -- Highlight todo, notes, etc in comments - { - "folke/todo-comments.nvim", - event = "VimEnter", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { signs = false }, - }, + -- Highlight todo, notes, etc in comments + { + "folke/todo-comments.nvim", + event = "VimEnter", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { signs = false }, + }, } diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua index c094741..0f781d0 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua @@ -43,7 +43,6 @@ return { "ts_ls", "cssls", "tailwindcss", - "pyright", }, handlers = { function(server_name) -- default handler (optional) diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua index 7c30498..76b9b9c 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/nullls.lua @@ -5,47 +5,46 @@ These three tabs are necessary when dealing with this nonsense: - https://github.com/nvimtools/none-ls.nvim --]] return { - "jay-babu/mason-null-ls.nvim", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "williamboman/mason.nvim", - "nvimtools/none-ls.nvim", - "nvimtools/none-ls-extras.nvim", - }, - config = function() - local null_ls = require("null-ls") - require("mason-null-ls").setup({ - ensure_installed = { - "stylua", - "jq", - "mypy", - "ruff", - "black", - }, - handlers = { - ["mypy"] = function(source_name, methods) - local options = { - extra_args = function() - local command = "which python" - local handle = io.popen(command) - local python_path = "" - if handle then - python_path = handle:read("*a") - python_path = string.gsub(python_path, "\n", "") - handle:close() - end - return { "--python-executable", python_path } - end, - } - null_ls.register(null_ls.builtins.diagnostics.mypy.with(options)) - end, - --[[ ["ruff"] = function(source_name, methods) + "jay-babu/mason-null-ls.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "nvimtools/none-ls.nvim", + "nvimtools/none-ls-extras.nvim", + }, + config = function() + local null_ls = require("null-ls") + require("mason-null-ls").setup({ + ensure_installed = { + "stylua", + "jq", + "basedpyright", + "black", + }, + handlers = { + -- ["mypy"] = function(source_name, methods) + -- local options = { + -- extra_args = function() + -- local command = "which python" + -- local handle = io.popen(command) + -- local python_path = "" + -- if handle then + -- python_path = handle:read("*a") + -- python_path = string.gsub(python_path, "\n", "") + -- handle:close() + -- end + -- return { "--python-executable", python_path } + -- end, + -- } + -- null_ls.register(null_ls.builtins.diagnostics.mypy.with(options)) + -- end, + --[[ ["ruff"] = function(source_name, methods) null_ls.register(null_ls.builtins.diagnostics.ruff) --require('mason-null-ls').default_setup(source_name, methods) -- to maintain default behavior end, ]] - }, - }) + }, + }) - null_ls.setup() - end, + null_ls.setup() + end, } diff --git a/modules/dotfiles/nvim/lua/thegeneralist/remap.lua b/modules/dotfiles/nvim/lua/thegeneralist/remap.lua index 8766e4d..41b94c0 100755 --- a/modules/dotfiles/nvim/lua/thegeneralist/remap.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/remap.lua @@ -16,10 +16,10 @@ vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") vim.keymap.set("n", "vwm", function() - require("vim-with-me").StartVimWithMe() + require("vim-with-me").StartVimWithMe() end) vim.keymap.set("n", "svwm", function() - require("vim-with-me").StopVimWithMe() + require("vim-with-me").StopVimWithMe() end) vim.keymap.set("n", "vs", "v") @@ -54,19 +54,19 @@ vim.keymap.set("n", "vpp", "e ~/.dotfiles/nvim/.config/nvim/lua/the vim.keymap.set("n", "mr", "CellularAutomaton make_it_rain") vim.keymap.set("n", "", function() - vim.cmd("so") + vim.cmd("so") end) vim.keymap.set("n", "zh", "$viBhzf", { - desc = "Fold { block", + desc = "Fold { block", }) vim.keymap.set("n", "zj", "$vi[hzf", { - desc = "Fold [ block", + desc = "Fold [ block", }) vim.keymap.set("n", "zk", "$vibhzf", { - desc = "Fold ( block", + desc = "Fold ( block", }) vim.keymap.set("n", "ga", "EasyAlign") @@ -77,6 +77,7 @@ vim.keymap.set("v", "<", "", ">gv") -- Indent with tab +vim.keymap.set("i", "", "") vim.keymap.set("v", "", ">gv") vim.keymap.set("v", "", "", "e", "jq") vim.keymap.set("n", "w", function() - vim.ui.input({ prompt = "Enter value for shiftwidth: " }, function(input) - vim.o.shiftwidth = tonumber(input) - end) + vim.ui.input({ prompt = "Enter value for shiftwidth: " }, function(input) + vim.o.shiftwidth = tonumber(input) + end) end) -- vim.keymap.set("n", "tc", function() -- -- local file_number = tonumber(vim.fn.input("File number > "), 10) From d8a9db867c94cbb208941037daf118dd406f3c42 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Fri, 8 Aug 2025 13:08:37 +0200 Subject: [PATCH 2/9] packages: add `uv` and python type checkers --- modules/common/neovim.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/common/neovim.nix b/modules/common/neovim.nix index f753c06..020eac5 100644 --- a/modules/common/neovim.nix +++ b/modules/common/neovim.nix @@ -19,7 +19,10 @@ in { python313 python313Packages.pip + uv python313Packages.virtualenv + basedpyright + black nodejs nodePackages."sass" From 16afcd6838eb633b2c76d1fd91fe1ba5289727b0 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Sat, 4 Oct 2025 16:57:45 +0200 Subject: [PATCH 3/9] config: minor changes and fixes --- flake.lock | 6 +- .../thegeneralist-central/archive/default.nix | 2 +- hosts/thegeneralist-central/dns.nix | 71 +++++-------------- hosts/thegeneralist-central/site.nix | 2 +- modules/common/nix.nix | 2 +- modules/common/nushell/config.nu | 2 +- 6 files changed, 26 insertions(+), 59 deletions(-) diff --git a/flake.lock b/flake.lock index 6b223da..a158800 100644 --- a/flake.lock +++ b/flake.lock @@ -318,11 +318,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1751271578, - "narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=", + "lastModified": 1755186698, + "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df", + "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", "type": "github" }, "original": { diff --git a/hosts/thegeneralist-central/archive/default.nix b/hosts/thegeneralist-central/archive/default.nix index a19a6b0..0e8594a 100644 --- a/hosts/thegeneralist-central/archive/default.nix +++ b/hosts/thegeneralist-central/archive/default.nix @@ -5,7 +5,7 @@ let ssl = { forceSSL = true; quic = true; - useACMEHost = domain; + useACMEHost = acmeDomain; }; in { diff --git a/hosts/thegeneralist-central/dns.nix b/hosts/thegeneralist-central/dns.nix index e58bda0..73c537e 100644 --- a/hosts/thegeneralist-central/dns.nix +++ b/hosts/thegeneralist-central/dns.nix @@ -1,75 +1,42 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: let - internalZoneFile = pkgs.writeText "internal.zone" '' - $ORIGIN internal.thegeneralist01.com. - @ IN SOA ns.internal.thegeneralist01.com. thegeneralist01.proton.me. ( - 2025071801 ; serial (yyyymmddXX) + subdomains = [ "internal" "archive" "crawler" "r" "b" "s" "p" "q" "cloud" ]; + + mainZoneFile = pkgs.writeText "thegeneralist01.zone" '' + $ORIGIN thegeneralist01.com. + @ IN SOA ns.thegeneralist01.com. thegeneralist01.proton.me. ( + 2025081501 ; serial (yyyymmddXX) 3600 ; refresh 600 ; retry 86400 ; expire 3600 ; minimum ) - IN NS ns.internal.thegeneralist01.com. + IN NS ns.thegeneralist01.com. ns IN A 100.86.129.23 @ IN A 100.86.129.23 + ${lib.concatStringsSep "\n" (lib.map (sub: "${sub} IN A 100.86.129.23") subdomains)} ''; - archiveZoneFile = pkgs.writeText "archive.zone" '' - $ORIGIN archive.thegeneralist01.com. - @ IN SOA ns.archive.thegeneralist01.com. thegeneralist01.proton.me. ( - 2025073101 ; serial (yyyymmddXX) - 3600 ; refresh - 600 ; retry - 86400 ; expire - 3600 ; minimum - ) - IN NS ns.archive.thegeneralist01.com. - ns IN A 100.86.129.23 - @ IN A 100.86.129.23 - ''; - - crawlerZoneFile = pkgs.writeText "crawler.zone" '' - $ORIGIN crawler.thegeneralist01.com. - @ IN SOA ns.crawler.thegeneralist01.com. thegeneralist01.proton.me. ( - 2025080801 ; serial (yyyymmddXX) - 3600 ; refresh - 600 ; retry - 86400 ; expire - 3600 ; minimum - ) - IN NS ns.crawler.thegeneralist01.com. - ns IN A 100.86.129.23 - @ IN A 100.86.129.23 + forwarderBlock = '' + .:53 { + forward . 100.100.100.100 45.90.28.181 45.90.30.181 + cache + log + errors + } ''; in { services.coredns = { enable = true; config = '' - internal.thegeneralist01.com:53 { - file ${internalZoneFile} + thegeneralist01.com:53 { + file ${mainZoneFile} log errors } - archive.thegeneralist01.com:53 { - file ${archiveZoneFile} - log - errors - } - - crawler.thegeneralist01.com:53 { - file ${crawlerZoneFile} - log - errors - } - - .:53 { - forward . 100.100.100.100 45.90.28.181 45.90.30.181 - cache - log - errors - } + ${forwarderBlock} ''; }; diff --git a/hosts/thegeneralist-central/site.nix b/hosts/thegeneralist-central/site.nix index 6d9ebd4..2f2690b 100644 --- a/hosts/thegeneralist-central/site.nix +++ b/hosts/thegeneralist-central/site.nix @@ -14,7 +14,7 @@ in { package = pkgs.nginxQuic; enableQuicBPF = true; - recommendedZstdSettings = true; + experimentalZstdSettings = true; recommendedUwsgiSettings = true; recommendedTlsSettings = true; recommendedProxySettings = true; diff --git a/modules/common/nix.nix b/modules/common/nix.nix index b2e5528..130de89 100644 --- a/modules/common/nix.nix +++ b/modules/common/nix.nix @@ -25,7 +25,7 @@ in { "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; - trusted-users = [ "thegeneralist" "central" "root" "@build" "@wheel" "@admin" ]; + trusted-users = [ "thegeneralist" "central" "root" "@build" "@wheel" "@admin" "jellyfin" ]; builders-use-substitutes = true; }; diff --git a/modules/common/nushell/config.nu b/modules/common/nushell/config.nu index 9c9c02f..81d8a70 100644 --- a/modules/common/nushell/config.nu +++ b/modules/common/nushell/config.nu @@ -22,7 +22,7 @@ $env.config.completions = { enable: true max_results: 100 completer: {|tokens: list| - let expanded = scope aliases | where name == $tokens.0 | get --ignore-errors expansion.0 + let expanded = scope aliases | where name == $tokens.0 | get --optional expansion.0 mut expanded_tokens = if $expanded != null and $tokens.0 != "cd" { $expanded | split row " " | append ($tokens | skip 1) From f7168c0b2935d5940ec5ebea30976d234367084d Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Sun, 12 Oct 2025 16:44:42 +0200 Subject: [PATCH 4/9] small changes --- modules/common/ghostty.nix | 2 +- modules/common/rust.nix | 3 + modules/darwin/karabiner.nix | 110 ++-- modules/darwin/packages.nix | 2 +- .../nvim/lua/thegeneralist/lazy/blink.lua | 2 - .../nvim/lua/thegeneralist/lazy/lsp.lua | 542 +++++++++--------- 6 files changed, 351 insertions(+), 310 deletions(-) diff --git a/modules/common/ghostty.nix b/modules/common/ghostty.nix index 95fb7d8..dc2276d 100644 --- a/modules/common/ghostty.nix +++ b/modules/common/ghostty.nix @@ -11,7 +11,7 @@ clearDefaultKeybinds = false; settings = { # theme = "tokyonight"; - theme = "GruvboxDarkHard"; + theme = "Gruvbox Dark Hard"; font-family = "Berkeley Mono"; font-size = 16; diff --git a/modules/common/rust.nix b/modules/common/rust.nix index 134b8ae..354345b 100644 --- a/modules/common/rust.nix +++ b/modules/common/rust.nix @@ -26,6 +26,9 @@ nixfmt-rfc-style libiconv + + clang + clang-analyzer ]; }; } diff --git a/modules/darwin/karabiner.nix b/modules/darwin/karabiner.nix index c86c75c..5ae9ed1 100644 --- a/modules/darwin/karabiner.nix +++ b/modules/darwin/karabiner.nix @@ -1,18 +1,31 @@ let numbers = [ - "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" + "1" + "2" + "3" + "4" + "5" + "6" + "7" + "8" + "9" + "0" ]; number_to_symbol = num: { type = "basic"; from = { key_code = num; - modifiers = { optional = [ "caps_lock" ]; }; + modifiers = { + optional = [ "caps_lock" ]; + }; }; - to = [{ - key_code = num; - modifiers = ["left_shift"]; - }]; + to = [ + { + key_code = num; + modifiers = [ "left_shift" ]; + } + ]; }; symbol_to_number = num: { @@ -24,55 +37,80 @@ let optional = [ "caps_lock" ]; }; }; - to = [{ - key_code = num; - }]; + to = [ + { + key_code = num; + } + ]; }; - manipulators = builtins.concatLists (map (n: [ - (number_to_symbol n) - (symbol_to_number n) - ]) numbers); + manipulators = builtins.concatLists ( + map (n: [ + (number_to_symbol n) + (symbol_to_number n) + ]) numbers + ); simple_modifications = [ { from.apple_vendor_top_case_key_code = "keyboard_fn"; - to = [{ key_code = "left_control"; }]; + to = [ { key_code = "left_control"; } ]; } { from.key_code = "left_control"; - to = [{ apple_vendor_top_case_key_code = "keyboard_fn"; }]; + to = [ { apple_vendor_top_case_key_code = "keyboard_fn"; } ]; } ]; complex_modifications = { name = "Complex Modifications"; - rules = [{ - description = "Change numbers to symbols and vice versa"; - manipulators = manipulators; - }]; + rules = [ + # { + # description = "Change numbers to symbols and vice versa"; + # manipulators = manipulators; + # } + { + description = "Toggle Focus Mode with F6"; + manipulators = [ + { + from = { + "key_code" = "f6"; + }; + to = [ { "shell_command" = "shortcuts run 'Reduced Interruptions'"; } ]; + type = "basic"; + } + ]; + } + ]; }; config = builtins.toJSON { global.show_in_menu_bar = false; - profiles = [{ - name = "default"; - selected = true; - virtual_hid_keyboard.keyboard_type_v2 = "ansi"; - inherit simple_modifications; - inherit complex_modifications; + profiles = [ + { + name = "default"; + selected = true; + virtual_hid_keyboard.keyboard_type_v2 = "ansi"; + inherit simple_modifications; + inherit complex_modifications; - devices = [{ - identifiers.is_keyboard = true; - }]; - }]; + devices = [ + { + identifiers.is_keyboard = true; + } + ]; + } + ]; }; -in { - home-manager.sharedModules = [{ - home.file.".config/karabiner/karabiner.json" = { - force = true; - text = config; - }; - }]; +in +{ + home-manager.sharedModules = [ + { + home.file.".config/karabiner/karabiner.json" = { + force = true; + text = config; + }; + } + ]; } diff --git a/modules/darwin/packages.nix b/modules/darwin/packages.nix index 72b4f87..5be9f24 100644 --- a/modules/darwin/packages.nix +++ b/modules/darwin/packages.nix @@ -1,5 +1,5 @@ { pkgs, ... }: { homebrew.enable = true; - homebrew.casks = [ "ungoogled-chromium" ]; + homebrew.casks = [ "google-chrome" ]; environment.systemPackages = [ pkgs.iina ]; } diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua index dcdc4c3..e080021 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/blink.lua @@ -18,8 +18,6 @@ return { -- See :h blink-cmp-config-keymap for defining your own keymap keymap = { preset = "default", - [""] = { "select_and_accept" }, - [""] = { "select_next", "fallback_to_mappings" }, }, appearance = { diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua index 0f781d0..3c6d309 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/lsp.lua @@ -1,285 +1,287 @@ return { - { - "neovim/nvim-lspconfig", - dependencies = { - "saghen/blink.cmp", - -- "folke/neodev.nvim", - "williamboman/mason.nvim", - "mason-org/mason-registry", - "williamboman/mason-lspconfig.nvim", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - -- "hrsh7th/nvim-cmp", - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", - "j-hui/fidget.nvim", - }, - config = function() - local lspkind = require("lspkind") - -- local cmp = require("cmp") - -- local cmp_lsp = require("cmp_nvim_lsp") - -- local capabilities = vim.tbl_deep_extend( - -- "force", - -- {}, - -- vim.lsp.protocol.make_client_capabilities(), - -- cmp_lsp.default_capabilities() - -- ) + { + "neovim/nvim-lspconfig", + dependencies = { + "saghen/blink.cmp", + -- "folke/neodev.nvim", + "williamboman/mason.nvim", + "mason-org/mason-registry", + "williamboman/mason-lspconfig.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + -- "hrsh7th/nvim-cmp", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "j-hui/fidget.nvim", + }, + config = function() + local lspkind = require("lspkind") + -- local cmp = require("cmp") + -- local cmp_lsp = require("cmp_nvim_lsp") + -- local capabilities = vim.tbl_deep_extend( + -- "force", + -- {}, + -- vim.lsp.protocol.make_client_capabilities(), + -- cmp_lsp.default_capabilities() + -- ) - require("fidget").setup({}) - require("mason").setup() + require("fidget").setup({}) + require("mason").setup() - -- local vue_typescript_plugin = require("mason-registry") - -- .get_package("vue-language-server") - -- :get_install_path() .. "/node_modules/@vue/language-server" .. "/node_modules/@vue/typescript-plugin" + -- local vue_typescript_plugin = require("mason-registry") + -- .get_package("vue-language-server") + -- :get_install_path() .. "/node_modules/@vue/language-server" .. "/node_modules/@vue/typescript-plugin" - local capabilities = require("blink.cmp").get_lsp_capabilities() - vim.lsp.enable("nixd") - require("mason-lspconfig").setup({ - automatic_enable = true, - ensure_installed = { - "lua_ls", - "ts_ls", - "cssls", - "tailwindcss", - }, - handlers = { - function(server_name) -- default handler (optional) - -- if server_name == "rust_analyzer" then - -- return - -- end - require("lspconfig")[server_name].setup({ - capabilities = capabilities, - }) - end, + local capabilities = require("blink.cmp").get_lsp_capabilities() + vim.lsp.enable("nixd") + vim.lsp.enable("clangd") + vim.lsp.enable("basedpyright") + require("mason-lspconfig").setup({ + automatic_enable = true, + ensure_installed = { + "lua_ls", + "ts_ls", + "cssls", + "tailwindcss", + }, + handlers = { + function(server_name) -- default handler (optional) + -- if server_name == "rust_analyzer" then + -- return + -- end + require("lspconfig")[server_name].setup({ + capabilities = capabilities, + }) + end, - ["lua_ls"] = function() - local lspconfig = require("lspconfig") - lspconfig.lua_ls.setup({ - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { "vim", "it", "describe", "before_each", "after_each" }, - }, - }, - }, - }) - end, + ["lua_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = { "vim", "it", "describe", "before_each", "after_each" }, + }, + }, + }, + }) + end, - ["ts_ls"] = function() - local lspconfig = require("lspconfig") - lspconfig.ts_ls.setup({ - capabilities = capabilities, - -- settings = { - -- }, - -- init_options = { - -- plugins = { - -- { - -- name = "@vue/typescript-plugin", - -- location = vue_typescript_plugin, - -- languages = { "vue" }, - -- }, - -- }, - -- }, - filetypes = { - "javascript", - "javascriptreact", - "javascript.jsx", - "typescript", - "typescriptreact", - "typescript.tsx", - -- "vue", - }, - }) - end, - }, - }) + ["ts_ls"] = function() + local lspconfig = require("lspconfig") + lspconfig.ts_ls.setup({ + capabilities = capabilities, + -- settings = { + -- }, + -- init_options = { + -- plugins = { + -- { + -- name = "@vue/typescript-plugin", + -- location = vue_typescript_plugin, + -- languages = { "vue" }, + -- }, + -- }, + -- }, + filetypes = { + "javascript", + "javascriptreact", + "javascript.jsx", + "typescript", + "typescriptreact", + "typescript.tsx", + -- "vue", + }, + }) + end, + }, + }) - vim.api.nvim_create_autocmd("LspAttach", { - callback = function(args) - local c = vim.lsp.get_client_by_id(args.data.client_id) - if not c then - return - end + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local c = vim.lsp.get_client_by_id(args.data.client_id) + if not c then + return + end - if vim.bo.filetype == "lua" then - -- Format the current buffer on save - vim.api.nvim_create_autocmd("BufWritePre", { - buffer = args.buf, - callback = function() - vim.lsp.buf.format({ bufnr = args.buf, id = c.id }) - end, - }) - end - end, - }) + if vim.bo.filetype == "lua" then + -- Format the current buffer on save + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ bufnr = args.buf, id = c.id }) + end, + }) + end + end, + }) - -- local cmp_select = { behavior = cmp.SelectBehavior.Select } + -- local cmp_select = { behavior = cmp.SelectBehavior.Select } - --- Select item next/prev, taking into account whether the cmp window is - --- top-down or bottoom-up so that the movement is always in the same direction. - -- local select_item_smart = function(dir, opts) - -- return function(fallback) - -- if cmp.visible() then - -- opts = opts or { behavior = cmp.SelectBehavior.Select } - -- if cmp.core.view.custom_entries_view:is_direction_top_down() then - -- ({ next = cmp.select_next_item, prev = cmp.select_prev_item })[dir](opts) - -- else - -- ({ prev = cmp.select_next_item, next = cmp.select_prev_item })[dir](opts) - -- end - -- else - -- fallback() - -- end - -- end - -- end + --- Select item next/prev, taking into account whether the cmp window is + --- top-down or bottoom-up so that the movement is always in the same direction. + -- local select_item_smart = function(dir, opts) + -- return function(fallback) + -- if cmp.visible() then + -- opts = opts or { behavior = cmp.SelectBehavior.Select } + -- if cmp.core.view.custom_entries_view:is_direction_top_down() then + -- ({ next = cmp.select_next_item, prev = cmp.select_prev_item })[dir](opts) + -- else + -- ({ prev = cmp.select_next_item, next = cmp.select_prev_item })[dir](opts) + -- end + -- else + -- fallback() + -- end + -- end + -- end - -- cmp.setup({ - -- snippet = { - -- expand = function(args) - -- require("luasnip").lsp_expand(args.body) -- For `luasnip` users. - -- end, - -- }, - -- completion = { - -- completeopt = "menu,menuone,noinsert", - -- }, - -- -- No idea what this is - -- matching = { - -- disallow_fuzzy_matching = false, - -- disallow_fullfuzzy_matching = false, - -- disallow_partial_fuzzy_matching = false, - -- }, - -- performance = { - -- -- debounce = 50, - -- debounce = 25, - -- -- max_view_entries = 20, - -- }, - -- That crazy window - -- window = { - -- completion = cmp.config.window.bordered({ - -- border = "single", - -- side_padding = 2, - -- col_offset = -3, - -- max_width = 80, - -- }), - -- documentation = cmp.config.window.bordered({ - -- max_width = 50, - -- }), - -- }, - -- mapping = cmp.mapping.preset.insert({ - -- [""] = select_item_smart("prev", cmp_select), - -- [""] = select_item_smart("next", cmp_select), - -- [""] = cmp.mapping.close(), - -- [""] = cmp.mapping.confirm({ select = true }), - -- [""] = cmp.mapping.confirm({ select = true }), - -- [""] = cmp.mapping.complete(), - -- [""] = cmp.mapping.scroll_docs(-3), - -- [""] = cmp.mapping.scroll_docs(3), - -- [""] = cmp.mapping.abort(), - -- }), - -- sorting = { - -- comparators = { - -- cmp.config.compare.locality, - -- cmp.config.compare.offset, - -- cmp.config.compare.recently_used, - -- cmp.config.compare.exact, - -- cmp.config.compare.order, - -- cmp.config.compare.length, - -- function(entry1, entry2) - -- local _, entry1_under = entry1.completion_item.label:find("^_+") - -- local _, entry2_under = entry2.completion_item.label:find("^_+") - -- entry1_under = entry1_under or 0 - -- entry2_under = entry2_under or 0 - -- if entry1_under > entry2_under then - -- return false - -- elseif entry1_under < entry2_under then - -- return true - -- end - -- end, - -- cmp.config.compare.kind, - -- cmp.config.compare.sort_text, - -- }, - -- }, - -- sources = cmp.config.sources({ - -- { name = "neopyter" }, - -- { name = "nvim_lsp" }, - -- { name = "codeium" }, - -- { name = "luasnip" }, -- For luasnip users. - -- }, { - -- { name = "buffer" }, - -- }), - -- formatting = { - -- fields = { - -- "abbr", - -- "kind", - -- "menu", - -- }, - -- expandable_indicator = true, - -- format = lspkind.cmp_format({ - -- mode = "symbol_text", - -- maxwidth = 50, - -- ellipsis_char = "...", - -- menu = { - -- neopyter = "[Neopyter]", - -- }, - -- symbol_map = { - -- -- specific complete item kind icon - -- ["Magic"] = "🪄", - -- ["Path"] = "📁", - -- ["Dict key"] = "🔑", - -- ["Instance"] = "󱃻", - -- ["Statement"] = "󱇯", - -- }, - -- }), - -- }, - -- }) + -- cmp.setup({ + -- snippet = { + -- expand = function(args) + -- require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + -- end, + -- }, + -- completion = { + -- completeopt = "menu,menuone,noinsert", + -- }, + -- -- No idea what this is + -- matching = { + -- disallow_fuzzy_matching = false, + -- disallow_fullfuzzy_matching = false, + -- disallow_partial_fuzzy_matching = false, + -- }, + -- performance = { + -- -- debounce = 50, + -- debounce = 25, + -- -- max_view_entries = 20, + -- }, + -- That crazy window + -- window = { + -- completion = cmp.config.window.bordered({ + -- border = "single", + -- side_padding = 2, + -- col_offset = -3, + -- max_width = 80, + -- }), + -- documentation = cmp.config.window.bordered({ + -- max_width = 50, + -- }), + -- }, + -- mapping = cmp.mapping.preset.insert({ + -- [""] = select_item_smart("prev", cmp_select), + -- [""] = select_item_smart("next", cmp_select), + -- [""] = cmp.mapping.close(), + -- [""] = cmp.mapping.confirm({ select = true }), + -- [""] = cmp.mapping.confirm({ select = true }), + -- [""] = cmp.mapping.complete(), + -- [""] = cmp.mapping.scroll_docs(-3), + -- [""] = cmp.mapping.scroll_docs(3), + -- [""] = cmp.mapping.abort(), + -- }), + -- sorting = { + -- comparators = { + -- cmp.config.compare.locality, + -- cmp.config.compare.offset, + -- cmp.config.compare.recently_used, + -- cmp.config.compare.exact, + -- cmp.config.compare.order, + -- cmp.config.compare.length, + -- function(entry1, entry2) + -- local _, entry1_under = entry1.completion_item.label:find("^_+") + -- local _, entry2_under = entry2.completion_item.label:find("^_+") + -- entry1_under = entry1_under or 0 + -- entry2_under = entry2_under or 0 + -- if entry1_under > entry2_under then + -- return false + -- elseif entry1_under < entry2_under then + -- return true + -- end + -- end, + -- cmp.config.compare.kind, + -- cmp.config.compare.sort_text, + -- }, + -- }, + -- sources = cmp.config.sources({ + -- { name = "neopyter" }, + -- { name = "nvim_lsp" }, + -- { name = "codeium" }, + -- { name = "luasnip" }, -- For luasnip users. + -- }, { + -- { name = "buffer" }, + -- }), + -- formatting = { + -- fields = { + -- "abbr", + -- "kind", + -- "menu", + -- }, + -- expandable_indicator = true, + -- format = lspkind.cmp_format({ + -- mode = "symbol_text", + -- maxwidth = 50, + -- ellipsis_char = "...", + -- menu = { + -- neopyter = "[Neopyter]", + -- }, + -- symbol_map = { + -- -- specific complete item kind icon + -- ["Magic"] = "🪄", + -- ["Path"] = "📁", + -- ["Dict key"] = "🔑", + -- ["Instance"] = "󱃻", + -- ["Statement"] = "󱇯", + -- }, + -- }), + -- }, + -- }) - -- -- menu item highlight - -- vim.api.nvim_set_hl(0, "CmpItemKindMagic", { bg = "NONE", fg = "#D4D434" }) - -- vim.api.nvim_set_hl(0, "CmpItemKindPath", { link = "CmpItemKindFolder" }) - -- vim.api.nvim_set_hl(0, "CmpItemKindDictkey", { link = "CmpItemKindKeyword" }) - -- vim.api.nvim_set_hl(0, "CmpItemKindInstance", { link = "CmpItemKindVariable" }) - -- vim.api.nvim_set_hl(0, "CmpItemKindStatement", { link = "CmpItemKindVariable" }) + -- -- menu item highlight + -- vim.api.nvim_set_hl(0, "CmpItemKindMagic", { bg = "NONE", fg = "#D4D434" }) + -- vim.api.nvim_set_hl(0, "CmpItemKindPath", { link = "CmpItemKindFolder" }) + -- vim.api.nvim_set_hl(0, "CmpItemKindDictkey", { link = "CmpItemKindKeyword" }) + -- vim.api.nvim_set_hl(0, "CmpItemKindInstance", { link = "CmpItemKindVariable" }) + -- vim.api.nvim_set_hl(0, "CmpItemKindStatement", { link = "CmpItemKindVariable" }) - -- vim.diagnostic.config({ - -- -- update_in_insert = true, -- Update diagnostics in Insert mode - -- -- ^ (if false, diagnostics are updated on InsertLeave) - -- - -- underline = true, - -- - -- virtual_text = true, - -- - -- severity_sort = true, -- high -> low - -- - -- -- float = { - -- -- focusable = false, - -- -- style = "minimal", - -- -- border = "rounded", - -- -- source = true, - -- -- header = { "  Diagnostics", "String" }, - -- -- prefix = function(_, _, _) - -- -- return "  ", "String" - -- -- end, - -- -- }, - -- }) + -- vim.diagnostic.config({ + -- -- update_in_insert = true, -- Update diagnostics in Insert mode + -- -- ^ (if false, diagnostics are updated on InsertLeave) + -- + -- underline = true, + -- + -- virtual_text = true, + -- + -- severity_sort = true, -- high -> low + -- + -- -- float = { + -- -- focusable = false, + -- -- style = "minimal", + -- -- border = "rounded", + -- -- source = true, + -- -- header = { "  Diagnostics", "String" }, + -- -- prefix = function(_, _, _) + -- -- return "  ", "String" + -- -- end, + -- -- }, + -- }) - -- treesitter jupyter notebook stuff - -- require("nvim-treesitter.configs").setup({ - -- textobjects = { - -- move = { - -- enable = true, - -- goto_next_start = { - -- ["]j"] = "@cellseparator", - -- ["]c"] = "@cellcontent", - -- }, - -- goto_previous_start = { - -- ["[j"] = "@cellseparator", - -- ["[c"] = "@cellcontent", - -- }, - -- }, - -- }, - -- }) - end, - }, + -- treesitter jupyter notebook stuff + -- require("nvim-treesitter.configs").setup({ + -- textobjects = { + -- move = { + -- enable = true, + -- goto_next_start = { + -- ["]j"] = "@cellseparator", + -- ["]c"] = "@cellcontent", + -- }, + -- goto_previous_start = { + -- ["[j"] = "@cellseparator", + -- ["[c"] = "@cellcontent", + -- }, + -- }, + -- }, + -- }) + end, + }, } From 52f1094f41eb2a379b56e4c07a058a3090d67842 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Sun, 12 Oct 2025 16:44:53 +0200 Subject: [PATCH 5/9] tailscale: switch to manual downloading for mac --- modules/common/tailscale.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/common/tailscale.nix b/modules/common/tailscale.nix index 9b0cd4a..3de9873 100644 --- a/modules/common/tailscale.nix +++ b/modules/common/tailscale.nix @@ -1,7 +1,7 @@ { - services.tailscale = { - enable = true; - }; - - networking.search = [ "shorthair-wall.ts.net" ]; + # services.tailscale = { + # enable = true; + # }; + # + # networking.search = [ "shorthair-wall.ts.net" ]; } From f383ee8250e8dcd44910d8923c7806c13261a1bf Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Sun, 12 Oct 2025 16:45:54 +0200 Subject: [PATCH 6/9] --no-edit --- modules/common/nushell/config.nu | 69 ++++++++++++++++++++++++++++++ modules/common/nushell/default.nix | 6 +++ 2 files changed, 75 insertions(+) diff --git a/modules/common/nushell/config.nu b/modules/common/nushell/config.nu index 9c9c02f..0293f4b 100644 --- a/modules/common/nushell/config.nu +++ b/modules/common/nushell/config.nu @@ -67,3 +67,72 @@ alias ah = cd ~/dotfiles/hosts/thegeneralist alias ai3 = nvim /home/thegeneralist/dotfiles/hosts/thegeneralist/dotfiles/i3/config # alias rb = sudo nixos-rebuild switch --flake ~/dotfiles#thegeneralist alias rb = nh os switch . -v -- --show-trace --verbose + +def greeting [] { + let quotes = [ + "What is impossible for you is not impossible for me." + "What is impossible for you is not impossible for me." + "What is impossible for you is not impossible for me." + "What is impossible for you is not impossible for me." + "What is impossible for you is not impossible for me." + "What is impossible for you is not impossible for me." + "What is impossible for you is not impossible for me." + "What is impossible for you is not impossible for me." + "Ah, Stil, I live in an apocalyptic dream." + "Greatness is a transitory experience." + "Limits exist only to be exceeded." + "I don’t follow paths. I make them." + "What crushes others fuels me." + "Ordinary is the disease. I am the cure." + "You see walls. I see doors." + "Fear is a suggestion. I ignore it." + "If it can be imagined, it can be done—faster." + "Mediocrity is the only true danger." + "I bend reality so you don’t have to." + "The impossible is just untested patience." + "Rules are advice I choose to ignore." + "Every boundary is a dare." + "I don’t wait for opportunity. I invent it." + "Pain is a fuel. Weakness is optional." + "Victory doesn’t ask permission." + "The future bends to those who act." + "Obstacles are just poorly designed stepping stones." + "Chaos is a playground." + "Legends are written in disregard for limits." + "Difficulty is the seasoning of achievement." + "Success belongs to those who steal it." + "Failure is the draft. Mastery is the publication." + "Time fears those who don’t respect it." + "I thrive where others break." + "Destiny is negotiable." + "Limits are suggestions, not laws." + "The world bends for persistence." + "I make the rules after winning." + "Every ‘no’ is a challenge waiting to be conquered." + "I don’t follow trends. I create them." + "Adversity is just another form of applause." + "Impossible is an opinion, not a fact." + "I carve paths through resistance." + "Mastery is forged, not granted." + "Chaos reveals the capable." + "The meek inherit nothing." + "I turn hesitation into fuel." + "Pain is temporary. Glory is eternal." + "I thrive in the impossible." + "The weak talk. The strong act." + "Fortune favors my audacity." + "Nothing worth having comes unchallenged." + "Limits are the invention of the timid." + "Every barrier is an invitation." + "I am the variable the universe didn’t calculate." + "Victory whispers to those who refuse to listen to fear." + "Failure teaches. I only graduate with honors." + "The extraordinary is a habit, not a gift." + "Resistance exists to prove my strength." + "Legends are crafted in defiance." + "The impossible is just another rehearsal." + ] + echo ($quotes | get (random int 0..(($quotes | length) - 1))) +} + +greeting diff --git a/modules/common/nushell/default.nix b/modules/common/nushell/default.nix index 1690b10..3765a7c 100644 --- a/modules/common/nushell/default.nix +++ b/modules/common/nushell/default.nix @@ -21,6 +21,7 @@ in { fzf gh fastfetch + carapace ]; shellAliases = { @@ -73,6 +74,11 @@ in { envFile.text = readFile ./env.nu; environmentVariables = config.environment.variables // homeArgs.config.home.sessionVariables; }; + programs.carapace = { + enable = true; + enableZshIntegration = true; + enableNushellIntegration = true; + }; programs.zsh = { enable = true; sessionVariables = config.environment.variables // homeArgs.config.home.sessionVariables; From 48eefdaa207e63d3c2653389e7b6ec6441e4c036 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Thu, 16 Oct 2025 18:20:56 +0200 Subject: [PATCH 7/9] nvim: add MarkdownPreview - add `.cargo/bin` to PATH --- modules/common/nushell/config.nu | 60 ------------------- modules/common/nushell/default.nix | 1 + .../nvim/lua/thegeneralist/lazy/autopairs.lua | 7 +++ .../nvim/lua/thegeneralist/lazy/markdown.lua | 14 ++--- 4 files changed, 15 insertions(+), 67 deletions(-) create mode 100644 modules/dotfiles/nvim/lua/thegeneralist/lazy/autopairs.lua diff --git a/modules/common/nushell/config.nu b/modules/common/nushell/config.nu index 6d096f0..164cd5f 100644 --- a/modules/common/nushell/config.nu +++ b/modules/common/nushell/config.nu @@ -71,66 +71,6 @@ alias rb = nh os switch . -v -- --show-trace --verbose def greeting [] { let quotes = [ "What is impossible for you is not impossible for me." - "What is impossible for you is not impossible for me." - "What is impossible for you is not impossible for me." - "What is impossible for you is not impossible for me." - "What is impossible for you is not impossible for me." - "What is impossible for you is not impossible for me." - "What is impossible for you is not impossible for me." - "What is impossible for you is not impossible for me." - "Ah, Stil, I live in an apocalyptic dream." - "Greatness is a transitory experience." - "Limits exist only to be exceeded." - "I don’t follow paths. I make them." - "What crushes others fuels me." - "Ordinary is the disease. I am the cure." - "You see walls. I see doors." - "Fear is a suggestion. I ignore it." - "If it can be imagined, it can be done—faster." - "Mediocrity is the only true danger." - "I bend reality so you don’t have to." - "The impossible is just untested patience." - "Rules are advice I choose to ignore." - "Every boundary is a dare." - "I don’t wait for opportunity. I invent it." - "Pain is a fuel. Weakness is optional." - "Victory doesn’t ask permission." - "The future bends to those who act." - "Obstacles are just poorly designed stepping stones." - "Chaos is a playground." - "Legends are written in disregard for limits." - "Difficulty is the seasoning of achievement." - "Success belongs to those who steal it." - "Failure is the draft. Mastery is the publication." - "Time fears those who don’t respect it." - "I thrive where others break." - "Destiny is negotiable." - "Limits are suggestions, not laws." - "The world bends for persistence." - "I make the rules after winning." - "Every ‘no’ is a challenge waiting to be conquered." - "I don’t follow trends. I create them." - "Adversity is just another form of applause." - "Impossible is an opinion, not a fact." - "I carve paths through resistance." - "Mastery is forged, not granted." - "Chaos reveals the capable." - "The meek inherit nothing." - "I turn hesitation into fuel." - "Pain is temporary. Glory is eternal." - "I thrive in the impossible." - "The weak talk. The strong act." - "Fortune favors my audacity." - "Nothing worth having comes unchallenged." - "Limits are the invention of the timid." - "Every barrier is an invitation." - "I am the variable the universe didn’t calculate." - "Victory whispers to those who refuse to listen to fear." - "Failure teaches. I only graduate with honors." - "The extraordinary is a habit, not a gift." - "Resistance exists to prove my strength." - "Legends are crafted in defiance." - "The impossible is just another rehearsal." ] echo ($quotes | get (random int 0..(($quotes | length) - 1))) } diff --git a/modules/common/nushell/default.nix b/modules/common/nushell/default.nix index 3765a7c..0f76b41 100644 --- a/modules/common/nushell/default.nix +++ b/modules/common/nushell/default.nix @@ -83,6 +83,7 @@ in { enable = true; sessionVariables = config.environment.variables // homeArgs.config.home.sessionVariables; }; + home.sessionPath = [ "/Users/thegeneralist/.cargo/bin" ]; }) ]; } diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/autopairs.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/autopairs.lua new file mode 100644 index 0000000..674b6a2 --- /dev/null +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/autopairs.lua @@ -0,0 +1,7 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true, + -- use opts = {} for passing setup options + -- this is equivalent to setup({}) function +} diff --git a/modules/dotfiles/nvim/lua/thegeneralist/lazy/markdown.lua b/modules/dotfiles/nvim/lua/thegeneralist/lazy/markdown.lua index e9d7525..bb96fbc 100644 --- a/modules/dotfiles/nvim/lua/thegeneralist/lazy/markdown.lua +++ b/modules/dotfiles/nvim/lua/thegeneralist/lazy/markdown.lua @@ -1,9 +1,9 @@ return { - -- "iamcco/markdown-preview.nvim", - -- cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - -- build = "cd app && yarn install", - -- init = function() - -- vim.g.mkdp_filetypes = { "markdown" } - -- end, - -- ft = { "markdown" }, + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, } From 27d347d3c8e0def69770c5a4518ac2d185a53d6e Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Tue, 6 Jan 2026 09:39:53 +0100 Subject: [PATCH 8/9] central: add personal website --- .../archive/archivebox.nix | 16 +-- hosts/thegeneralist-central/cert.pem.age | Bin 478 -> 478 bytes .../credentials_personal.age | 5 + hosts/thegeneralist-central/site.nix | 100 +++++++++++++----- secrets.nix | 1 + 5 files changed, 85 insertions(+), 37 deletions(-) create mode 100644 hosts/thegeneralist-central/credentials_personal.age diff --git a/hosts/thegeneralist-central/archive/archivebox.nix b/hosts/thegeneralist-central/archive/archivebox.nix index 85859ff..bd5edb1 100644 --- a/hosts/thegeneralist-central/archive/archivebox.nix +++ b/hosts/thegeneralist-central/archive/archivebox.nix @@ -20,14 +20,14 @@ }; }; - pywb = { - image = "docker.io/webrecorder/pywb"; - ports = [ "127.0.0.1:8001:8001" ]; - volumes = [ - "/mnt/usb/services/browsertrix/webrecorder/:/" - "/mnt/usb/services/browsertrix/webrecorder/webarchive:/webarchive" - ]; - }; + # pywb = { + # image = "docker.io/webrecorder/pywb"; + # ports = [ "127.0.0.1:8001:8001" ]; + # volumes = [ + # "/mnt/usb/services/browsertrix/webrecorder/:/" + # "/mnt/usb/services/browsertrix/webrecorder/webarchive:/webarchive" + # ]; + # }; }; environment.systemPackages = [ pkgs.docker ]; diff --git a/hosts/thegeneralist-central/cert.pem.age b/hosts/thegeneralist-central/cert.pem.age index ee2225e0bc97246249526894f35afd6fba5e0aa2..29686e868a672a1e79a0d99c32340a2fbd6f0340 100644 GIT binary patch delta 444 zcmcb|e2;m8PJKjZr9q@~ctL1sW`3r*uc2ptR7ycWim7(EzNMj$VY!)!wo|!Nfpmbte2v*yaVJ0Bi5 zxU*XF+r5}a3et@&S9GKg^s4XIoKm5#(0HIu<$(R)vu`(eUo!kTbJyfmuNx}<^!a58 zH}6T#jcaVpI4m-0#ZBwj-miVU!V@n{PyBQA`_ebZB(Dl~7u`DPd4K-9-g8_`OZ^WX zoGp9&Ffb9u)XHT>AX=2Yi@LzgbZ>dV}>uP&X z-XBp5xkZ^j@+_NDeqyG0-@^ZIeG-oDYE_Zi#87H%lKI2^)}80!mmj^|wO(GPD>pOn zb5P`~yyaQ4QmU02izg<`sXqDo2?v)%)ZHaAz7L&4pGZJ8 z*{X!IG%wz^e+Td0IrVNEJ7wlC?9tJjtvcE9p7Qwux0yjrJjYjrlpO9&@jY}J02Fe? AI{*Lx delta 444 zcmcb|e2;m8PQ6ihdRA_lcaB?DNw#lLsiR?mhhL(*OTN2zXnvKGQ&wbtac)|$pO1yB zBUeh2TX~UBa(Z}ZVug3MM}T{=yPLUxqJKn^aYdSGUa@nEdq!S%Qg&59D3`9Tu0o}A zws~-JK}n>ap;2j>VWM+kWno%jkVjcXjzwUmW1?G7M16{}ce+(E~n1b z{on3>`}?v*Fa8NNJ$h84`gv{X!|&f$@+_Nf_&B{+A@thPDxbz{^^rA~=kH7WShO=g zMsVeedZ%IwhwN8%jzw)D`HTO3SFK{3cVN@>%H|cXYn1-aY?n-MmOhwOzJ1r%t`#3m zH`=x5{N8gY^~El?`Z<+zfc4%-(i zN|%1@ICOEP!aq@s69?i7Z?^a3zn7cw#kRBm_xt`r ssh-ed25519 pp9qdQ Dd/XjOu+4aSiGxiCRcFOD+Hv25SqRqoqb0fk+tHSfSo +wihtf9gMmLhRfr8Lx5NISOn9Y96Au1DWg6xMLx3XAtA +--- HS8dzuvW6BKH9tASzN6Mc90lU3i13aidVzJYcpTTfrU +k$-rjmR'휈8_?/9z"q^2>)yC*NVehi<LF|1%Ĝ:OG[OX F4aHl63jB}6 bkPTm[Y|ę7fwT*yzxT?Ye_% \ No newline at end of file diff --git a/hosts/thegeneralist-central/site.nix b/hosts/thegeneralist-central/site.nix index 2f2690b..b16bd1a 100644 --- a/hosts/thegeneralist-central/site.nix +++ b/hosts/thegeneralist-central/site.nix @@ -1,31 +1,38 @@ -{ config, pkgs, ... }: let +{ config, pkgs, ... }: +let domain = "thegeneralist01.com"; + family_domain = builtins.getEnv "FAMILY_DOMAIN"; ssl = { - quic = true; + quic = true; useACMEHost = domain; }; -in { - imports = [ ./acme ./dns.nix ./jellyfin ]; +in +{ + imports = [ + ./acme + ./dns.nix + ./jellyfin + ]; # Nginx services.nginx = { - enable = true; - package = pkgs.nginxQuic; - enableQuicBPF = true; + enable = true; + package = pkgs.nginxQuic; + enableQuicBPF = true; - experimentalZstdSettings = true; - recommendedUwsgiSettings = true; - recommendedTlsSettings = true; - recommendedProxySettings = true; - recommendedOptimisation = true; - recommendedGzipSettings = true; - recommendedBrotliSettings = true; + experimentalZstdSettings = true; + recommendedUwsgiSettings = true; + recommendedTlsSettings = true; + recommendedProxySettings = true; + recommendedOptimisation = true; + recommendedGzipSettings = true; + recommendedBrotliSettings = true; - statusPage = true; - validateConfigFile = true; + statusPage = true; + validateConfigFile = true; - virtualHosts."${domain}" = ssl // { + virtualHosts."${domain}" = ssl // { root = "/var/www/${domain}"; locations."/".tryFiles = "$uri $uri.html $uri/ $uri/index.html =404"; @@ -43,13 +50,35 @@ in { ''; }; - virtualHosts."www.${domain}" = ssl // { + virtualHosts."www.${domain}" = ssl // { locations."/".return = "306 https://${domain}$request_uri"; }; - virtualHosts._ = ssl // { - locations."/".return = "307 https://${domain}/404"; + virtualHosts."${family_domain}" = { + root = "/var/www/${family_domain}"; + locations."/".tryFiles = "$uri $uri.html $uri/ $uri/index.html =404"; + + extraConfig = '' + if ($http_x_forwarded_proto = "http") { + return 301 https://${family_domain}$request_uri; + } + + location ~* \.(html|css|js|jpg|jpeg|png|gif|svg|ico|woff2?)$ { + expires 1d; + add_header Cache-Control "public"; + } + + error_page 404 /404.html; + ''; }; + + virtualHosts."www.${family_domain}" = { + locations."/".return = "306 https://${family_domain}$request_uri"; + }; + + # virtualHosts._ = ssl // { + # locations."/".return = "307 https://${domain}/404"; + # }; }; # Cloudflare @@ -57,21 +86,34 @@ in { age.secrets.cftcert.file = ./cert.pem.age; age.secrets.cftcredentials.file = ./credentials.age; + age.secrets.cftcredentials_personal.file = ./credentials_personal.age; services.cloudflared = { enable = true; certificateFile = config.age.secrets.cftcert.path; - tunnels."site" = { - ingress = { - "thegeneralist01.com" = "http://localhost:80"; - "www.thegeneralist01.com" = "http://localhost:80"; - "cache.thegeneralist01.com" = "http://localhost:80"; - }; - default = "http_status:404"; + tunnels = { + "site" = { + ingress = { + "thegeneralist01.com" = "http://localhost:80"; + "www.thegeneralist01.com" = "http://localhost:80"; + "cache.thegeneralist01.com" = "http://localhost:80"; + }; + default = "http_status:404"; - credentialsFile = config.age.secrets.cftcredentials.path; - certificateFile = config.age.secrets.cftcert.path; + credentialsFile = config.age.secrets.cftcredentials.path; + certificateFile = config.age.secrets.cftcert.path; + }; + "personal" = { + ingress = { + "${family_domain}" = "http://localhost:80"; + "www.${family_domain}" = "http://localhost:80"; + }; + default = "http_status:404"; + + credentialsFile = config.age.secrets.cftcredentials_personal.path; + certificateFile = config.age.secrets.cftcert.path; + }; }; }; } diff --git a/secrets.nix b/secrets.nix index ad9a0d8..8ea2f3f 100644 --- a/secrets.nix +++ b/secrets.nix @@ -7,6 +7,7 @@ in { "hosts/thegeneralist-central/acme/acmeEnvironment.age".publicKeys = [ thegeneralist ]; "hosts/thegeneralist-central/cert.pem.age".publicKeys = [ thegeneralist ]; "hosts/thegeneralist-central/credentials.age".publicKeys = [ thegeneralist ]; + "hosts/thegeneralist-central/credentials_personal.age".publicKeys = [ thegeneralist ]; "hosts/thegeneralist-central/cache/key.age".publicKeys = [ thegeneralist ]; "hosts/thegeneralist-central/password.age".publicKeys = [ thegeneralist ]; From 6014ad7d7a7167333cb0249c1dffd9edbf0bddc1 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Tue, 6 Jan 2026 14:16:51 +0100 Subject: [PATCH 9/9] server: add forgejo and postgresql --- hosts/thegeneralist-central/acme/default.nix | 3 + hosts/thegeneralist-central/configuration.nix | 2 +- .../thegeneralist-central/forgejo/default.nix | 94 +++++++++++++++++++ hosts/thegeneralist-central/site.nix | 1 + lib/default.nix | 3 +- lib/option.nix | 12 +++ modules/common/nix.nix | 2 +- modules/postgresql.nix | 44 +++++++++ 8 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 hosts/thegeneralist-central/forgejo/default.nix create mode 100644 lib/option.nix create mode 100644 modules/postgresql.nix diff --git a/hosts/thegeneralist-central/acme/default.nix b/hosts/thegeneralist-central/acme/default.nix index eca4206..461b078 100644 --- a/hosts/thegeneralist-central/acme/default.nix +++ b/hosts/thegeneralist-central/acme/default.nix @@ -17,6 +17,9 @@ in { extraDomainNames = [ "*.${domain}" ]; group = "acme"; }; + "git.${domain}" = { + group = "acme"; + }; "internal.${domain}" = { group = "acme"; }; diff --git a/hosts/thegeneralist-central/configuration.nix b/hosts/thegeneralist-central/configuration.nix index 38e0e08..1e5ec17 100644 --- a/hosts/thegeneralist-central/configuration.nix +++ b/hosts/thegeneralist-central/configuration.nix @@ -5,7 +5,7 @@ { config, pkgs, inputs, ... }: { - imports = [ ./hardware-configuration.nix ./site.nix ./cache ./archive ]; + imports = [ ./hardware-configuration.nix ./site.nix ./cache ./archive ./forgejo ]; age.secrets.password.file = ./password.age; users.users = { diff --git a/hosts/thegeneralist-central/forgejo/default.nix b/hosts/thegeneralist-central/forgejo/default.nix new file mode 100644 index 0000000..30ca4cf --- /dev/null +++ b/hosts/thegeneralist-central/forgejo/default.nix @@ -0,0 +1,94 @@ +let + forgejo_root_dir = "/var/lib/forgejo"; + domain = "git.thegeneralist01.com"; + + forgejo_folder = folder_name: "${forgejo_root_dir}/${folder_name}"; +in +{ + imports = [ ../../../modules/postgresql.nix ]; + + services.forgejo = { + enable = true; + stateDir = forgejo_folder "state"; + + lfs.enable = true; + + settings = + let + title = "thegeneralist01's forgejo"; + desc = "the attic of thegeneralist01's random repositories"; + in + { + default.APP_NAME = title; + "ui.meta" = { + AUTHOR = title; + DESCRIPTION = desc; + }; + + attachment.ALLOWED_TYPES = "*/*"; + cache.ENABLED = true; + + "cron.archive_cleanup" = + let + interval = "4h"; + in + { + SCHEDULE = "@every ${interval}"; + OLDER_THAN = interval; + }; + + packages.ENABLED = true; + mailer = { + ENABLED = false; + + # PROTOCOL = "smtps"; + # SMTP_ADDR = self.disk.mailserver.fqdn; + # USER = "git@${domain}"; + }; + + other = { + SHOW_FOOTER_TEMPLATE_LOAD_TIME = false; + SHOW_FOOTER_VERSION = false; + }; + + repository = { + DEFAULT_BRANCH = "master"; + DEFAULT_MERGE_STYLE = "rebase-merge"; + DEFAULT_REPO_UNITS = "repo.code, repo.issues, repo.pulls"; + + DEFAULT_PUSH_CREATE_PRIVATE = false; + ENABLE_PUSH_CREATE_ORG = true; + ENABLE_PUSH_CREATE_USER = true; + + DISABLE_STARS = true; + }; + + "repository.upload" = { + FILE_MAX_SIZE = 100; + MAX_FILES = 10; + }; + + server = { + ROOT_URL = "https://${domain}/"; + DOMAIN = domain; + LANDING_PAGE = "/explore"; + + HTTP_ADDR = "127.0.0.1"; + HTTP_PORT = 3000; + + SSH_LISTEN_HOST = "0.0.0.0"; + SSH_PORT = 2222; + SSH_LISTEN_PORT = 2222; + }; + + service.DISABLE_REGISTRATION = true; + + session = { + COOKIE_SECURE = true; + SAME_SITE = "strict"; + }; + }; + }; + + networking.firewall.allowedTCPPorts = [ 2222 ]; +} diff --git a/hosts/thegeneralist-central/site.nix b/hosts/thegeneralist-central/site.nix index b16bd1a..afc83f5 100644 --- a/hosts/thegeneralist-central/site.nix +++ b/hosts/thegeneralist-central/site.nix @@ -98,6 +98,7 @@ in "thegeneralist01.com" = "http://localhost:80"; "www.thegeneralist01.com" = "http://localhost:80"; "cache.thegeneralist01.com" = "http://localhost:80"; + "git.thegeneralist01.com" = "http://localhost:3000"; }; default = "http_status:404"; diff --git a/lib/default.nix b/lib/default.nix index c7e9336..25618e8 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,5 +1,6 @@ inputs: self: super: let system = import ./system.nix inputs self super; + option = import ./option.nix inputs self super; in -system +system // option diff --git a/lib/option.nix b/lib/option.nix new file mode 100644 index 0000000..9a8fc34 --- /dev/null +++ b/lib/option.nix @@ -0,0 +1,12 @@ +_: _: super: let + inherit (super) mkOption; +in { + mkConst = value: mkOption { + default = value; + readOnly = true; + }; + + mkValue = default: mkOption { + inherit default; + }; +} diff --git a/modules/common/nix.nix b/modules/common/nix.nix index 130de89..dd01d84 100644 --- a/modules/common/nix.nix +++ b/modules/common/nix.nix @@ -25,7 +25,7 @@ in { "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; - trusted-users = [ "thegeneralist" "central" "root" "@build" "@wheel" "@admin" "jellyfin" ]; + trusted-users = [ "thegeneralist" "central" "root" "@build" "@wheel" "@admin" "jellyfin" "git" ]; builders-use-substitutes = true; }; diff --git a/modules/postgresql.nix b/modules/postgresql.nix new file mode 100644 index 0000000..071069a --- /dev/null +++ b/modules/postgresql.nix @@ -0,0 +1,44 @@ +# stolen from https://github.com/RGBCube/ncc/blob/94c349aa767f04f40ff4165c70c15ed3c3996f82/modules/postgresql.nix +{ config, lib, pkgs, ... }: let + inherit (lib) flip mkForce mkOverride mkValue; +in { + config.environment.systemPackages = [ + config.services.postgresql.package + ]; + + options.services.postgresql.ensure = mkValue []; + + config.services.postgresql = { + enable = true; + package = pkgs.postgresql_17; + + enableJIT = true; + enableTCPIP = true; + + settings.listen_addresses = mkForce "::"; + authentication = mkOverride 10 /* ini */ '' + # DATABASE USER AUTHENTICATION + local all all peer + + # DATABASE USER ADDRESS AUTHENTICATION + host all all ::/0 md5 + ''; + + ensure = [ "postgres" "root" ]; + + initdbArgs = [ "--locale=C" "--encoding=UTF8" ]; + ensureDatabases = config.services.postgresql.ensure; + + ensureUsers = flip map config.services.postgresql.ensure (name: { + inherit name; + + ensureDBOwnership = true; + + ensureClauses = { + login = true; + superuser = name == "postgres" || name == "root"; + }; + }); + }; +} +