diff --git a/flake.lock b/flake.lock index 72d129f..6f5fd47 100644 --- a/flake.lock +++ b/flake.lock @@ -546,27 +546,6 @@ "type": "github" } }, - "home-manager_stable": { - "inputs": { - "nixpkgs": [ - "nixpkgs_stable" - ] - }, - "locked": { - "lastModified": 1716729592, - "narHash": "sha256-Y3bOjoh2cFBqZN0Jw1zUdyr7tjygyxl2bD/QY73GZP0=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "2c78a57c544dd19b07442350727ced097e1aa6e6", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "release-23.11", - "repo": "home-manager", - "type": "github" - } - }, "hyprcursor": { "inputs": { "hyprlang": [ @@ -805,11 +784,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1716747123, - "narHash": "sha256-XZFVa21Vpn39Y7fCmGAb8CxKJlX0YKKUyUfArvhXNjo=", + "lastModified": 1716760058, + "narHash": "sha256-5fMMNezTARjbc8HgEkvcOazlrsBBzlKSMVp56xTCY2g=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "491c6d2a3f239754a2e6aa110d47899a38d94c45", + "rev": "0c1fc48841eda5e35402327b1a71f4bb034a012c", "type": "github" }, "original": { @@ -996,16 +975,16 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1716704148, - "narHash": "sha256-XsWxhtvSUsft43XbSkpSroSyUyXj4focTG2CFCx1wqE=", + "lastModified": 1716509168, + "narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "8debaa1f45995e3a621c1f55c09bf68e214f5878", + "rev": "bfb7a882678e518398ce9a31a881538679f6f092", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable-small", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -1042,22 +1021,6 @@ "type": "github" } }, - "nixpkgs_stable": { - "locked": { - "lastModified": 1716361217, - "narHash": "sha256-mzZDr00WUiUXVm1ujBVv6A0qRd8okaITyUp4ezYRgc4=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "46397778ef1f73414b03ed553a3368f0e7e33c2f", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-23.11", - "repo": "nixpkgs", - "type": "github" - } - }, "pnpm2nix": { "inputs": { "flake-utils": "flake-utils", @@ -1094,13 +1057,13 @@ "lastModified": 1716213921, "narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=", "owner": "cachix", - "repo": "pre-commit-hooks.nix", + "repo": "git-hooks.nix", "rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0", "type": "github" }, "original": { "owner": "cachix", - "repo": "pre-commit-hooks.nix", + "repo": "git-hooks.nix", "type": "github" } }, @@ -1164,11 +1127,11 @@ "systems": "systems_11" }, "locked": { - "lastModified": 1716726255, - "narHash": "sha256-OlByCyBMJ3tZobHyzTVm41DhGzrQ/3FQv1krm+czCIw=", + "lastModified": 1716763745, + "narHash": "sha256-01OYLdDWJfIwNO1hJ7urv5mmTOg8Wc2hTz5lAmFmxpQ=", "owner": "raphamorim", "repo": "rio", - "rev": "a0eb2b64ece67edc38f7209b7e0fe2138c1b07b3", + "rev": "3079cfe94b19583d3c7bb05ff07720116bf84873", "type": "github" }, "original": { @@ -1185,7 +1148,6 @@ "blog": "blog", "catppuccin": "catppuccin", "home-manager": "home-manager_2", - "home-manager_stable": "home-manager_stable", "hypridle": "hypridle", "hyprland": "hyprland", "kb-gui": "kb-gui", @@ -1193,7 +1155,6 @@ "neovim-nightly-overlay": "neovim-nightly-overlay", "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs_7", - "nixpkgs_stable": "nixpkgs_stable", "resume": "resume", "rio-term": "rio-term", "snowfall-lib": "snowfall-lib", @@ -1252,11 +1213,11 @@ "nixpkgs": "nixpkgs_9" }, "locked": { - "lastModified": 1715998563, - "narHash": "sha256-krjs9VkDoRrYNQVyCTXUGUfAJziCk0Fkki1ZnnmNgjk=", + "lastModified": 1716603336, + "narHash": "sha256-81u/zd7V+XRTq88zwRLxw5GnwZyEiAvGA2BvAXUe864=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "4731829dec4859921bfc0e1548478207d6c9c8fa", + "rev": "4d0f1e4d5d65c23cdbb77e4b0d91940be7309bd4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1de7c1f..a6ebc13 100644 --- a/flake.nix +++ b/flake.nix @@ -11,19 +11,13 @@ }; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small"; - nixpkgs_stable.url = "github:nixos/nixpkgs/nixos-23.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - home-manager_stable = { - url = "github:nix-community/home-manager/release-23.11"; - inputs.nixpkgs.follows = "nixpkgs_stable"; - }; - resume.url = "git+https://git.zackster.zip/zack/resume"; anyrun.url = "github:Kirottu/anyrun"; anyrun.inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/home/apps/term/kitty/default.nix b/modules/home/apps/term/kitty/default.nix index 5b6998e..e235f73 100644 --- a/modules/home/apps/term/kitty/default.nix +++ b/modules/home/apps/term/kitty/default.nix @@ -10,20 +10,27 @@ with lib.custom; let in { options.apps.term.kitty = with types; { enable = mkBoolOpt false "Enable Kitty Term"; + + fonts = { + normal = mkStringOpt "Zed Mono Bold" "Normal Font"; + bold = mkStringOpt "Zed Mono Heavy" "Bold Font"; + italic = mkStringOpt "Zed Mono Bold Italic" "Italic Font"; + bold_italic = mkStringOpt "Zed Mono Bold Heavy Italic" "Bold Italic Font"; + }; }; config = mkIf cfg.enable { programs.kitty = { enable = true; font = { - name = "Iosevka Term SemiBold"; + name = cfg.fonts.normal; size = 14; }; extraConfig = '' - bold_font Iosevk Term Heavy - italic_font Iosevka Term SemiBold Italic - bold_italic_font Iosevka Term Heavy Italic + bold_font ${cfg.fonts.bold} + italic_font ${cfg.fonts.italic} + bold_italic_font ${cfg.fonts.bold_italic} ''; catppuccin.enable = true; diff --git a/modules/home/apps/tools/neovim/config/lua/plugins/editor/nvim-cmp.lua b/modules/home/apps/tools/neovim/config/lua/plugins/editor/nvim-cmp.lua index dab3c87..0b1cc76 100644 --- a/modules/home/apps/tools/neovim/config/lua/plugins/editor/nvim-cmp.lua +++ b/modules/home/apps/tools/neovim/config/lua/plugins/editor/nvim-cmp.lua @@ -67,28 +67,10 @@ in { opts = function() local cmp = require("cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp") + local lspkind = require("lspkind") cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - local icons = { - branch = "", - bullet = "•", - o_bullet = "○", - check = "✔", - d_chev = "∨", - ellipses = "…", - file = "╼", - hamburger = "≡", - lock = "", - r_chev = ">", - ballot_x = " ", - up_tri = " ", - info_i = " ", - -- ballot_x = '✘', - -- up_tri = '▲', - -- info_i = '¡', - } - local function get_lsp_completion_context(completion, source) local ok, source_name = pcall(function() return source.source.client.config.name @@ -139,14 +121,12 @@ in { luasnip.lsp_expand(args.body) end, }, + window = { completion = { winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", - side_padding = 4, - }, - documentation = { - winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", - side_padding = 4, + col_offset = -3, + side_padding = 0, }, }, sources = cmp.config.sources({ @@ -189,86 +169,24 @@ in { end end, { "i", "s" }), }, + view = { + entries = { name = "custom", selection_order = "near_cursor" }, + }, + experimental = { + ghost_text = true, + }, formatting = { - -- format = lspkind_status_ok and lspkind.cmp_format({ - -- mode = "symbol", - -- maxwidth = 25, - -- ellipsis_char = "...", - -- before = function(entry, vim_item) - -- if vim_item.kind == "Color" and entry.completion_item.documentation then - -- local _, _, r, g, b = - -- string.find(entry.completion_item.documentation, "^rgb%((%d+), (%d+), (%d+)") - -- if r then - -- local color = string.format("%02x", r) - -- .. string.format("%02x", g) - -- .. string.format("%02x", b) - -- local group = "Tw_" .. color - -- if vim.fn.hlID(group) < 1 then - -- vim.api.nvim_set_hl(0, group, { fg = "#" .. color }) - -- end - -- vim_item.kind_hl_group = group - -- return vim_item - -- end - -- end - -- return vim_item - -- end, - -- }), + fields = { "kind", "abbr", "menu" }, format = function(entry, vim_item) - if not require("cmp.utils.api").is_cmdline_mode() then - local abbr_width_max = 25 - local menu_width_max = 20 + local kind = lspkind.cmp_format({ + mode = "symbol_text", + maxwidth = 50, + })(entry, vim_item) + local strings = vim.split(kind.kind, "%s", { trimempty = true }) + kind.kind = " " .. strings[1] .. " " + kind.menu = " (" .. strings[2] .. ")" - local choice = require("lspkind").cmp_format({ - ellipsis_char = icons.ellipsis, - maxwidth = abbr_width_max, - mode = "symbol", - })(entry, vim_item) - - choice.abbr = vim.trim(choice.abbr) - - local abbr_width = string.len(choice.abbr) - if abbr_width < abbr_width_max then - local padding = string.rep(" ", abbr_width_max - abbr_width) - vim_item.abbr = choice.abbr .. padding - end - - local cmp_ctx = get_lsp_completion_context(entry.completion_item, entry.source) - if cmp_ctx ~= nil and cmp_ctx ~= "" then - choice.menu = cmp_ctx - else - choice.menu = "" - end - - local menu_width = string.len(choice.menu) - if menu_width > menu_width_max then - choice.menu = vim.fn.strcharpart(choice.menu, 0, menu_width_max - 1) - choice.menu = choice.menu .. icons.ellipses - else - local padding = string.rep(" ", menu_width_max - menu_width) - choice.menu = padding .. choice.menu - end - - return choice - else - local abbr_width_min = 20 - local abbr_width_max = 50 - - local choice = require("lspkind").cmp_format({ - ellipsis_char = icons.ellipses, - maxwidth = abbr_width_max, - mode = "symbol", - })(entry, vim_item) - - choice.abbr = vim.trim(choice.abbr) - - local abbr_width = string.len(choice.abbr) - if abbr_width < abbr_width_min then - local padding = string.rep(" ", abbr_width_min - abbr_width) - vim_item.abbr = choice.abbr .. padding - end - - return choice - end + return kind end, }, } diff --git a/modules/home/apps/tools/neovim/config/lua/plugins/ui/catppuccin.lua b/modules/home/apps/tools/neovim/config/lua/plugins/ui/catppuccin.lua index 0d1aa1a..2f24578 100644 --- a/modules/home/apps/tools/neovim/config/lua/plugins/ui/catppuccin.lua +++ b/modules/home/apps/tools/neovim/config/lua/plugins/ui/catppuccin.lua @@ -6,9 +6,35 @@ return { end, opts = { transparent_background = true, - custom_highlights = function(colors) + custom_highlights = function(C) return { - Pmenu = { bg = colors.base }, + Pmenu = { bg = C.base }, + CmpItemKindSnippet = { fg = C.base, bg = C.mauve }, + CmpItemKindKeyword = { fg = C.base, bg = C.red }, + CmpItemKindText = { fg = C.base, bg = C.teal }, + CmpItemKindMethod = { fg = C.base, bg = C.blue }, + CmpItemKindConstructor = { fg = C.base, bg = C.blue }, + CmpItemKindFunction = { fg = C.base, bg = C.blue }, + CmpItemKindFolder = { fg = C.base, bg = C.blue }, + CmpItemKindModule = { fg = C.base, bg = C.blue }, + CmpItemKindConstant = { fg = C.base, bg = C.peach }, + CmpItemKindField = { fg = C.base, bg = C.green }, + CmpItemKindProperty = { fg = C.base, bg = C.green }, + CmpItemKindEnum = { fg = C.base, bg = C.green }, + CmpItemKindUnit = { fg = C.base, bg = C.green }, + CmpItemKindClass = { fg = C.base, bg = C.yellow }, + CmpItemKindVariable = { fg = C.base, bg = C.flamingo }, + CmpItemKindFile = { fg = C.base, bg = C.blue }, + CmpItemKindInterface = { fg = C.base, bg = C.yellow }, + CmpItemKindColor = { fg = C.base, bg = C.red }, + CmpItemKindReference = { fg = C.base, bg = C.red }, + CmpItemKindEnumMember = { fg = C.base, bg = C.red }, + CmpItemKindStruct = { fg = C.base, bg = C.blue }, + CmpItemKindValue = { fg = C.base, bg = C.peach }, + CmpItemKindEvent = { fg = C.base, bg = C.blue }, + CmpItemKindOperator = { fg = C.base, bg = C.blue }, + CmpItemKindTypeParameter = { fg = C.base, bg = C.blue }, + CmpItemKindCopilot = { fg = C.base, bg = C.teal }, } end, flavor = "mocha", diff --git a/modules/home/apps/tools/neovim/config/lua/plugins/utils/lualine_sources.lua b/modules/home/apps/tools/neovim/config/lua/plugins/utils/lualine_sources.lua index 10e89d6..f538407 100644 --- a/modules/home/apps/tools/neovim/config/lua/plugins/utils/lualine_sources.lua +++ b/modules/home/apps/tools/neovim/config/lua/plugins/utils/lualine_sources.lua @@ -35,8 +35,8 @@ M.mode = { S = colors.sky, } return { - fg = map[mode] or colors.lavender, - bg = colors.base, + fg = colors.base, + bg = map[mode] or colors.blue, } end, } @@ -46,6 +46,7 @@ M.branch = { icon = icons.GitBranch, color = function() local colors = require("catppuccin.palettes").get_palette() + return { bg = colors.base } end, } diff --git a/modules/nixos/ui/fonts/default.nix b/modules/nixos/ui/fonts/default.nix index bc0b92a..7d6e2f1 100644 --- a/modules/nixos/ui/fonts/default.nix +++ b/modules/nixos/ui/fonts/default.nix @@ -35,6 +35,7 @@ in { noto-fonts-emoji jetbrains-mono (nerdfonts.override {fonts = ["Iosevka" "JetBrainsMono"];}) + custom.zed-fonts ]; enableDefaultPackages = false; diff --git a/packages/zed-fonts/default.nix b/packages/zed-fonts/default.nix new file mode 100644 index 0000000..5948ba6 --- /dev/null +++ b/packages/zed-fonts/default.nix @@ -0,0 +1,100 @@ +{ + buildNpmPackage, + fetchFromGitHub, + remarshal, + ttfautohint-nox, + stdenv, + lib, + darwin, + privateBuildPlan ? null, + extraParameters ? null, + ... +}: +buildNpmPackage rec { + version = "1.2.0"; + pname = "zed-mono"; + + src = fetchFromGitHub { + owner = "zed-industries"; + repo = "zed-fonts"; + rev = "${version}"; + hash = "sha256-qa683ED5q1LR2pAY0vRuprsHXLz/3IQPp3pFfzRPdQo="; + }; + + npmDepsHash = "sha256-M2GmTWEvNv485EdexDZoShuGeRmVvoGFV9EvQR3jE1c="; + + nativeBuildInputs = + [ + remarshal + ttfautohint-nox + ] + ++ lib.optionals stdenv.isDarwin [ + # libtool + darwin.cctools + ]; + + buildPlan = + if builtins.isAttrs privateBuildPlan + then builtins.toJSON {buildPlans.${pname} = privateBuildPlan;} + else privateBuildPlan; + + inherit extraParameters; + passAsFile = + ["extraParameters"] + ++ lib.optionals + (!(builtins.isString privateBuildPlan + && lib.hasPrefix builtins.storeDir privateBuildPlan)) ["buildPlan"]; + + configurePhase = '' + runHook preConfigure + ${lib.optionalString (builtins.isAttrs privateBuildPlan) '' + remarshal -i "$buildPlanPath" -o private-build-plans.toml -if json -of toml + ''} + ${lib.optionalString (builtins.isString privateBuildPlan + && (!lib.hasPrefix builtins.storeDir privateBuildPlan)) '' + cp "$buildPlanPath" private-build-plans.toml + ''} + ${lib.optionalString (builtins.isString privateBuildPlan + && (lib.hasPrefix builtins.storeDir privateBuildPlan)) '' + cp "$buildPlan" private-build-plans.toml + ''} + ${lib.optionalString (extraParameters != null) '' + echo -e "\n" >> params/parameters.toml + cat "$extraParametersPath" >> params/parameters.toml + ''} + runHook postConfigure + ''; + + buildPhase = '' + export HOME=$TMPDIR + runHook preBuild + npm run build --no-update-notifier -- --jCmd=$NIX_BUILD_CORES --verbose=9 ttf::$pname + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + fontdir="$out/share/fonts/truetype" + install -d "$fontdir" + install "dist/$pname/ttf"/* "$fontdir" + runHook postInstall + ''; + + enableParallelBuilding = true; + + meta = with lib; { + homepage = "https://zed.dev"; + downloadPage = "https://github.com/zed-industries/zed-fonts/releases"; + description = "Fonts for Zed Editor, based on Iosevka"; + longDescription = '' + Zed Mono & Zed Sans are custom builds of Iosevka liscensed under the SIL Open Font License, Version 1.1. + + They are built for use in Zed. Zed Sans uses a quasi-proportional spacing to allow the font to still feel monospace while not having such wide gaps in a UI setting. + ''; + license = licenses.ofl; + platforms = platforms.all; + maintainers = with maintainers; [ + zackartz + ]; + }; +}