feat: NixOS + darwin equality. feat: vim overhaul.

This commit is contained in:
Kat Inskip 2022-07-08 14:12:02 -07:00 committed by kat
parent 5879913b51
commit 2606e1d874
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
48 changed files with 463 additions and 918 deletions

View file

@ -1,25 +0,0 @@
{ tf, config, lib, pkgs, inputs, ... }: with lib;
let
doom-emacs = pkgs.callPackage inputs.nix-doom-emacs {
doomPrivateDir = "${./doom.d}";
emacsPackages = pkgs.emacsPackagesFor pkgs.emacsPgtkGcc;
bundledPackages = false;
emacsPackagesOverlay = self: super: {
magit-delta = super.magit-delta.overrideAttrs (esuper: {
buildInputs = esuper.buildInputs ++ [ pkgs.git ];
});
straight = self.straightBuild {
pname = "straight";
};
};
};
in
optionalAttrs (builtins.getEnv "CI_PLATFORM" == "impure" && builtins.getEnv "TF_IN_AUTOMATION" != "") {
home.packages = [ doom-emacs pkgs.sqlite ];
home.file.".emacs.d/init.el".text = ''
(load "default.el")
(load-theme 'base16-${elemAt (splitString "." config.base16.alias.default) 1} t)
'';
}

View file

@ -3,7 +3,6 @@
{
home.packages = with pkgs; [
jq
apache-directory-studio
hyperfine
hexyl
tokei

View file

@ -1,76 +1,20 @@
{ config, pkgs, ... }:
let
initvim = pkgs.callPackage
({ stdenv, nodejs }: stdenv.mkDerivation {
name = "init.vim";
src = ./init.vim;
inherit nodejs;
buildInputs = [
nodejs
];
phases = [ "buildPhase" ];
buildPhase = ''
substituteAll $src $out
'';
})
{ };
cocvim = pkgs.callPackage
({ stdenv, elinks, nodejs }: stdenv.mkDerivation {
name = "coc.vim";
src = ./coc.vim;
inherit nodejs;
buildInputs = [
nodejs
];
phases = [ "buildPhase" ];
buildPhase = ''
substituteAll $src $out
'';
})
{ };
in
{
programs.neovim = {
extraConfig = ''
source ${initvim}
source ${cocvim}
luafile ${./init.lua}
'';
extraPackages = with pkgs; [
terraform-ls
];
plugins = with pkgs.vimPlugins; [
neorg
nvim-cmp
plenary-nvim
nvim-base16
nvim-web-devicons
telescope-nvim
coc-yaml
coc-git
coc-css
coc-html
coc-nvim
coc-rust-analyzer
coc-yank
coc-python
coc-json
coc-fzf
nvim-lspconfig
];
coc = {
enable = true;
settings = {
"rust.rustfmt_path" = "${pkgs.rustfmt}/bin/rustfmt";
"rust-analyzer.serverPath" = "rust-analyzer";
"rust-analyzer.updates.prompt" = false;
"rust-analyzer.notifications.cargoTomlNotFound" = false;
"rust-analyzer.notifications.workspaceLoaded" = false;
"rust-analyzer.procMacro.enable" = true;
"rust-analyzer.cargo.loadOutDirsFromCheck" = true;
"rust-analyzer.cargo-watch.enable" = true;
"rust-analyzer.completion.addCallParenthesis" = false; # consider using this?
"rust-analyzer.hoverActions.linksInHover" = true;
"rust-analyzer.diagnostics.disabled" = [
"inactive-code" # it has strange cfg support..?
];
};
};
};
}

View file

@ -0,0 +1,51 @@
local api = vim.api
local cmp = require'cmp'
-----------------------------------------------------------
-- Plugins
-----------------------------------------------------------
-- nvim-cmp
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-y>'] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'neorg' },
}
})
-- lspconfig
require'lspconfig'.terraformls.setup{}
api.nvim_create_autocmd('BufWritePre', {
pattern = '*.tf',
command = 'lua vim.lsp.buf.formatting_sync()'
})
-- neorg
require('neorg').setup {
-- Tell Neorg what modules to load
load = {
['core.defaults'] = {}, -- Load all the default modules
['core.norg.concealer'] = {}, -- Allows for use of icons
['core.norg.dirman'] = { -- Manage your directories with Neorg
config = {
engine = 'nvim-cmp',
workspaces = {
home = '~/neorg'
}
}
}
},
}
-- telescope
api.nvim_set_keymap('n', '<leader>ff', '<cmd>Telescope find_files<cr>', { noremap = true, silent = true })
api.nvim_set_keymap('n', '<leader>fg', '<cmd>Telescope live_grep<cr>', { noremap = true, silent = true })
api.nvim_set_keymap('n', '<leader>fb', '<cmd>Telescope buffers<cr>', { noremap = true, silent = true })
api.nvim_set_keymap('n', '<leader>fh', '<cmd>Telescope help_tags<cr>', { noremap = true, silent = true })

View file

@ -1,37 +0,0 @@
lua << EOF
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-y>'] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'neorg' },
}
})
require('neorg').setup {
-- Tell Neorg what modules to load
load = {
["core.defaults"] = {}, -- Load all the default modules
["core.norg.concealer"] = {}, -- Allows for use of icons
["core.norg.dirman"] = { -- Manage your directories with Neorg
config = {
engine = "nvim-cmp",
workspaces = {
home = "~/neorg"
}
}
}
},
}
EOF
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>