Merge branch 'nixos' into nixos-work

This commit is contained in:
Moritz Böhme 2024-01-26 10:49:49 +01:00
commit 3088f66113
19 changed files with 354 additions and 274 deletions

View file

@ -101,7 +101,6 @@ in
cat = "bat";
rm = "rm -i";
mv = "mv -i";
cd = "__zoxide_z";
nixos-update = "pushd ~/.dotfiles && nix flake update && popd";
};

View file

@ -52,6 +52,7 @@ in
".config/calibre"
".local/state/nvim"
".config/kdeconnect"
".config/github-copilot"
".cat_installer" # eduroam
".mozilla"
"Documents"

View file

@ -1,6 +1,7 @@
{ config
, lib
, pkgs
, inputs
, ...
} @ args:
@ -60,6 +61,7 @@ in
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.default;
};
home-manager.users.moritz = {

View file

@ -26,7 +26,7 @@ in
config.nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
package = pkgs.nix-super;
package = inputs.nix-super.packages.${pkgs.system}.default;
extraOptions = "experimental-features = nix-command flakes";

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, inputs, ... }:
with lib;
let
@ -21,7 +21,7 @@ in
programs.neovim = {
enable = true;
package = pkgs.neovim-nightly;
package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;

View file

@ -26,6 +26,17 @@ vim.opt.updatetime = 300
vim.opt_local.spell = true
vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling
-- Abbreviations for common typos
vim.cmd("cnoreabbrev W! w!")
vim.cmd("cnoreabbrev Q! q!")
vim.cmd("cnoreabbrev Qall! qall!")
vim.cmd("cnoreabbrev Wq wq")
vim.cmd("cnoreabbrev Wa wa")
vim.cmd("cnoreabbrev wQ wq")
vim.cmd("cnoreabbrev WQ wq")
vim.cmd("cnoreabbrev W w")
vim.cmd("cnoreabbrev Q q")
if vim.g.neovide then
vim.opt.guifont = "Fira Code Nerd Font:h10"
vim.g.neovide_scale_factor = 0.7

View file

@ -64,7 +64,7 @@ local on_attach_def = function(client, bufnr)
},
i = {
function()
vim.lsp.inlay_hint(bufnr, nil)
vim.lsp.inlay_hint.enable(bufnr, not vim.lsp.inlay_hint.is_enabled(bufnr))
end,
"LSP inlay hints",
},
@ -102,7 +102,7 @@ local on_attach_def = function(client, bufnr)
}
local timeout = vim.tbl_contains(slow_lsp_servers, client.name, {}) and 500 or 0
vim.defer_fn(function()
vim.lsp.inlay_hint(bufnr, true)
vim.lsp.inlay_hint.enable(bufnr, true)
end, timeout)
end
end
@ -130,12 +130,25 @@ local servers = {
"nil_ls",
"nixd",
"ruff_lsp",
"templ",
"typst_lsp",
}
for _, lsp in ipairs(servers) do
lspconfig_setup(lsp, {})
end
-- Add templ filetype
vim.filetype.add({ extension = { templ = "templ" } })
lspconfig_setup("htmx", {
filetypes = { "html", "templ" },
})
lspconfig_setup("tailwindcss", {
filetypes = { "templ", "astro", "javascript", "typescript", "react" },
init_options = { userLanguages = { templ = "html" } },
})
lspconfig_setup("pylsp", {
settings = {
pylsp = {

View file

@ -1,66 +1,72 @@
{ lib, pkgs, ... }:
{ pkgs, config, ... }:
with builtins;
{
config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
opts = {
sync_install = false;
auto_install = false;
highlight = {
enable = true;
(
let
parserDir = pkgs.symlinkJoin {
name = "tresitter-grammars-all";
paths = pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies;
};
textobjects =
{
select =
{
enable = true;
in
{
plugin = nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
opts = {
sync_install = false;
auto_install = false;
highlight = {
enable = true;
};
textobjects =
{
select =
{
enable = true;
# Automatically jump forward to textobj, similar to targets.vim
lookahead = false;
# Automatically jump forward to textobj, similar to targets.vim
lookahead = false;
keymaps = {
# You can use the capture groups defined in textobjects.scm
"af" = {
query = "@function.outer";
desc = "Select outer part of a function region";
};
"if" = {
query = "@function.inner";
desc = "Select inner part of a function region";
};
"ac" = {
query = "@class.outer";
desc = "Select outer part of a class region";
};
"ic" = {
query = "@class.inner";
desc = "Select inner part of a class region";
keymaps = {
# You can use the capture groups defined in textobjects.scm
"af" = {
query = "@function.outer";
desc = "Select outer part of a function region";
};
"if" = {
query = "@function.inner";
desc = "Select inner part of a function region";
};
"ac" = {
query = "@class.outer";
desc = "Select outer part of a class region";
};
"ic" = {
query = "@class.inner";
desc = "Select inner part of a class region";
};
};
};
};
};
};
conf =
let
parserDir = pkgs.symlinkJoin
{
name = "tresitter-grammars-all";
paths = lib.attrValues (lib.filterAttrs (_: builtins.isAttrs) nvim-treesitter-parsers);
};
in
''
vim.opt.runtimepath:append("${parserDir}")
local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" })
require('nvim-treesitter.configs').setup(final_opts)
};
conf =
''
local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" })
require('nvim-treesitter.configs').setup(final_opts)
'';
init = ''
local runtimepath = vim.opt.runtimepath:get()
table.insert(runtimepath, 4, "${parserDir}")
vim.opt.runtimepath = runtimepath
'';
dependencies = [
{ plugin = nvim-treesitter-textobjects; }
{ plugin = nvim-ts-context-commentstring; opts = { }; }
];
}
priority = 100;
dependencies = [
{ plugin = nvim-treesitter-textobjects; }
{ plugin = nvim-ts-context-commentstring; opts = { }; }
];
}
)
{
plugin = nvim-treesitter-textsubjects;
event = [ "BufReadPost" "BufNewFile" ];
@ -71,9 +77,5 @@ with builtins;
event = [ "BufReadPost" "BufNewFile" ];
opts = { };
}
{
plugin = hmts-nvim;
ft = [ "nix" ];
}
];
}

View file

@ -15,7 +15,7 @@ in
};
avahi = {
enable = true;
nssmdns = true;
nssmdns4 = true;
};
};
};

View file

@ -1,4 +1,5 @@
{ config
, inputs
, lib
, pkgs
, ...
@ -12,7 +13,7 @@ in
options.my.services.timers.enable = mkEnableOption "timers";
options.my.services.timers.package = mkOption {
type = types.package;
default = pkgs.timers;
inherit (inputs.timers.packages.${pkgs.system}) default;
};
config = lib.mkIf cfg.enable {