From 12a268e9b2d2ba745eecc07d2344313b2746d788 Mon Sep 17 00:00:00 2001 From: Mike Vink <59492084+ivi-vink@users.noreply.github.com> Date: Fri, 17 Jan 2025 01:38:21 +0100 Subject: updates --- flake.lock | 8 +- flake.nix | 3 +- machines/work.nix | 115 +--------- mut/neovim/.hotpot.lua | 12 -- mut/neovim/lua/my/packages/blink.lua | 327 ++--------------------------- mut/neovim/pack/plugins/start/blink.cmp | 1 + mut/neovim/pack/plugins/start/quicker.nvim | 1 + mut/st/config.mk | 2 +- mut/st/x.c | 2 +- profiles/core/meta.nix | 2 +- profiles/core/neovim.nix | 1 - 11 files changed, 39 insertions(+), 435 deletions(-) delete mode 100644 mut/neovim/.hotpot.lua create mode 160000 mut/neovim/pack/plugins/start/blink.cmp create mode 160000 mut/neovim/pack/plugins/start/quicker.nvim diff --git a/flake.lock b/flake.lock index 624d089..0bcc090 100644 --- a/flake.lock +++ b/flake.lock @@ -406,13 +406,13 @@ ] }, "locked": { - "lastModified": 1728844240, - "narHash": "sha256-lDK39oLsP3HqqovbTAUoryEUA2IRxFNbi8egwCLmLTE=", - "path": "/home/ivi/nix-darwin", + "lastModified": 1737063096, + "narHash": "sha256-Qv40syutOYQZOBjS76Swk4VeUz08KDrsc9IDSdXmyqs=", + "path": "/Users/ivi/nix-darwin", "type": "path" }, "original": { - "path": "/home/ivi/nix-darwin", + "path": "/Users/ivi/nix-darwin", "type": "path" } }, diff --git a/flake.nix b/flake.nix index 2576941..9fcd4e2 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; drduh-yubikey-guide.url = "github:drduh/YubiKey-Guide"; nix-darwin = { - url = "path:/home/ivi/nix-darwin"; + url = "path:/Users/ivi/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; ghostty = { @@ -165,7 +165,6 @@ modules = [ ./machines/work.nix - ghostty.packages.x86_64-linux.default ] ++ modulesIn ./profiles/core; opts = { diff --git a/machines/work.nix b/machines/work.nix index bf3d74f..c2b0543 100644 --- a/machines/work.nix +++ b/machines/work.nix @@ -8,10 +8,6 @@ hardware = mkSinkUndeclaredOptions {}; services = { resolved = mkSinkUndeclaredOptions {}; - openssh.enable = mkOption { - type = types.bool; - default = false; - }; }; security = { sudo.wheelNeedsPassword = mkSinkUndeclaredOptions {}; @@ -30,6 +26,13 @@ }; }; config = { + fonts = { + packages = with pkgs; [ + nerd-fonts.fira-code + nerd-fonts.jetbrains-mono + ]; + }; + users.users.root.home = mkForce "/var/root"; # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = @@ -80,6 +83,7 @@ slack = 803453959; }; }; + services.openssh.enable = false; services.syncthing = { cert = builtins.toFile "syncthing-cert" '' -----BEGIN CERTIFICATE----- @@ -105,108 +109,9 @@ # cmd - 5 : osascript -e 'tell application "calendar" to activate' # cmd - 6 : osascript -e 'tell application "mail" to activate' services.skhd = { - enable = false; + enable = true; skhdConfig = '' - cmd - 1 : yabai -m space --focus 1 - cmd - 2 : yabai -m space --focus 2 - cmd - 3 : yabai -m space --focus 3 - cmd - 4 : yabai -m space --focus 4 - cmd - 5 : yabai -m space --focus 5 - cmd - 6 : yabai -m space --focus 6 - cmd - 7 : yabai -m space --focus 7 - cmd - 0x2F : yabai -m display --focus next || yabai -m display --focus first - - cmd - h : yabai -m window --resize right:-40:0 2> /dev/null || yabai -m window --resize left:-40:0 2> /dev/null - cmd - l : yabai -m window --resize right:40:0 2> /dev/null || yabai -m window --resize left:40:0 2> /dev/null - cmd - k : ${pkgs.writers.writeBash "cycle_cclockwise" '' - if ! yabai -m window --focus prev &>/dev/null; then - yabai -m window --focus last - fi - ''} - cmd - j : ${pkgs.writers.writeBash "cycle_clockwise" '' - if ! yabai -m window --focus next &>/dev/null; then - yabai -m window --focus first - fi - ''} - cmd + shift - k : ${pkgs.writers.writeBash "swap_cclockwise" '' - win=$(yabai -m query --windows --window first | jq '.id') - - while : ; do - yabai -m window $win --swap next &> /dev/null - if [[ $? -eq 1 ]]; then - break - fi - done - ''} - cmd + shift - j : ${pkgs.writers.writeBash "swap_clockwise" '' - win=$(yabai -m query --windows --window last | jq '.id') - - while : ; do - yabai -m window $win --swap prev &> /dev/null - if [[ $? -eq 1 ]]; then - break - fi - done - ''} - cmd - w [ - "Google Chrome" ~ - * : /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome - ] - cmd - e : osascript -e 'tell application "mail" to activate' - cmd - m : osascript -e 'tell application "Slack" to activate' - cmd + shift - m : osascript -e 'tell application "Microsoft Teams (work or school)" to activate' - cmd - q : yabai -m window --close - cmd + shift - r : /Applications/Alacritty.app/Contents/MacOS/alacritty -e htop - cmd - return : /Applications/Alacritty.app/Contents/MacOS/alacritty - cmd - space : ${pkgs.writers.writeBash "swap_first_or_recent" '' - yabai -m window --swap first || yabai -m window --swap recent - ''} - cmd + shift - space : yabai -m window --toggle float - cmd + shift - p : ${pkgs.writers.writeBash "passautotype" '' - shopt -s nullglob globstar - - dmenu="/opt/homebrew/bin/dmenu-mac" - - ( - export PASSWORD_STORE_DIR="$HOME/sync/password-store" - prefix="$PASSWORD_STORE_DIR" - echo "prefix: $prefix" - password_files=( "$prefix"/**/*.gpg ) - password_files=( "''${password_files[@]#"$prefix"/}" ) - password_files=( "''${password_files[@]%.gpg}" ) - echo "password_files: ''${password_files[*]}" - - password="$(printf '%s\n' "''${password_files[@]}" | "$dmenu" "$@")" - echo "password: $password" - - [[ -n $password ]] || exit - - /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.loadSpoon([[PassAutotype]]):autotype([[$password]])" - ) >/tmp/debug 2>&1 - ''} - cmd - d : /opt/homebrew/bin/dmenu-mac - cmd + shift - d : ${pkgs.writers.writeBash "passmenu" '' - shopt -s nullglob globstar - - dmenu="/opt/homebrew/bin/dmenu-mac" - - ( - export PASSWORD_STORE_DIR="$HOME/sync/password-store" - prefix="$PASSWORD_STORE_DIR" - echo "prefix: $prefix" - password_files=( "$prefix"/**/*.gpg ) - password_files=( "''${password_files[@]#"$prefix"/}" ) - password_files=( "''${password_files[@]%.gpg}" ) - echo "password_files: ''${password_files[*]}" - - password="$(printf '%s\n' "''${password_files[@]}" | "$dmenu" "$@")" - echo "password: $password" - - [[ -n $password ]] || exit - - ${pkgs.pass}/bin/pass show -c "$password" - ) >/tmp/debug 2>&1 - ''} + cmd - d : /opt/X11/bin/xrandr -s 2560x1664 ''; }; services.sketchybar.enable = false; diff --git a/mut/neovim/.hotpot.lua b/mut/neovim/.hotpot.lua deleted file mode 100644 index 4accedb..0000000 --- a/mut/neovim/.hotpot.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - build = { - {verbose = true}, - {"fnl/**/*macro*.fnl", false}, -- dont compile macro files - {"init.fnl", true}, - {"fnl/conf/**/*.fnl", true}, - -- This will only compile init.fnl, all other fnl/ files will behave as normal. - -- Or you could enable other patterns too, - -- {"colors/*.fnl", true}, - -- {"fnl/**/*.fnl", true}, - } -} diff --git a/mut/neovim/lua/my/packages/blink.lua b/mut/neovim/lua/my/packages/blink.lua index bb5b30e..fbbe87d 100644 --- a/mut/neovim/lua/my/packages/blink.lua +++ b/mut/neovim/lua/my/packages/blink.lua @@ -1,317 +1,28 @@ local blink = require('blink.cmp') blink.setup { --- When specifying 'preset' in the keymap table, the custom key mappings are merged with the preset, - -- and any conflicting keys will overwrite the preset mappings. - -- The "fallback" command will run the next non blink keymap. - -- - -- Example: - -- - -- keymap = { - -- preset = 'default', - -- [''] = { 'select_prev', 'fallback' }, - -- [''] = { 'select_next', 'fallback' }, - -- - -- -- disable a keymap from the preset - -- [''] = {}, - -- - -- -- show with a list of providers - -- [''] = { function(cmp) cmp.show({ providers = { 'snippets' } }) end }, - -- - -- -- note that your function will often be run in a "fast event" where most vim.api functions will throw an error - -- -- you may want to wrap your function in `vim.schedule` or use `vim.schedule_wrap` - -- [''] = { function(cmp) vim.schedule(function() your_behavior end) }, - -- - -- -- optionally, define different keymaps for cmdline - -- cmdline = { - -- preset = 'super-tab' - -- } - -- } - -- - -- When defining your own keymaps without a preset, no keybinds will be assigned automatically. - -- - -- Available commands: - -- show, hide, cancel, accept, select_and_accept, select_prev, select_next, show_documentation, hide_documentation, - -- scroll_documentation_up, scroll_documentation_down, snippet_forward, snippet_backward, fallback - -- - -- "default" keymap - -- [''] = { 'show', 'show_documentation', 'hide_documentation' }, - -- [''] = { 'hide' }, - -- [''] = { 'select_and_accept' }, - -- - -- [''] = { 'select_prev', 'fallback' }, - -- [''] = { 'select_next', 'fallback' }, - -- - -- [''] = { 'scroll_documentation_up', 'fallback' }, - -- [''] = { 'scroll_documentation_down', 'fallback' }, - -- - -- [''] = { 'snippet_forward', 'fallback' }, - -- [''] = { 'snippet_backward', 'fallback' }, - -- - -- "super-tab" keymap - -- you may want to set `completion.trigger.show_in_snippet = false` - -- or use `completion.list.selection = "manual" | "auto_insert"` - -- - -- [''] = { 'show', 'show_documentation', 'hide_documentation' }, - -- [''] = { 'hide', 'fallback' }, - -- - -- [''] = { - -- function(cmp) - -- if cmp.snippet_active() then return cmp.accept() - -- else return cmp.select_and_accept() end - -- end, - -- 'snippet_forward', - -- 'fallback' - -- }, - -- [''] = { 'snippet_backward', 'fallback' }, - -- - -- [''] = { 'select_prev', 'fallback' }, - -- [''] = { 'select_next', 'fallback' }, - -- [''] = { 'select_prev', 'fallback' }, - -- [''] = { 'select_next', 'fallback' }, - -- - -- [''] = { 'scroll_documentation_up', 'fallback' }, - -- [''] = { 'scroll_documentation_down', 'fallback' }, - -- - -- "enter" keymap - -- you may want to set `completion.list.selection = "manual" | "auto_insert"` - -- - -- [''] = { 'show', 'show_documentation', 'hide_documentation' }, - -- [''] = { 'hide', 'fallback' }, - -- [''] = { 'accept', 'fallback' }, - -- - -- [''] = { 'snippet_forward', 'fallback' }, - -- [''] = { 'snippet_backward', 'fallback' }, - -- - -- [''] = { 'select_prev', 'fallback' }, - -- [''] = { 'select_next', 'fallback' }, - -- [''] = { 'select_prev', 'fallback' }, - -- [''] = { 'select_next', 'fallback' }, - -- - -- [''] = { 'scroll_documentation_up', 'fallback' }, - -- [''] = { 'scroll_documentation_down', 'fallback' }, - keymap = { preset = 'default' }, - - -- Enables keymaps, completions and signature help when true - enabled = function() return vim.bo.buftype ~= "prompt" and vim.b.completion ~= false end, - -- Example for blocking multiple filetypes - -- enabled = function() - -- return not vim.tbl_contains({ "lua", "markdown" }, vim.bo.filetype) - -- and vim.bo.buftype ~= "prompt" - -- and vim.b.completion ~= false - -- end, - - snippets = { - -- Function to use when expanding LSP provided snippets - expand = function(snippet) vim.snippet.expand(snippet) end, - -- Function to use when checking if a snippet is active - active = function(filter) return vim.snippet.active(filter) end, - -- Function to use when jumping between tab stops in a snippet, where direction can be negative or positive - jump = function(direction) vim.snippet.jump(direction) end, - }, - - signature = { - enabled = true, - trigger = { - blocked_trigger_characters = {}, - blocked_retrigger_characters = {}, - -- When true, will show the signature help window when the cursor comes after a trigger character when entering insert mode - show_on_insert_on_trigger_character = true, + -- 'default' for mappings similar to built-in completion + -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate) + -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept + -- See the full "keymap" documentation for information on defining your own keymap. + keymap = { preset = 'default' }, + + appearance = { + -- Sets the fallback highlight groups to nvim-cmp's highlight groups + -- Useful for when your theme doesn't support blink.cmp + -- Will be removed in a future release + use_nvim_cmp_as_default = true, + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono' }, - window = { - min_width = 1, - max_width = 100, - max_height = 10, - border = 'padded', - winblend = 0, - winhighlight = 'Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder', - scrollbar = false, -- Note that the gutter will be disabled when border ~= 'none' - -- Which directions to show the window, - -- falling back to the next direction when there's not enough space, - -- or another window is in the way - direction_priority = { 'n', 's' }, - -- Disable if you run into performance issues - treesitter_highlighting = true, - }, - }, - - sources = { - -- Static list of providers to enable, or a function to dynamically enable/disable providers based on the context - default = { 'lsp', 'path', 'snippets', 'buffer' }, - -- Example dynamically picking providers based on the filetype and treesitter node: - -- providers = function(ctx) - -- local node = vim.treesitter.get_node() - -- if vim.bo.filetype == 'lua' then - -- return { 'lsp', 'path' } - -- elseif node and vim.tbl_contains({ 'comment', 'line_comment', 'block_comment' }, node:type()) then - -- return { 'buffer' } - -- else - -- return { 'lsp', 'path', 'snippets', 'buffer' } - -- end - -- end - -- You may also define providers per filetype - per_filetype = { - -- lua = { 'lsp', 'path' }, + -- 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' }, }, - -- By default, we choose providers for the cmdline based on the current cmdtype - -- You may disable cmdline completions by replacing this with an empty table - cmdline = function() - local type = vim.fn.getcmdtype() - -- Search forward and backward - if type == '/' or type == '?' then return { 'buffer' } end - -- Commands - if type == ':' then return { 'cmdline' } end - return {} - end, - - -- Function to use when transforming the items before they're returned for all providers - -- The default will lower the score for snippets to sort them lower in the list - transform_items = function(_, items) - for _, item in ipairs(items) do - if item.kind == require('blink.cmp.types').CompletionItemKind.Snippet then - item.score_offset = item.score_offset - 3 - end - end - return items - end, - -- Minimum number of characters in the keyword to trigger all providers - -- May also be `function(ctx: blink.cmp.Context): number` - min_keyword_length = 0, - -- Example for setting a minimum keyword length for markdown files - -- min_keyword_length = function() - -- return vim.bo.filetype == 'markdown' and 2 or 0 - -- end, - - -- Please see https://github.com/Saghen/blink.compat for using `nvim-cmp` sources - providers = { - lsp = { - name = 'LSP', - module = 'blink.cmp.sources.lsp', - -- Filter out text items from the LSP provider, since we have the buffer provider for that - transform_items = function(_, items) - return vim.tbl_filter( - function(item) return item.kind ~= require('blink.cmp.types').CompletionItemKind.Text end, - items - ) - end, - - --- *All* providers have the following options available - --- NOTE: All of these options may be functions to get dynamic behavior - --- See the type definitions for more information. - enabled = true, -- Whether or not to enable the provider - async = false, -- Whether we should wait for the provider to return before showing the completions - timeout_ms = 2000, -- How long to wait for the provider to return before showing completions and treating it as asynchronous - transform_items = nil, -- Function to transform the items before they're returned - should_show_items = true, -- Whether or not to show the items - max_items = nil, -- Maximum number of items to display in the menu - min_keyword_length = 0, -- Minimum number of characters in the keyword to trigger the provider - -- If this provider returns 0 items, it will fallback to these providers. - -- If multiple providers falback to the same provider, all of the providers must return 0 items for it to fallback - fallbacks = { 'buffer' }, - score_offset = 0, -- Boost/penalize the score of the items - override = nil, -- Override the source's functions - }, - path = { - name = 'Path', - module = 'blink.cmp.sources.path', - score_offset = 3, - fallbacks = { 'buffer' }, - opts = { - trailing_slash = false, - label_trailing_slash = true, - get_cwd = function(context) return vim.fn.expand(('#%d:p:h'):format(context.bufnr)) end, - show_hidden_files_by_default = false, - } - }, - snippets = { - name = 'Snippets', - module = 'blink.cmp.sources.snippets', - opts = { - friendly_snippets = true, - search_paths = { vim.fn.stdpath('config') .. '/snippets' }, - global_snippets = { 'all' }, - extended_filetypes = {}, - ignored_filetypes = {}, - get_filetype = function(context) - return vim.bo.filetype - end - } - - --- Example usage for disabling the snippet provider after pressing trigger characters (i.e. ".") - -- enabled = function(ctx) - -- return ctx ~= nil and ctx.trigger.kind == vim.lsp.protocol.CompletionTriggerKind.TriggerCharacter - -- end, - }, - luasnip = { - name = 'Luasnip', - module = 'blink.cmp.sources.luasnip', - opts = { - -- Whether to use show_condition for filtering snippets - use_show_condition = true, - -- Whether to show autosnippets in the completion list - show_autosnippets = true, - } - }, - buffer = { - name = 'Buffer', - module = 'blink.cmp.sources.buffer', - opts = { - -- default to all visible buffers - get_bufnrs = function() - return vim - .iter(vim.api.nvim_list_wins()) - :map(function(win) return vim.api.nvim_win_get_buf(win) end) - :filter(function(buf) return vim.bo[buf].buftype ~= 'nofile' end) - :totable() - end, - } - }, - }, - }, - - appearance = { - highlight_ns = vim.api.nvim_create_namespace('blink_cmp'), - -- Sets the fallback highlight groups to nvim-cmp's highlight groups - -- Useful for when your theme doesn't support blink.cmp - -- Will be removed in a future release - use_nvim_cmp_as_default = false, - -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = 'mono', - kind_icons = { - Text = '󰉿', - Method = '󰊕', - Function = '󰊕', - Constructor = '󰒓', - - Field = '󰜢', - Variable = '󰆦', - Property = '󰖷', - - Class = '󱡠', - Interface = '󱡠', - Struct = '󱡠', - Module = '󰅩', - - Unit = '󰪚', - Value = '󰦨', - Enum = '󰦨', - EnumMember = '󰦨', - - Keyword = '󰻾', - Constant = '󰏿', - - Snippet = '󱄽', - Color = '󰏘', - File = '󰈔', - Reference = '󰬲', - Folder = '󰉋', - Event = '󱐋', - Operator = '󰪚', - TypeParameter = '󰬛', - }, - }, + snippets = { preset = 'luasnip' }, } local map = vim.keymap.set diff --git a/mut/neovim/pack/plugins/start/blink.cmp b/mut/neovim/pack/plugins/start/blink.cmp new file mode 160000 index 0000000..1cc3b1a --- /dev/null +++ b/mut/neovim/pack/plugins/start/blink.cmp @@ -0,0 +1 @@ +Subproject commit 1cc3b1a908fbcfd15451c4772759549724f38524 diff --git a/mut/neovim/pack/plugins/start/quicker.nvim b/mut/neovim/pack/plugins/start/quicker.nvim new file mode 160000 index 0000000..049def7 --- /dev/null +++ b/mut/neovim/pack/plugins/start/quicker.nvim @@ -0,0 +1 @@ +Subproject commit 049def718213d3cdf49fdf29835aded09b3e54a3 diff --git a/mut/st/config.mk b/mut/st/config.mk index ef6de39..0e509a1 100644 --- a/mut/st/config.mk +++ b/mut/st/config.mk @@ -17,7 +17,7 @@ INCS = -I$(X11INC) \ `$(PKG_CONFIG) --cflags fontconfig` \ `$(PKG_CONFIG) --cflags freetype2` \ `$(PKG_CONFIG) --cflags harfbuzz` -LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\ +LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft -lXrender\ `$(PKG_CONFIG) --libs fontconfig` \ `$(PKG_CONFIG) --libs freetype2` \ `$(PKG_CONFIG) --libs harfbuzz` diff --git a/mut/st/x.c b/mut/st/x.c index e2ec9db..0ce1172 100644 --- a/mut/st/x.c +++ b/mut/st/x.c @@ -1288,7 +1288,7 @@ xinit(int cols, int rows) if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { parent = XRootWindow(xw.dpy, xw.scr); - xw.depth = 32; + xw.depth = 24; } else { XGetWindowAttributes(xw.dpy, parent, &attr); xw.depth = attr.depth; diff --git a/profiles/core/meta.nix b/profiles/core/meta.nix index 0cf0c1c..afd3e55 100644 --- a/profiles/core/meta.nix +++ b/profiles/core/meta.nix @@ -1,6 +1,6 @@ {inputs,lib,config, ...}: with lib; { lib.meta = { - configPath = "/nix-config"; + configPath = "${config.my.home}/nix-config"; mkMutableSymlink = path: config.hm.lib.file.mkOutOfStoreSymlink (config.lib.meta.configPath + removePrefix (toString inputs.self) (toString path)); diff --git a/profiles/core/neovim.nix b/profiles/core/neovim.nix index 500260b..b5531c1 100644 --- a/profiles/core/neovim.nix +++ b/profiles/core/neovim.nix @@ -79,7 +79,6 @@ trouble-nvim vim-easy-align nvim-comment - nvim-cinnamon # cmp nvim-cmp -- cgit v1.2.3