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

This commit is contained in:
Moritz Böhme 2023-07-03 09:37:40 +02:00
commit 92acd80200
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
12 changed files with 96 additions and 147 deletions

View file

@ -45,6 +45,8 @@ in
mv = "mv -i";
cd = "z";
f = "fzf --multi --bind \"enter:become($EDITOR {+})\"";
nixos-switch = nom-system-command "sudo nixos-rebuild switch --flake ~/.dotfiles";
nixos-boot = nom-system-command "sudo nixos-rebuild boot --flake ~/.dotfiles";
nixos-update = "pushd ~/.dotfiles && nix flake update && popd";
@ -100,7 +102,6 @@ in
statix
manix
nix-output-monitor
attic
# other
bat

View file

@ -25,7 +25,7 @@ in
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = de,us
kb_layout = ${concatStringsSep "," cfg.keyboardLayouts}
kb_variant =
kb_model =
kb_options = grp:win_space_toggle,caps:escape

View file

@ -25,6 +25,11 @@ in
description = "enable window shadows";
default = true;
};
keyboardLayouts = mkOption {
type = types.listOf types.str;
description = "list of keyboard layouts";
default = [ "de" "us" ];
};
};
config = mkIf cfg.enable {

View file

@ -239,11 +239,12 @@ in
stylua
sumneko-lua-language-server
taplo
typst
typst-lsp
yamlfmt
];
plugins = with pkgs.vimPlugins; [
lazy-nvim
nvim-treesitter.withAllGrammars
plugins = [
pkgs.vimPlugins.lazy-nvim
];
};
};

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ lib, pkgs, ... }:
with builtins;
{
@ -115,9 +115,22 @@ with builtins;
lazy = false;
}
{
plugin = nvim-treesitter.withAllGrammars;
plugin = nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-treesitter.lua;
conf =
let
parserDir = pkgs.symlinkJoin {
name = "tresitter-grammars-all";
paths = lib.attrValues (lib.filterAttrs (_: builtins.isAttrs) nvim-treesitter-parsers);
};
in
readFile ./nvim-treesitter.lua + ''
vim.opt.runtimepath:append("${parserDir}")
require'nvim-treesitter.configs'.setup {
parser_install_dir = "${parserDir}",
}
'';
dependencies = [
{ plugin = nvim-ts-context-commentstring; }
{
@ -163,7 +176,7 @@ with builtins;
}
{
plugin = vim-tmux-navigator;
lazy = false;
event = [ "VeryLazy" ];
}
{
plugin = gitsigns-nvim;
@ -189,6 +202,7 @@ with builtins;
{
plugin = telescope-fzf-native-nvim;
conf = readFile ./telescope-fzf-native-nvim.lua;
cmd = [ "Telescope" ];
keys = [
{ key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; }
{ key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; }
@ -220,5 +234,14 @@ with builtins;
cmd = [ "StartupTime" ];
conf = readFile ./vim-startuptime.lua;
}
{
plugin = typst-vim;
ft = [ "typst" "typ" ];
}
{
plugin = comment-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = "require('Comment').setup()";
}
];
}

View file

@ -1,11 +1,4 @@
require("mini.align").setup()
require("mini.comment").setup({
options = {
custom_commentstring = function()
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
end,
},
})
require("mini.surround").setup()
require("mini.move").setup()
require("mini.pairs").setup()

View file

@ -127,6 +127,7 @@ local servers = {
"pylsp",
"ruff_lsp",
"rust_analyzer",
"typst_lsp",
}
for _, lsp in ipairs(servers) do
lspconfig_setup(lsp, {})

View file

@ -4,13 +4,13 @@ with lib;
let
cfg = config.my.programs.tmux;
tmux-sessionizer = pkgs.writeShellApplication {
name = "ts";
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd ];
fzf1 = pkgs.writeShellApplication {
name = "fzf1";
runtimeInputs = with pkgs; [ coreutils fzf ];
text = ''
#!/usr/bin/env bash
options=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf --filter "''$*")
options=$(fzf --filter "''$*" < /dev/stdin)
if [[ -z $options ]]; then
exit 1
@ -24,17 +24,48 @@ let
exit 0
fi
echo "$selected"
'';
};
tmux-switch = pkgs.writeShellApplication {
name = "tmux-switch";
runtimeInputs = with pkgs; [ tmux ];
text = ''
#!/usr/bin/env bash
if [[ -z ''${TMUX+x} ]]; then
tmux attach -t "$1"
else
tmux switch-client -t "$1"
fi
'';
};
tmux-sessionizer = pkgs.writeShellApplication {
name = "ts";
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd fzf ];
text = ''
#!/usr/bin/env bash
selected=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | ${getExe fzf1} "$*")
selected_name=$(basename "$selected" | tr . _)
if ! tmux has-session -t="$selected_name" 2> /dev/null; then
tmux new-session -ds "$selected_name" -c "$selected"
fi
if [[ -z ''${TMUX+x} ]]; then
tmux attach -t "$selected_name"
else
tmux switch-client -t "$selected_name"
fi
${getExe tmux-switch} "$selected_name"
'';
};
tmux-attach = pkgs.writeShellApplication {
name = "ta";
runtimeInputs = with pkgs; [ tmux ];
text = ''
#!/usr/bin/env bash
selected=$(tmux list-sessions -F '#{session_name}' | ${getExe fzf1} "$*")
${getExe tmux-switch} "$selected"
'';
};
@ -64,7 +95,10 @@ in
config = mkIf cfg.enable {
my.shell.abbreviations.t = "tmux";
home-manager.users.moritz.home.packages = [ tmux-sessionizer ];
home-manager.users.moritz.home.packages = [
tmux-sessionizer
tmux-attach
];
home-manager.users.moritz.programs = {
tmux = {
enable = true;
@ -72,7 +106,6 @@ in
customPaneNavigationAndResize = true;
keyMode = "vi";
mouse = true;
newSession = true;
prefix = "C-Space";
sensibleOnTop = false;
plugins = with pkgs.tmuxPlugins; [