From a920b049737ea9dbf819a712f945b7a8827289bb Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Tue, 16 Jul 2024 11:13:12 +0200 Subject: [PATCH] kakoune config --- flake.lock | 101 ++++++++++++------ flake.nix | 7 +- hosts/vali/hermit/configuration.nix | 2 +- hosts/vali/hermit/profile.nix | 1 - lib/options.nix | 16 --- lib/shells/coreboot.nix | 27 ----- modules/editors/emacs.nix | 22 ++-- modules/editors/kakoune/default.nix | 51 ++++++++- .../editors/kakoune/mappings.nix | 0 modules/editors/nvf/lua/core.lua | 2 +- modules/editors/nvf/lua/misc/neovide.lua | 52 ++++----- modules/editors/nvf/lua/plugins/notify.lua | 14 +-- modules/editors/nvf/plugins/settings/ui.nix | 2 +- modules/editors/nvf/settings.nix | 14 +-- overlay.nix | 19 ---- parts/lib/builders.nix | 0 16 files changed, 174 insertions(+), 156 deletions(-) delete mode 100644 lib/options.nix delete mode 100644 lib/shells/coreboot.nix rename lib/default.nix => modules/editors/kakoune/mappings.nix (100%) delete mode 100644 overlay.nix create mode 100644 parts/lib/builders.nix diff --git a/flake.lock b/flake.lock index 8b97132..30ab659 100644 --- a/flake.lock +++ b/flake.lock @@ -439,10 +439,46 @@ "type": "github" } }, + "flake-parts_10": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_4" + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-parts_2": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, "locked": { "lastModified": 1715865404, "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", @@ -457,7 +493,7 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -478,7 +514,7 @@ "type": "github" } }, - "flake-parts_4": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -499,7 +535,7 @@ "type": "indirect" } }, - "flake-parts_5": { + "flake-parts_6": { "inputs": { "nixpkgs-lib": [ "nixpak", @@ -520,7 +556,7 @@ "type": "github" } }, - "flake-parts_6": { + "flake-parts_7": { "inputs": { "nixpkgs-lib": [ "nixpkgs-wayland", @@ -542,7 +578,7 @@ "type": "github" } }, - "flake-parts_7": { + "flake-parts_8": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -563,7 +599,7 @@ "type": "github" } }, - "flake-parts_8": { + "flake-parts_9": { "inputs": { "nixpkgs-lib": [ "schizofox", @@ -584,24 +620,6 @@ "type": "github" } }, - "flake-parts_9": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_3" - }, - "locked": { - "lastModified": 1698882062, - "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems_3" @@ -873,7 +891,7 @@ }, "hercules-ci-effects": { "inputs": { - "flake-parts": "flake-parts_4", + "flake-parts": "flake-parts_5", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -1216,7 +1234,7 @@ "lib-aggregate": { "inputs": { "flake-utils": "flake-utils_5", - "nixpkgs-lib": "nixpkgs-lib_2" + "nixpkgs-lib": "nixpkgs-lib_3" }, "locked": { "lastModified": 1719749459, @@ -1291,7 +1309,7 @@ }, "neovim-flake": { "inputs": { - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "flake-utils": "flake-utils_3", "nil": "nil", "nixpkgs": [ @@ -1417,7 +1435,7 @@ "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat_2", - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "git-hooks": "git-hooks", "hercules-ci-effects": "hercules-ci-effects", "neovim-src": "neovim-src", @@ -1502,7 +1520,7 @@ }, "nix-eval-jobs": { "inputs": { - "flake-parts": "flake-parts_6", + "flake-parts": "flake-parts_7", "nix-github-actions": "nix-github-actions", "nixpkgs": "nixpkgs_9", "treefmt-nix": "treefmt-nix" @@ -1576,7 +1594,7 @@ }, "nixpak": { "inputs": { - "flake-parts": "flake-parts_5", + "flake-parts": "flake-parts_6", "hercules-ci-effects": "hercules-ci-effects_2", "nixpkgs": [ "nixpkgs" @@ -1613,6 +1631,18 @@ } }, "nixpkgs-lib": { + "locked": { + "lastModified": 1719876945, + "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + } + }, + "nixpkgs-lib_2": { "locked": { "lastModified": 1714640452, "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", @@ -1624,7 +1654,7 @@ "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" } }, - "nixpkgs-lib_2": { + "nixpkgs-lib_3": { "locked": { "lastModified": 1719708727, "narHash": "sha256-XFNKtyirrGNdehpg7lMNm1skEcBApjqGhaHc/OI95HY=", @@ -1639,7 +1669,7 @@ "type": "github" } }, - "nixpkgs-lib_3": { + "nixpkgs-lib_4": { "locked": { "dir": "lib", "lastModified": 1698611440, @@ -1874,7 +1904,7 @@ "inputs": { "devshell": "devshell", "flake-compat": "flake-compat_5", - "flake-parts": "flake-parts_7", + "flake-parts": "flake-parts_8", "git-hooks": "git-hooks_2", "home-manager": "home-manager_3", "nix-darwin": "nix-darwin", @@ -3530,6 +3560,7 @@ "doom-emacs-config": "doom-emacs-config", "doomemacs": "doomemacs", "emacs-overlay": "emacs-overlay", + "flake-parts": "flake-parts_2", "home-manager": "home-manager_2", "hyprland": "hyprland", "hyprland-plugins": "hyprland-plugins", @@ -3578,7 +3609,7 @@ "schizofox": { "inputs": { "flake-compat": "flake-compat_7", - "flake-parts": "flake-parts_8", + "flake-parts": "flake-parts_9", "home-manager": "home-manager_4", "nixpak": [ "nixpak" @@ -3606,7 +3637,7 @@ "searx-randomizer": { "inputs": { "crane": "crane", - "flake-parts": "flake-parts_9", + "flake-parts": "flake-parts_10", "nixpkgs": [ "schizofox", "nixpkgs" diff --git a/flake.nix b/flake.nix index f3057f3..3c8147a 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,13 @@ { description = "My NixOS config flake"; - outputs = inputs @ {nixpkgs, ...}: { - inherit (nixpkgs) lib; + outputs = inputs: { + inherit (inputs.nixpkgs) lib; nixosConfigurations = import ./hosts {inherit inputs;}; }; inputs = { + # what am I doing to this config help + flake-parts.url = "github:hercules-ci/flake-parts"; + # Unstable nixpkgs baby! nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # nixpkgs for wayland diff --git a/hosts/vali/hermit/configuration.nix b/hosts/vali/hermit/configuration.nix index 1531e93..2eb677c 100644 --- a/hosts/vali/hermit/configuration.nix +++ b/hosts/vali/hermit/configuration.nix @@ -88,7 +88,7 @@ editors = { emacs = { enable = false; - doom.enable = false; + doom.enable = true; }; helix.enable = true; kakoune.enable = true; diff --git a/hosts/vali/hermit/profile.nix b/hosts/vali/hermit/profile.nix index 895d6ad..3bfc0be 100644 --- a/hosts/vali/hermit/profile.nix +++ b/hosts/vali/hermit/profile.nix @@ -7,6 +7,5 @@ _: { ../../../options/common/docs.nix ../../../options/common/gpu/nvidia.nix ../../../options/desktop/monitors.nix - ../../../overlay.nix ]; } diff --git a/lib/options.nix b/lib/options.nix deleted file mode 100644 index 2393d68..0000000 --- a/lib/options.nix +++ /dev/null @@ -1,16 +0,0 @@ -# Taken from: https://github.com/hlissner/dotfiles/blob/master/lib/options.nix -{lib, ...}: let - inherit (lib) mkOption types; -in { - mkOpt = type: default: mkOption {inherit type default;}; - - mkOpt' = type: default: description: - mkOption {inherit type default description;}; - - mkBoolOpt = default: - mkOption { - inherit default; - type = types.bool; - example = true; - }; -} diff --git a/lib/shells/coreboot.nix b/lib/shells/coreboot.nix deleted file mode 100644 index 87f60b7..0000000 --- a/lib/shells/coreboot.nix +++ /dev/null @@ -1,27 +0,0 @@ -let - nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11"; - - pkgs = import nixpkgs { - config = {}; - overlays = []; - }; -in - pkgs.mkShellNoCC { - packages = with pkgs; [ - m4 - bison - ncurses - gcc - clang - gnat - zlib - flex - pkg-config - curl - zlib - coreboot-toolchain.x64 - ]; - - GREETING = "You're now in the coreboot build shell!;"; - shellHook = ''cd /home/vali/repos/coreboot && echo $GREETING''; - } diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 1d03645..611aa64 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -8,7 +8,7 @@ }: with lib; let cfg = config.modules.editors.emacs; - username = config.modules.other.system.username; + inherit (config.modules.other.system) username; repoUrl = inputs.doomemacs; configRepoUrl = inputs.doom-emacs-config; emacs-desktop-symbol = pkgs.makeDesktopItem { @@ -24,18 +24,17 @@ in { config = mkIf cfg.enable { ## Emacs itself as an overlay - nixpkgs.overlays = [inputs.emacs-overlay.overlay]; - + #nixpkgs.overlays = [inputs.emacs-overlay.overlay]; + services.emacs = { + enable = true; + package = pkgs.emacs29-pgtk; + }; environment.systemPackages = with pkgs; [ binutils # native-comp needs 'as', provided by this - # 28.2 + native-comp - ((emacsPackagesFor emacsNativeComp).emacsWithPackages - (epkgs: [epkgs.vterm])) - emacs-desktop-symbol ## Doom dependencies git - (ripgrep.override {withPCRE2 = true;}) + ripgrep gnutls # for TLS connectivity ## Optional dependencies @@ -45,20 +44,17 @@ in { ## Module dependencies # :checkers spell - (aspellWithDicts (ds: with ds; [en en-computers en-science])) + (aspellWithDicts (ds: with ds; [en en-computers en-science de])) # :tools editorconfig editorconfig-core-c # per-project style config # :tools lookup & :lang org +roam sqlite # :lang latex & :lang org (latex previews) - texlive.combined.scheme-medium # :lang beancount beancount ]; - home-manager.users.${username}.home.sessionPath = ["/home/vali/.config/emacs/bin"]; - - # modules.shell.zsh.rcFiles = [ "${configDir}/emacs/aliases.zsh" ]; + environment.variables.PATH = ["/home/vali/.config/emacs/bin"]; fonts.fonts = [pkgs.emacs-all-the-icons-fonts]; diff --git a/modules/editors/kakoune/default.nix b/modules/editors/kakoune/default.nix index 9db817b..55c1958 100644 --- a/modules/editors/kakoune/default.nix +++ b/modules/editors/kakoune/default.nix @@ -1 +1,50 @@ -_: {imports = [./kakoune.nix];} +{ + config, + lib, + pkgs, +}: let + inherit (config.modules.other.system) username; + cfg = config.modules.editors.kakoune; + inherit (lib) mkIf mkEnableOption; +in { + options.modules.editors.kakoune.enable = mkEnableOption "kakoune"; + config.home-manager.users.${username}.programs.kakoune = mkIf cfg.enable { + enable = true; + config = { + autoComplete = true; + autoReload = true; + indentWidth = 4; + tabStop = 4; + incrementalSearch = false; + numberLines = { + enable = true; + relative = true; + highlightCursor = true; + separator = "|"; + }; + + scrollOff = { + lines = 4; + columns = 4; + }; + ui = { + enableMouse = true; + assistant = "none"; + statusLine = "bottom"; + wrapLines = { + enable = true; + indent = true; + word = true; + }; + }; + plugins = with pkgs.kakounePlugins; [ + auto-pairs-kak + fzf-kak + powerline-kak + byline-kak + kakoune-lsp + ]; + }; + }; +} + diff --git a/lib/default.nix b/modules/editors/kakoune/mappings.nix similarity index 100% rename from lib/default.nix rename to modules/editors/kakoune/mappings.nix diff --git a/modules/editors/nvf/lua/core.lua b/modules/editors/nvf/lua/core.lua index 617e954..d3f9832 100644 --- a/modules/editors/nvf/lua/core.lua +++ b/modules/editors/nvf/lua/core.lua @@ -12,7 +12,7 @@ local options = { backspace = { 'indent', 'eol', 'start' }, -- backspace through everything in insert mode hidden = true, -- Enable background buffers history = 100, -- Remember N lines in history - lazyredraw = false, -- Faster scrolling if enabled, breaks noice + lazyredraw = true, -- Faster scrolling if enabled, breaks noice synmaxcol = 240, -- Max column for syntax highlight updatetime = 250, -- ms to wait for trigger an event diff --git a/modules/editors/nvf/lua/misc/neovide.lua b/modules/editors/nvf/lua/misc/neovide.lua index 1b8845d..75ae6c9 100644 --- a/modules/editors/nvf/lua/misc/neovide.lua +++ b/modules/editors/nvf/lua/misc/neovide.lua @@ -1,30 +1,30 @@ if vim.g.neovide then - local vks = vim.keymap.set + local vks = vim.keymap.set - vim.g.neovide_scale_factor = 1.0 - vim.g.minianimate_disable = true - vim.g.neovide_window_blurred = true - vim.g.neovide_transparency = 0.80 - vim.g.neovide_show_border = true - vim.g.neovide_input_macos_alt_is_meta = true - vim.g.neovide_cursor_animate_command_line = false -- noice incompat - vim.g.neovide_cursor_smooth_blink = true - vim.g.neovide_cursor_vfx_mode = 'ripple' + vim.g.neovide_scale_factor = 1.0 + vim.g.minianimate_disable = true + vim.g.neovide_window_blurred = true + vim.g.neovide_transparency = 0.80 + vim.g.neovide_show_border = true + vim.g.neovide_input_macos_alt_is_meta = true + vim.g.neovide_cursor_animate_command_line = true -- noice incompat + vim.g.neovide_cursor_smooth_blink = true + vim.g.neovide_cursor_vfx_mode = 'ripple' - -- keymaps - vks('v', '', '"+y') -- Copy - vks({ 'n', 'v' }, '', '"+P') -- Paste - vks({ 'i', 'c' }, '', '+') -- Paste - vks('t', '', [["+P]]) -- Paste - vks('n', '', function() - vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * 1.1 - end) - vks('n', '', function() - vim.g.neovide_scale_factor = vim.g.neovide_scale_factor / 1.1 - end) - vks({ 'n', 'v', 't', 'i' }, '', [[tabnext]]) - vks({ 'n', 'v', 't', 'i' }, '', [[tabprev]]) - vks({ 'n', 'v', 't', 'i' }, '', [[tabnext #]]) - vks({ 'n', 'v', 't', 'i' }, '', [[tabnew]]) - vks({ 'n', 'v', 't', 'i' }, '', [[tabclose]]) + -- keymaps + vks('v', '', '"+y') -- Copy + vks({ 'n', 'v' }, '', '"+P') -- Paste + vks({ 'i', 'c' }, '', '+') -- Paste + vks('t', '', [["+P]]) -- Paste + vks('n', '', function() + vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * 1.1 + end) + vks('n', '', function() + vim.g.neovide_scale_factor = vim.g.neovide_scale_factor / 1.1 + end) + vks({ 'n', 'v', 't', 'i' }, '', [[tabnext]]) + vks({ 'n', 'v', 't', 'i' }, '', [[tabprev]]) + vks({ 'n', 'v', 't', 'i' }, '', [[tabnext #]]) + vks({ 'n', 'v', 't', 'i' }, '', [[tabnew]]) + vks({ 'n', 'v', 't', 'i' }, '', [[tabclose]]) end diff --git a/modules/editors/nvf/lua/plugins/notify.lua b/modules/editors/nvf/lua/plugins/notify.lua index ff60953..f810e65 100644 --- a/modules/editors/nvf/lua/plugins/notify.lua +++ b/modules/editors/nvf/lua/plugins/notify.lua @@ -1,12 +1,12 @@ -local noice = require('noice') +--local noice = require('noice') local no_top_text = { - opts = { - border = { - text = { top = '' }, + opts = { + border = { + text = { top = '' }, + }, }, - }, } - +--[[ -- luacheck: ignore noice.setup({ cmdline = { @@ -18,7 +18,6 @@ noice.setup({ search_up = no_top_text, }, }, - lsp = { override = { ['cmp.entry.get_documentation'] = true, @@ -70,3 +69,4 @@ noice.setup({ }, }, }) +--]] diff --git a/modules/editors/nvf/plugins/settings/ui.nix b/modules/editors/nvf/plugins/settings/ui.nix index dddc91c..6189bfd 100644 --- a/modules/editors/nvf/plugins/settings/ui.nix +++ b/modules/editors/nvf/plugins/settings/ui.nix @@ -7,7 +7,7 @@ in { programs.neovim-flake.settings.vim = { ui = { - noice.enable = true; + noice.enable = false; colorizer.enable = true; modes-nvim.enable = true; illuminate.enable = true; diff --git a/modules/editors/nvf/settings.nix b/modules/editors/nvf/settings.nix index 55ffb52..90e4e57 100644 --- a/modules/editors/nvf/settings.nix +++ b/modules/editors/nvf/settings.nix @@ -6,7 +6,7 @@ inputs, ... }: let - inherit (builtins) filter map toString path isPath throw; + inherit (builtins) filter map toString path; inherit (lib.filesystem) listFilesRecursive; inherit (lib.strings) hasSuffix fileContents; inherit (lib.attrsets) genAttrs; @@ -64,17 +64,19 @@ in { }; additionalRuntimePaths = [ - (mkRuntimeDir "after") - (mkRuntimeDir "spell") + #(mkRuntimeDir "after") + #(mkRuntimeDir "spell") + ./runtime/spell + ./runtime/after ]; # while I should be doing this in luaConfigRC below # I have come to realise that spellfile contents are # actually **not** loaded when luaConfigRC is used. # as spellfile is a vim thing, this should be fine - configRC.spellfile = entryAnywhere '' - set spellfile=${toString ./spell/runtime/en.utf-8.add} " toString sanitizes the path - ''; + # configRC.spellfile = entryAnywhere '' + # set spellfile=${toString ./runtime/spell/en.utf-8.add} " toString sanitizes the path + # ''; # additional lua configuration that I can append # or, to be more precise, randomly inject into diff --git a/overlay.nix b/overlay.nix deleted file mode 100644 index 4e3e36a..0000000 --- a/overlay.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - inputs, - outputs, - ... -}: let - add_nur = self: super: { - # nur-no-pkgs = import inputs.nur-no-pkgs { pkgs = inputs.nixpkgs.legacyPackages.${profile-config.system}; nurpkgs = inputs.nixpkgs.legacyPackages.${profile-config.system}; }; - nur = import inputs.nur { - pkgs = import inputs.nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - }; # .legacyPackages.${profile-config.system}; - nurpkgs = import inputs.nixpkgs { - system = "x86_64-linux"; - config.allowUnfree = true; - }; # .legacyPackages.${profile-config.system}; - }; - }; -in {nixpkgs.overlays = [add_nur];} diff --git a/parts/lib/builders.nix b/parts/lib/builders.nix new file mode 100644 index 0000000..e69de29