Merge remote-tracking branch 'origin/nixos' into nixos-work

This commit is contained in:
Moritz Böhme 2024-07-02 09:27:52 +02:00
commit 8fcd5b075a
16 changed files with 369 additions and 288 deletions

View file

@ -29,18 +29,24 @@ in
config = mkIf cfg.enable {
my.shell.abbreviations = {
g = "git";
gC = "git clone";
gF = "git pull";
gS = "git switch";
ga = "git add";
gap = "git add --patch";
gr = "git restore";
grp = "git restore --patch";
gb = "git branch";
gc = "git commit";
gco = "git checkout";
gd = "git diff";
gds = "git diff --staged";
gp = "git push";
gf = "git fetch";
gF = "git pull";
gp = "git push";
gr = "git restore";
grm = "git rm --cached";
grp = "git restore --patch";
grps = "git restore --patch --staged";
grs = "git restore --staged";
gs = "git status";
};
home-manager.users.moritz = {

View file

@ -20,10 +20,7 @@ in
config = lib.mkIf cfg.enable {
hardware = {
opengl = {
enable = true;
driSupport = true;
};
opengl.enable = true;
pulseaudio.enable = false;
};
services.xserver = {

View file

@ -24,10 +24,7 @@ in
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = ${concatStringsSep "," cfg.keyboardLayouts}
kb_variant =
kb_model =
kb_options = grp:win_space_toggle,caps:escape
kb_rules =
follow_mouse = 1
@ -104,7 +101,7 @@ in
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
no_gaps_when_only = true
new_is_master = false
new_on_top = false
}
gestures {
@ -229,7 +226,7 @@ in
# Lid open/close
bindl=,switch:on:Lid Switch,exec,monitors="$(hyprctl monitors | grep -c '^Monitor')" && hyprctl keyword monitor "eDP-1, disable" && [ "$monitors" = 1 ] && loginctl lock-session
bindl=,switch:off:Lid Switch,exec, hyprctl keyword monitor "eDP-1, prefered, auto"
bindl=,switch:off:Lid Switch,exec, hyprctl keyword monitor "eDP-1, preferred, auto"
# Extra Config
${cfg.extraConfig}

View file

@ -9,7 +9,7 @@ with lib;
let
cfg = config.my.programs.hyprland;
hyprland = config.programs.hyprland.finalPackage;
hyprland = inputs.hyprland.packages.${pkgs.system}.default;
in
{
options.my.programs.hyprland = {
@ -65,7 +65,7 @@ in
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.default;
package = hyprland;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
};

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, inputs, ... }:
let
cfg = config.my.programs.nvim;
inherit (lib) mkEnableOption mkIf readFile;
cfg = config.my.programs.nvim;
in
{
imports = lib.my.listModulesRec ./plugins;
@ -16,6 +17,10 @@ in
source = ./plugins/snippets;
};
home.packages = with pkgs; [
xdotool # for vimtex
];
programs.neovim = {
enable = true;
package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;

View file

@ -36,10 +36,17 @@ in
{ plugin = pkgs.vimPlugins.cmp-async-path; }
{ plugin = pkgs.vimPlugins.cmp-buffer; }
{ plugin = pkgs.vimPlugins.cmp-cmdline; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp; }
{ plugin = pkgs.vimPlugins.cmp_luasnip; }
{ plugin = pkgs.vimPlugins.cmp-spell; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp-signature-help; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp; }
{ plugin = pkgs.vimPlugins.cmp-spell; }
{
plugin = pkgs.vimUtils.buildVimPlugin {
pname = "cmp-vimtex";
version = lib.my.mkVersionInput inputs.cmp-vimtex;
src = inputs.cmp-vimtex;
};
}
{ plugin = pkgs.vimPlugins.cmp_luasnip; }
{
plugin = pkgs.vimPlugins.copilot-cmp;
opts = { };
@ -210,6 +217,18 @@ in
cmd = [ "ConformInfo" "Format" ];
conf = readFile ./lua/conform.lua;
}
{ plugin = plantuml-syntax; }
{ plugin = pkgs.vimPlugins.plantuml-syntax; }
{
plugin = pkgs.vimPlugins.vimtex;
lazy = false;
conf = /* lua */ ''
vim.g.vimtex_view_method = "zathura"
vim.g.vimtex_mappings_disable = vim.fn.executable("texlab") == 1 and { ["n"] = { "K" } } or {} -- disable `K` as it conflicts with LSP hover if texlab is in path
vim.g.vimtex_quickfix_method = vim.fn.executable("pplatex") == 1 and "pplatex" or "latexlog"
'';
keys = [
{ key = "<localleader>l"; cmd = ""; desc = "+vimtex"; }
];
}
];
}

View file

@ -2,6 +2,7 @@ local conform = require("conform")
local formatters_by_ft = {
["*"] = { "codespell", "trim_whitespace" },
gleam = { "gleam" },
go = { "gofmt" },
json = { "jq" },
lua = { "stylua" },
@ -9,9 +10,9 @@ local formatters_by_ft = {
python = { { "ruff_fix", "isort" }, { "ruff_format", "black" } },
rust = { "rustfmt" },
sh = { "shfmt" },
tex = { "latexindent" },
toml = { "taplo" },
yaml = { "yamlfix" },
gleam = { "gleam" },
}
conform.setup({

View file

@ -69,6 +69,7 @@ cmp.setup({
{ priority = 3, name = "copilot" },
{ priority = 3, name = "nvim_lsp_signature_help" },
{ priority = 4, name = "luasnip" },
{ priority = 4, name = "vimtex" },
}),
})

View file

@ -49,17 +49,17 @@ local on_attach_def = function(client, bufnr)
l = {
function()
lsp_lines.toggle()
if vim.diagnostic.is_disabled() then
vim.diagnostic.enable()
else
if vim.diagnostic.is_enabled() then
vim.diagnostic.disable()
else
vim.diagnostic.enable()
end
end,
"LSP lines",
},
i = {
function()
vim.lsp.inlay_hint.enable(bufnr, not vim.lsp.inlay_hint.is_enabled(bufnr))
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end,
"LSP inlay hints",
},
@ -123,7 +123,6 @@ local servers = {
"bashls",
"gleam",
"gopls",
"nil_ls",
"pylsp",
"ruff_lsp",
"templ",
@ -133,6 +132,16 @@ for _, lsp in ipairs(servers) do
lspconfig_setup(lsp, {})
end
lspconfig_setup("nil_ls", {
settings = {
flake = {
autoArchive = true,
autoEvalInputs = true,
nixpkgsInputName = "nixpkgs",
},
},
})
lspconfig_setup("nixd", {
settings = {
nixd = {

View file

@ -1,8 +1,7 @@
{ pkgs, ... }:
with builtins;
{
config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
config.home-manager.users.moritz.programs.neovim.lazy.plugins = [
(
let
parserDir = pkgs.symlinkJoin {
@ -11,13 +10,14 @@ with builtins;
};
in
{
plugin = nvim-treesitter;
plugin = pkgs.vimPlugins.nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
opts = {
sync_install = false;
auto_install = false;
highlight = {
enable = true;
disable = [ "latex" ];
};
textobjects =
{
@ -60,8 +60,8 @@ with builtins;
'';
priority = 100;
dependencies = [
{ plugin = nvim-treesitter-textobjects; }
{ plugin = nvim-ts-context-commentstring; opts = { }; }
{ plugin = pkgs.vimPlugins.nvim-treesitter-textobjects; }
{ plugin = pkgs.vimPlugins.nvim-ts-context-commentstring; opts = { }; }
];
}
)

View file

@ -12,10 +12,8 @@ in
options.my.programs.sway.enable = mkEnableOption "sway";
config = lib.mkIf cfg.enable {
hardware.opengl = {
enable = true;
driSupport = true;
};
hardware.opengl.enable = true;
environment.loginShellInit = ''
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
exec sway

View file

@ -1,5 +1,6 @@
{ config
, lib
, pkgs
, ...
}: {
## System security tweaks
@ -69,6 +70,7 @@
# SSH
services.openssh = {
package = pkgs.master.openssh; # HACK: to fix CVE-2024-6387
settings = {
# Disable ssh password login
PasswordAuthentication = lib.mkDefault false;