Merge remote-tracking branch 'origin/nixos' into nixos
This commit is contained in:
commit
d6d2897eb6
55 changed files with 1281 additions and 1052 deletions
|
|
@ -6,14 +6,70 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
nom-system = pkgs.writeShellApplication {
|
||||
nom-system = pkgs.writeFishApplication {
|
||||
name = "nom-system";
|
||||
runtimeInputs = with pkgs; [ nix-output-monitor ];
|
||||
text = ''
|
||||
nom build --no-link "/home/moritz/.dotfiles#nixosConfigurations.$(hostname).config.system.build.toplevel"
|
||||
text = /* fish */ ''
|
||||
nom build --no-link "/home/moritz/.dotfiles#nixosConfigurations.$(hostname).config.system.build.toplevel" $argv
|
||||
'';
|
||||
};
|
||||
nom-system-command = command: "${nom-system}/bin/nom-system && ${command}";
|
||||
nom-system-command = name: command: pkgs.writeFishApplication {
|
||||
inherit name;
|
||||
runtimeInputs = with pkgs; [ nom-system nix ];
|
||||
text = /* fish */ ''
|
||||
nom-system $argv && ${command}
|
||||
'';
|
||||
};
|
||||
|
||||
f = pkgs.writeFishApplication {
|
||||
name = "f";
|
||||
runtimeInputs = with pkgs; [ fzf bat ];
|
||||
text = /* fish */ ''
|
||||
fzf --query "$argv" \
|
||||
--multi \
|
||||
--bind "enter:become($EDITOR {+})" \
|
||||
--preview "bat --color=always --style=header,grid --line-range :500 {+}"
|
||||
'';
|
||||
};
|
||||
|
||||
which-nix = pkgs.writeFishApplication {
|
||||
name = "which-nix";
|
||||
runtimeInputs = with pkgs; [ which coreutils-full ];
|
||||
text = /* fish */ ''
|
||||
readlink -f (which $argv)
|
||||
'';
|
||||
completions = /* fish */ ''
|
||||
complete -c which-nix -fa '(__fish_complete_command)'
|
||||
'';
|
||||
};
|
||||
|
||||
gi = pkgs.writeFishApplication
|
||||
{
|
||||
name = "gi";
|
||||
runtimeInputs = with pkgs; [ fzf gum curl ];
|
||||
text = /* fish */ ''
|
||||
set url https://www.gitignore.io/api
|
||||
|
||||
if test (count $argv) -eq 0
|
||||
set choice ( curl -sL $url/list \
|
||||
| string split "," \
|
||||
| fzf -m \
|
||||
| string join "," )
|
||||
else
|
||||
set choice (string join "," $argv[1..])
|
||||
end
|
||||
|
||||
if gum confirm "Overwrite current .gitignore?"
|
||||
curl -sL $url/$choice > .gitignore
|
||||
else
|
||||
curl -sL $url/$choice >> .gitignore
|
||||
end
|
||||
'';
|
||||
completions = /* fish */ ''
|
||||
set args (curl -sL https://www.gitignore.io/api/list | string split ",")
|
||||
complete -c gi -fa "$args"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
users.users.moritz = {
|
||||
|
|
@ -43,12 +99,8 @@ in
|
|||
cat = "bat";
|
||||
rm = "rm -i";
|
||||
mv = "mv -i";
|
||||
cd = "z";
|
||||
cd = "__zoxide_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";
|
||||
|
||||
latexwatch = ''find -type f -name "*.tex" | entr -c latexmk -pdf -silent'';
|
||||
|
|
@ -60,7 +112,6 @@ in
|
|||
fish.enable = true;
|
||||
git.enable = true;
|
||||
gpg.enable = true;
|
||||
navi.enable = true;
|
||||
nix = {
|
||||
gc.enable = true;
|
||||
optimise.enable = true;
|
||||
|
|
@ -96,12 +147,15 @@ in
|
|||
bottom
|
||||
|
||||
# nix
|
||||
(nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles")
|
||||
(nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles")
|
||||
comma
|
||||
manix
|
||||
nix-index
|
||||
nix-output-monitor
|
||||
nixpkgs-fmt
|
||||
statix
|
||||
manix
|
||||
nix-output-monitor
|
||||
which-nix
|
||||
|
||||
# other
|
||||
bat
|
||||
|
|
@ -110,17 +164,19 @@ in
|
|||
duf
|
||||
entr
|
||||
exa
|
||||
f
|
||||
gi
|
||||
gparted
|
||||
neofetch
|
||||
reptyr
|
||||
ripgrep
|
||||
up
|
||||
vim
|
||||
viu
|
||||
wget
|
||||
vim
|
||||
];
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
fonts.packages = with pkgs; [
|
||||
(nerdfonts.override {
|
||||
fonts = [ "FiraCode" ];
|
||||
})
|
||||
|
|
@ -154,9 +210,15 @@ in
|
|||
enable = true;
|
||||
defaultOptions = [
|
||||
"--height 50%"
|
||||
"--bind alt-j:preview-down,alt-k:preview-up"
|
||||
];
|
||||
};
|
||||
zoxide = {
|
||||
enable = true;
|
||||
options = [
|
||||
"--cmd c"
|
||||
];
|
||||
};
|
||||
zoxide.enable = true;
|
||||
};
|
||||
home = {
|
||||
username = "moritz";
|
||||
|
|
|
|||
|
|
@ -36,7 +36,25 @@ in
|
|||
nix-edit.enable = mkDefault true;
|
||||
nvim.enable = mkDefault true;
|
||||
python.versions."311".enable = mkDefault true;
|
||||
spotify.enable = mkDefault true;
|
||||
spotify-player = {
|
||||
enable = mkDefault true;
|
||||
package = pkgs.spotify-player.overrideAttrs (old: {
|
||||
buildFeatures = lib.lists.remove "notify" (old.buildFeatures or [ ]);
|
||||
});
|
||||
config = {
|
||||
client_id = "3172dbeaf64949728920c58b823bc24b";
|
||||
copy_command = {
|
||||
command = "wl-copy";
|
||||
args = [ ];
|
||||
};
|
||||
enable_cover_image_cache = true;
|
||||
default_device = "spotify-player-daemon";
|
||||
enable_streaming = false;
|
||||
playback_window_position = "Bottom";
|
||||
cover_img_length = 20;
|
||||
cover_img_width = 10;
|
||||
};
|
||||
};
|
||||
ssh.enable = mkDefault true;
|
||||
thunar.enable = mkDefault true;
|
||||
wallpaper.enable = mkDefault true;
|
||||
|
|
@ -47,6 +65,20 @@ in
|
|||
gammastep.enable = true;
|
||||
kdeconnect.enable = mkDefault true;
|
||||
printing.enable = true;
|
||||
spotify-player = {
|
||||
enable = mkDefault true;
|
||||
config = {
|
||||
client_id = "3172dbeaf64949728920c58b823bc24b";
|
||||
device = {
|
||||
name = "spotify-player-daemon";
|
||||
device_type = "computer";
|
||||
volume = 70;
|
||||
bitrate = 320;
|
||||
audio_cache = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
timers.enable = true;
|
||||
wireguard.enable = true;
|
||||
};
|
||||
};
|
||||
|
|
@ -75,6 +107,7 @@ in
|
|||
};
|
||||
services = {
|
||||
illum.enable = true;
|
||||
resolved.enable = true;
|
||||
gnome.gnome-keyring.enable = true;
|
||||
pipewire = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -43,28 +43,22 @@ in
|
|||
# visual mode, but due to fish_cursor_default, is redundant here
|
||||
set fish_cursor_visual block
|
||||
|
||||
# Completions
|
||||
complete -c c -kfa '(zoxide query -l | sed "s|$HOME|~|")'
|
||||
${optionalString config.virtualisation.podman.dockerCompat /* fish */ "complete -c docker -w podman"}
|
||||
|
||||
complete -c timers \
|
||||
-n "__fish_seen_subcommand_from toggle" \
|
||||
-fa '(timers --json l | ${getExe pkgs.jq} -r .[][].name)'
|
||||
|
||||
complete -c timers \
|
||||
-n "__fish_seen_subcommand_from remove" \
|
||||
-fa '(timers --json l | ${getExe pkgs.jq} -r .[][].name)'
|
||||
|
||||
# Variables
|
||||
${exportedVariables}
|
||||
'';
|
||||
functions = {
|
||||
gi = with pkgs; ''
|
||||
set url https://www.gitignore.io/api
|
||||
|
||||
if test (count $argv) -eq 0
|
||||
set choice ( curl -sL $url/list \
|
||||
| string split "," \
|
||||
| ${fzf}/bin/fzf -m \
|
||||
| string join "," )
|
||||
else
|
||||
set choice (string join "," $argv[1..])
|
||||
end
|
||||
|
||||
if ${gum}/bin/gum confirm "Overwrite current .gitignore?"
|
||||
${curl}/bin/curl -sL $url/$choice > .gitignore
|
||||
else
|
||||
${curl}/bin/curl -sL $url/$choice >> .gitignore
|
||||
end
|
||||
'';
|
||||
fish_greeting = "";
|
||||
cheat = "cht.sh $argv | bat -p";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ with lib;
|
|||
let
|
||||
cfg = config.my.programs.hyprland;
|
||||
|
||||
boolToYesNo = bool: if bool then "yes" else "no";
|
||||
|
||||
mkRule = rule: windowRegexes: "windowrulev2 = ${rule},${concatStringsSep "," windowRegexes}";
|
||||
mkRules = rules: windowRegexes: concatStringsSep "\n" (map (flip mkRule windowRegexes) rules);
|
||||
in
|
||||
|
|
@ -58,12 +56,14 @@ in
|
|||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||
|
||||
rounding = 3
|
||||
blur = ${boolToYesNo cfg.blur}
|
||||
blur_size = 3
|
||||
blur_passes = 3
|
||||
blur_new_optimizations = on
|
||||
blur {
|
||||
enabled = ${boolToString cfg.blur}
|
||||
size = 3
|
||||
passes = 3
|
||||
new_optimizations = on
|
||||
}
|
||||
|
||||
drop_shadow = ${boolToYesNo cfg.shadows}
|
||||
drop_shadow = ${boolToString cfg.shadows}
|
||||
shadow_range = 10
|
||||
shadow_render_power = 2
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ in
|
|||
animations {
|
||||
enabled = yes
|
||||
|
||||
# Some default Lanimations, see https://wiki.hyprland.org/Configuring/Animations/ for more
|
||||
# see https://wiki.hyprland.org/Configuring/Animations/ for more
|
||||
|
||||
bezier = sine, 0.445, 0.05, 0.55, 0.95
|
||||
bezier = quad, 0.455, 0.03, 0.515, 0.955
|
||||
|
|
@ -120,16 +120,6 @@ in
|
|||
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||
|
||||
${optionalString cfg.blur ''
|
||||
# Kitty
|
||||
windowrulev2 = opacity 0.95 0.95, class:^kitty$
|
||||
|
||||
# Rofi
|
||||
${mkRules ["float" "opacity 0.85 0.85" "noborder"] ["class:^([rR]ofi)$"]}
|
||||
|
||||
windowrulev2 = opacity 0.85 0.85, floating:1
|
||||
''}
|
||||
|
||||
# Firefox Sharing Indicator
|
||||
${mkRules ["float" "move 49% 40" "noborder" "nofullscreenrequest"] ["title:^(.*Sharing Indicator)$"]}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ with lib;
|
|||
let
|
||||
cfg = config.my.programs.hyprland;
|
||||
|
||||
hyprland = pkgs.hyprland.override { nvidiaPatches = cfg.nvidiaSupport; };
|
||||
hyprland = pkgs.hyprland.override { enableNvidiaPatches = cfg.nvidiaSupport; };
|
||||
in
|
||||
{
|
||||
options.my.programs.hyprland = {
|
||||
|
|
@ -38,7 +38,6 @@ in
|
|||
wallpaper.enable = true;
|
||||
kitty.enable = true;
|
||||
rofi.enable = true;
|
||||
|
||||
};
|
||||
wallpapers.enable = true;
|
||||
services.dunst.enable = true;
|
||||
|
|
@ -62,18 +61,6 @@ in
|
|||
home-manager.users.moritz.programs.waybar = {
|
||||
enable = true;
|
||||
|
||||
# use package with hyprland support for switching workspaces
|
||||
package = pkgs.symlinkJoin {
|
||||
name = "waybar-hyprland";
|
||||
paths = [ pkgs.waybar-hyprland ];
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/waybar \
|
||||
--prefix PATH ":" "${hyprland}/bin"
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
# start using systemd service
|
||||
systemd = {
|
||||
enable = true;
|
||||
|
|
@ -85,14 +72,9 @@ in
|
|||
layer = "top";
|
||||
position = "top";
|
||||
height = 20;
|
||||
modules-left = [ "wlr/workspaces" ];
|
||||
modules-left = [ "hyprland/workspaces" ];
|
||||
modules-center = [ "hyprland/window" ];
|
||||
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
|
||||
modules = {
|
||||
"wlr/workspaces" = {
|
||||
on-click = "activate";
|
||||
};
|
||||
};
|
||||
modules-right = [ "hyprland/language" "network" "memory" "cpu" "battery" "clock" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ in
|
|||
cursor_shape = "underline";
|
||||
window_padding_width = 3;
|
||||
confirm_os_window_close = 0;
|
||||
background_opacity = "0.9";
|
||||
};
|
||||
keybindings = {
|
||||
"ctrl+plus" = "change_font_size all +2.0";
|
||||
|
|
|
|||
|
|
@ -12,14 +12,8 @@ let
|
|||
id = x: x;
|
||||
listToString = sep: f: list: ''{ ${concatStringsSep sep (map f list)} }'';
|
||||
listToStringOneLine = listToString ", ";
|
||||
listToStringMultiLine = listToString ",\n";
|
||||
keybinding =
|
||||
{ key
|
||||
, cmd
|
||||
, func
|
||||
, mode
|
||||
, desc
|
||||
}:
|
||||
listToStringMultiLine' = listToString ",\n" id;
|
||||
keybinding = { key, cmd, func, mode, desc }:
|
||||
let
|
||||
cmdString =
|
||||
if cmd != null
|
||||
|
|
@ -30,42 +24,30 @@ let
|
|||
then func
|
||||
else abort "Either cmd or function must be set"
|
||||
);
|
||||
descString = optionalString (desc != null) "desc = ${quote desc},";
|
||||
in
|
||||
''{ ${quote key}, ${cmdString}, mode = ${quote mode}, ${optionalString (desc != null) "desc = ${quote desc},"} }'';
|
||||
''{ ${quote key}, ${cmdString}, mode = ${quote mode}, ${descString} }'';
|
||||
lazySpecFromPlugin =
|
||||
{ plugin
|
||||
, dependencies
|
||||
, init
|
||||
, conf
|
||||
, lazy
|
||||
, event
|
||||
, enabled
|
||||
, cmd
|
||||
, ft
|
||||
, priority
|
||||
, keys
|
||||
}:
|
||||
listToStringMultiLine id
|
||||
{ plugin, dependencies, init, conf, lazy, event, enabled, cmd, ft, priority, keys }:
|
||||
listToStringMultiLine'
|
||||
([
|
||||
"dir = ${quote plugin}"
|
||||
"name = ${quote plugin.name}"
|
||||
"lazy = ${boolToString lazy}"
|
||||
"name = ${quote (getName plugin)}"
|
||||
]
|
||||
++ (optional (lazy != null) "lazy = ${boolToString lazy}")
|
||||
++ (optional (!enabled) "enabled = ${boolToString enabled}")
|
||||
++ (optional (dependencies != [ ]) "dependencies = ${listToStringMultiLine id (map lazySpecFromPlugin dependencies)}")
|
||||
++ (optional (dependencies != [ ]) "dependencies = ${listToStringMultiLine' (map lazySpecFromPlugin dependencies)}")
|
||||
++ (optional (init != null) "init = function(plugin)\n${toString init}\nend")
|
||||
++ (optional (conf != null) "config = function(plugin, opts)\n${toString conf}\nend")
|
||||
++ (optional (keys != [ ]) "keys = ${listToStringMultiLine id (map keybinding keys)}")
|
||||
++ (optional (keys != [ ]) "keys = ${listToStringMultiLine' (map keybinding keys)}")
|
||||
++ (optional (event != [ ]) "event = ${listToStringOneLine quote event}")
|
||||
++ (optional (cmd != [ ]) "cmd = ${listToStringOneLine quote cmd}")
|
||||
++ (optional (ft != [ ]) "ft = ${listToStringOneLine quote ft}")
|
||||
++ (optional (priority != 50) "priority = ${toString priority}")
|
||||
++ (optional (priority != null) "priority = ${toString priority}")
|
||||
);
|
||||
lazySpecs = listToStringMultiLine id (map lazySpecFromPlugin cfg.plugins);
|
||||
lazy = ''
|
||||
require("lazy").setup({
|
||||
${lazySpecs}
|
||||
})
|
||||
lazySpecs = listToStringMultiLine' (map lazySpecFromPlugin cfg.plugins);
|
||||
lazy = /* lua */ ''
|
||||
require("lazy").setup(${lazySpecs})
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
|
@ -86,7 +68,7 @@ in
|
|||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Lua code to be executed when the plugin is loaded.
|
||||
Lua function to be executed when the plugin is loaded.
|
||||
'';
|
||||
};
|
||||
dependencies = mkOption {
|
||||
|
|
@ -111,8 +93,8 @@ in
|
|||
'';
|
||||
};
|
||||
lazy = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to load the plugin lazily.
|
||||
'';
|
||||
|
|
@ -145,8 +127,8 @@ in
|
|||
'';
|
||||
};
|
||||
priority = mkOption {
|
||||
type = int;
|
||||
default = 50;
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
description = ''
|
||||
Priority to load the plugin.
|
||||
'';
|
||||
|
|
@ -213,7 +195,17 @@ in
|
|||
else neovide
|
||||
)
|
||||
];
|
||||
|
||||
xdg.configFile."nvim/init.lua" = {
|
||||
source =
|
||||
let
|
||||
text = lib.concatLines [ (builtins.readFile ./options.lua) lazy ];
|
||||
in
|
||||
pkgs.runCommand "init.lua" { inherit text; } ''
|
||||
touch $out
|
||||
echo -n "$text" > $out
|
||||
${getExe pkgs.stylua} $out
|
||||
'';
|
||||
};
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
package = pkgs.neovim-nightly;
|
||||
|
|
@ -221,28 +213,35 @@ in
|
|||
vimdiffAlias = true;
|
||||
withNodeJs = true;
|
||||
withPython3 = true;
|
||||
extraLuaConfig = lib.concatLines [ (builtins.readFile ./options.lua) lazy ];
|
||||
extraPackages = with pkgs; [
|
||||
alejandra
|
||||
black
|
||||
deadnix
|
||||
isort
|
||||
jq
|
||||
nil
|
||||
nixpkgs-fmt
|
||||
nodePackages.bash-language-server
|
||||
nodePackages.cspell
|
||||
rustfmt
|
||||
shellcheck
|
||||
shfmt
|
||||
statix
|
||||
stylua
|
||||
sumneko-lua-language-server
|
||||
taplo
|
||||
typst
|
||||
typst-lsp
|
||||
yamlfmt
|
||||
];
|
||||
extraPython3Packages = ps:
|
||||
let
|
||||
plugins = map (getAttr "plugin") cfg.plugins;
|
||||
depAttrName = "python3Dependencies";
|
||||
filtered = filter (hasAttr depAttrName) plugins;
|
||||
funcs = map (getAttr depAttrName) filtered;
|
||||
in
|
||||
foldl (list: f: list ++ (f ps)) [ ] funcs;
|
||||
extraPackages = with pkgs;
|
||||
[
|
||||
alejandra
|
||||
black
|
||||
deadnix
|
||||
isort
|
||||
jq
|
||||
nil
|
||||
nixpkgs-fmt
|
||||
nodePackages.bash-language-server
|
||||
rustfmt
|
||||
shellcheck
|
||||
shfmt
|
||||
statix
|
||||
stylua
|
||||
sumneko-lua-language-server
|
||||
taplo
|
||||
typst
|
||||
typst-lsp
|
||||
yamlfmt
|
||||
];
|
||||
plugins = [
|
||||
pkgs.vimPlugins.lazy-nvim
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ require("catppuccin").setup({
|
|||
enabled = true,
|
||||
},
|
||||
treesitter = true,
|
||||
telekasten = true,
|
||||
telescope = true,
|
||||
lsp_trouble = true,
|
||||
which_key = true,
|
||||
|
|
|
|||
2
modules/programs/nvim/plugins/codeium-vim.lua
Normal file
2
modules/programs/nvim/plugins/codeium-vim.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
-- dont show ghost text
|
||||
vim.g.codeium_render = false
|
||||
6
modules/programs/nvim/plugins/coq-nvim.lua
Normal file
6
modules/programs/nvim/plugins/coq-nvim.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
vim.g.coq_settings = {
|
||||
auto_start = "shut-up",
|
||||
keymap = {
|
||||
jump_to_mark = "<c-n>",
|
||||
},
|
||||
}
|
||||
4
modules/programs/nvim/plugins/coq-thirdparty.lua
Normal file
4
modules/programs/nvim/plugins/coq-thirdparty.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require("coq_3p")({
|
||||
{ src = "orgmode", short_name = "ORG" },
|
||||
{ src = "codeium", short_name = "COD" },
|
||||
})
|
||||
|
|
@ -20,7 +20,6 @@ with builtins;
|
|||
{ key = "="; cmd = "<cmd>Format<cr>"; desc = "format (formatter)"; }
|
||||
];
|
||||
conf = readFile ./formatter-nvim.lua;
|
||||
dependencies = [{ plugin = which-key-nvim; }];
|
||||
}
|
||||
{
|
||||
plugin = oil-nvim;
|
||||
|
|
@ -31,18 +30,11 @@ with builtins;
|
|||
{ plugin = nvim-web-devicons; }
|
||||
];
|
||||
}
|
||||
{ plugin = nvim-ts-context-commentstring; }
|
||||
{
|
||||
plugin = mini-nvim;
|
||||
lazy = false;
|
||||
conf = readFile ./mini-nvim.lua;
|
||||
}
|
||||
{
|
||||
plugin = noice-nvim;
|
||||
lazy = false;
|
||||
conf = readFile ./noice-nvim.lua;
|
||||
dependencies = [{ plugin = nui-nvim; }];
|
||||
}
|
||||
{
|
||||
plugin = trouble-nvim;
|
||||
keys = [
|
||||
|
|
@ -55,7 +47,7 @@ with builtins;
|
|||
{ key = "<leader>st"; cmd = "<cmd>TodoTelescope<cr>"; desc = "Todo"; }
|
||||
{
|
||||
key = "[q";
|
||||
func = ''function()
|
||||
func = /* lua */ ''function()
|
||||
if require("trouble").is_open() then
|
||||
require("trouble").previous({ skip_groups = true, jump = true })
|
||||
else
|
||||
|
|
@ -66,7 +58,7 @@ with builtins;
|
|||
}
|
||||
{
|
||||
key = "]q";
|
||||
func = ''function()
|
||||
func = /* lua */ ''function()
|
||||
if require("trouble").is_open() then
|
||||
require("trouble").next({ skip_groups = true, jump = true })
|
||||
else
|
||||
|
|
@ -82,28 +74,6 @@ with builtins;
|
|||
{ plugin = nvim-web-devicons; }
|
||||
];
|
||||
}
|
||||
{
|
||||
plugin = nvim-cmp;
|
||||
conf = readFile ./nvim-cmp.lua;
|
||||
event = [ "InsertEnter" ];
|
||||
dependencies = [
|
||||
{ plugin = cmp-async-path; }
|
||||
{ plugin = cmp-nvim-lsp; }
|
||||
{ plugin = cmp_luasnip; }
|
||||
{
|
||||
plugin = copilot-cmp;
|
||||
dependencies = [
|
||||
{
|
||||
plugin = copilot-lua;
|
||||
conf = readFile ./copilot-lua.lua;
|
||||
dependencies = [{ plugin = which-key-nvim; }];
|
||||
}
|
||||
];
|
||||
}
|
||||
{ plugin = friendly-snippets; }
|
||||
{ plugin = luasnip; }
|
||||
];
|
||||
}
|
||||
{
|
||||
plugin = todo-comments-nvim;
|
||||
event = [ "BufReadPost" "BufNewFile" ];
|
||||
|
|
@ -141,7 +111,7 @@ with builtins;
|
|||
}
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
event = [ "BufReadPre" "BufNewFile" ];
|
||||
event = [ "BufRead" "BufNewFile" ];
|
||||
conf = readFile ./nvim-lspconfig.lua;
|
||||
dependencies = [
|
||||
{
|
||||
|
|
@ -153,26 +123,41 @@ with builtins;
|
|||
];
|
||||
}
|
||||
{ plugin = which-key-nvim; }
|
||||
{ plugin = lspkind-nvim; }
|
||||
{ plugin = lsp_lines-nvim; }
|
||||
{
|
||||
plugin = lspsaga-nvim-original;
|
||||
plugin = nvim-ufo;
|
||||
conf = readFile ./nvim-ufo.lua;
|
||||
dependencies = [
|
||||
{ plugin = nvim-web-devicons; }
|
||||
{ plugin = nvim-treesitter.withAllGrammars; }
|
||||
{ plugin = promise-async; }
|
||||
];
|
||||
}
|
||||
{
|
||||
plugin = nvim-ufo;
|
||||
plugin = neodev-nvim;
|
||||
conf = readFile ./neodev-nvim.lua;
|
||||
}
|
||||
{
|
||||
plugin = inc-rename-nvim;
|
||||
conf = /* lua */ ''
|
||||
require("inc_rename").setup {
|
||||
input_buffer_type = "dressing",
|
||||
}
|
||||
'';
|
||||
dependencies = [
|
||||
{ plugin = promise-async; }
|
||||
{
|
||||
plugin = dressing-nvim;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
plugin = statuscol-nvim;
|
||||
event = [ "VeryLazy" ];
|
||||
conf = readFile ./statuscol-nvim.lua;
|
||||
}
|
||||
{
|
||||
plugin = vim-fugitive;
|
||||
event = [ "VeryLazy" ];
|
||||
}
|
||||
{
|
||||
plugin = vim-tmux-navigator;
|
||||
|
|
@ -200,9 +185,9 @@ with builtins;
|
|||
conf = readFile ./smartcolumn-nvim.lua;
|
||||
}
|
||||
{
|
||||
plugin = telescope-fzf-native-nvim;
|
||||
conf = readFile ./telescope-fzf-native-nvim.lua;
|
||||
plugin = telescope-nvim;
|
||||
cmd = [ "Telescope" ];
|
||||
conf = builtins.readFile ./telescope.lua;
|
||||
keys = [
|
||||
{ key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; }
|
||||
{ key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; }
|
||||
|
|
@ -216,17 +201,11 @@ with builtins;
|
|||
{ key = "<leader>sk"; cmd = "<cmd>Telescope keymaps<cr>"; desc = "Keymaps"; }
|
||||
{ key = "<leader>ss"; cmd = "<cmd>Telescope lsp_document_symbols<cr>"; desc = "Symbols (Document)"; }
|
||||
{ key = "<leader>sS"; cmd = "<cmd>Telescope lsp_workspace_symbols<cr>"; desc = "Symbols (Workspace)"; }
|
||||
{ key = "<leader>gc"; cmd = "<cmd>Telescope git_commits<cr>"; desc = "Commits"; }
|
||||
{ key = "<leader>gs"; cmd = "<cmd>Telescope git_status<cr>"; desc = "Status"; }
|
||||
];
|
||||
dependencies = [
|
||||
{
|
||||
plugin = telescope-nvim;
|
||||
dependencies = [
|
||||
{ plugin = plenary-nvim; }
|
||||
{ plugin = which-key-nvim; }
|
||||
];
|
||||
}
|
||||
{ plugin = plenary-nvim; }
|
||||
{ plugin = which-key-nvim; }
|
||||
{ plugin = telescope-fzf-native-nvim; }
|
||||
];
|
||||
}
|
||||
{
|
||||
|
|
@ -241,7 +220,76 @@ with builtins;
|
|||
{
|
||||
plugin = comment-nvim;
|
||||
event = [ "BufReadPost" "BufNewFile" ];
|
||||
conf = "require('Comment').setup()";
|
||||
conf = /* lua */ ''
|
||||
require("Comment").setup()
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = telekasten-nvim;
|
||||
dependencies = [
|
||||
{ plugin = telescope-nvim; }
|
||||
{ plugin = which-key-nvim; }
|
||||
];
|
||||
cmd = [ "Telekasten" ];
|
||||
keys = [
|
||||
{ key = "<leader>z"; cmd = "<cmd>Telekasten<cr>"; desc = "zettelkasten"; }
|
||||
];
|
||||
conf = builtins.readFile ./zettelkasten-nvim.lua;
|
||||
}
|
||||
{
|
||||
plugin = markdown-preview-nvim;
|
||||
ft = [ "md" ];
|
||||
}
|
||||
{
|
||||
plugin = coq_nvim;
|
||||
event = [ "BufReadPost" "BufNewFile" ];
|
||||
init = builtins.readFile ./coq-nvim.lua;
|
||||
dependencies = [
|
||||
{
|
||||
plugin = coq-thirdparty;
|
||||
conf = builtins.readFile ./coq-thirdparty.lua;
|
||||
dependencies = [
|
||||
{
|
||||
plugin = codeium-vim;
|
||||
init = builtins.readFile ./codeium-vim.lua;
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
plugin = coq-artifacts;
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
plugin = nvim-surround;
|
||||
event = [ "BufReadPost" "BufNewFile" ];
|
||||
conf = /* lua */ ''
|
||||
require("nvim-surround").setup({})
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = nvim-treesitter-context;
|
||||
event = [ "BufReadPost" "BufNewFile" ];
|
||||
conf = /* lua */ ''
|
||||
require("treesitter-context").setup({})
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = dressing-nvim;
|
||||
event = [ "VeryLazy" ];
|
||||
}
|
||||
{
|
||||
plugin = hmts-nvim;
|
||||
ft = [ "nix" ];
|
||||
}
|
||||
{
|
||||
plugin = zen-mode-nvim;
|
||||
keys = [
|
||||
{ key = "<leader>tz"; cmd = "<cmd>ZenMode<cr>"; desc = "Zen mode"; }
|
||||
];
|
||||
dependencies = [
|
||||
{ plugin = twilight-nvim; }
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ require("formatter").setup({
|
|||
log_level = vim.log.levels.WARN,
|
||||
-- All formatter configurations are opt-in
|
||||
filetype = {
|
||||
go = {
|
||||
require("formatter.filetypes.go").gofmt,
|
||||
},
|
||||
json = {
|
||||
require("formatter.filetypes.json").jq,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,22 +1,15 @@
|
|||
require("gitsigns").setup()
|
||||
require("which-key").register({
|
||||
["["] = {
|
||||
h = { "<cmd>Gitsigns prev_hunk<cr>", "Previous hunk" },
|
||||
},
|
||||
["]"] = {
|
||||
h = { "<cmd>Gitsigns next_hunk<cr>", "Next hunk" },
|
||||
},
|
||||
})
|
||||
require("which-key").register({
|
||||
h = {
|
||||
name = "hunk",
|
||||
["[h"] = { "<cmd>Gitsigns prev_hunk<cr>", "Previous hunk" },
|
||||
["]h"] = { "<cmd>Gitsigns next_hunk<cr>", "Next hunk" },
|
||||
["<leader>g"] = {
|
||||
s = { "<cmd>Gitsigns stage_hunk<cr>", "Stage hunk", mode = { "n", "v" } },
|
||||
r = { "<cmd>Gitsigns reset_hunk<cr>", "Reset hunk", mode = { "n", "v" } },
|
||||
S = { "<cmd>Gitsigns stage_buffer<cr>", "Stage buffer" },
|
||||
R = { "<cmd>Gitsigns reset_buffer<cr>", "Reset buffer" },
|
||||
u = { "<cmd>Gitsigns undo_stage_hunk<cr>", "Undo stage hunk" },
|
||||
p = { "<cmd>Gitsigns preview_hunk_inline<cr>", "Preview hunk (inline)" },
|
||||
P = { "<cmd>Gitsigns preview_hunk<cr>", "Preview hunk (float)" },
|
||||
},
|
||||
}, { prefix = "<leader>g" })
|
||||
require("which-key").register({
|
||||
h = { ":<C-U>Gitsigns select_hunk<cr>", "Gitsigns select hunk" },
|
||||
}, { prefix = "i", mode = { "o", "x" } })
|
||||
["ih"] = { ":<C-U>Gitsigns select_hunk<cr>", "gitsigns hunk", mode = { "o", "x" } },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,18 +1,8 @@
|
|||
require("mini.align").setup()
|
||||
require("mini.surround").setup()
|
||||
require("mini.move").setup()
|
||||
require("mini.pairs").setup()
|
||||
require("mini.starter").setup()
|
||||
|
||||
require("mini.tabline").setup()
|
||||
local tabline_current = vim.api.nvim_get_hl(0, { name = "MiniTablineCurrent" })
|
||||
vim.api.nvim_set_hl(0, "MiniTablineCurrent", {
|
||||
fg = tabline_current.fg,
|
||||
bg = tabline_current.bg,
|
||||
bold = true,
|
||||
italic = true,
|
||||
})
|
||||
|
||||
require("mini.statusline").setup({
|
||||
content = {
|
||||
active = function()
|
||||
|
|
|
|||
8
modules/programs/nvim/plugins/neodev-nvim.lua
Normal file
8
modules/programs/nvim/plugins/neodev-nvim.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
require("neodev").setup({
|
||||
override = function(root_dir, library)
|
||||
if root_dir:find("/home/moritz/.dotfiles/", 1, true) == 1 then
|
||||
library.enabled = true
|
||||
library.plugins = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
@ -3,14 +3,12 @@ local null_ls = require("null-ls")
|
|||
null_ls.setup({
|
||||
sources = {
|
||||
-- Code actions
|
||||
null_ls.builtins.code_actions.cspell,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.code_actions.shellcheck,
|
||||
null_ls.builtins.code_actions.statix,
|
||||
-- Completion
|
||||
null_ls.builtins.completion.spell,
|
||||
-- Diagnostics
|
||||
null_ls.builtins.diagnostics.cspell,
|
||||
null_ls.builtins.diagnostics.deadnix,
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
null_ls.builtins.diagnostics.statix,
|
||||
|
|
@ -18,7 +16,6 @@ null_ls.setup({
|
|||
})
|
||||
|
||||
-- disable (c)spell initially
|
||||
null_ls.disable("cspell")
|
||||
null_ls.disable("spell")
|
||||
|
||||
-- make sources toggle able
|
||||
|
|
@ -31,11 +28,5 @@ require("which-key").register({
|
|||
end,
|
||||
"spell",
|
||||
},
|
||||
S = {
|
||||
function()
|
||||
null_ls.toggle("cspell")
|
||||
end,
|
||||
"cspell",
|
||||
},
|
||||
},
|
||||
}, { prefix = "<leader>t" })
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("copilot_cmp").setup()
|
||||
|
||||
local default_sources = {
|
||||
{ name = "async_path", priority = 1 },
|
||||
{ name = "copilot", priority = 2 },
|
||||
{ name = "luasnip", priority = 2 },
|
||||
{ name = "nvim_lsp", priority = 3 },
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format({
|
||||
mode = "symbol", -- show only symbol annotations
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters
|
||||
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
|
||||
symbol_map = {
|
||||
Copilot = "",
|
||||
},
|
||||
}),
|
||||
},
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = default_sources,
|
||||
})
|
||||
|
||||
cmp.setup.filetype("org", {
|
||||
sources = vim.tbl_deep_extend("force", default_sources, {
|
||||
{ name = "buffer", priority = 1 },
|
||||
{ name = "orgmode", priority = 3 },
|
||||
}),
|
||||
})
|
||||
|
|
@ -5,111 +5,101 @@ vim.diagnostic.config({
|
|||
virtual_text = false,
|
||||
})
|
||||
|
||||
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
vim.o.foldcolumn = "1" -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
vim.o.statuscolumn = "%= "
|
||||
-- FIXME: figure out how to put on the other side without having to do a lot of shifting
|
||||
.. "%s" -- sign column
|
||||
.. "%{%" -- evaluate this, and then evaluate what it returns
|
||||
.. "&number ?"
|
||||
.. "(v:relnum ?"
|
||||
-- when showing relative numbers, make sure to pad so things don't shift as you move the cursor
|
||||
.. 'printf("%"..len(line("$")).."s", v:relnum)'
|
||||
.. ":"
|
||||
.. "v:lnum"
|
||||
.. ")"
|
||||
.. ":"
|
||||
.. '""'
|
||||
.. " " -- space between lines and fold
|
||||
.. "%}"
|
||||
.. "%= "
|
||||
.. "%#FoldColumn#" -- highlight group for fold
|
||||
.. "%{" -- expression for showing fold expand/colapse
|
||||
.. "foldlevel(v:lnum) > foldlevel(v:lnum - 1)" -- any folds?
|
||||
.. "? (foldclosed(v:lnum) == -1" -- currently open?
|
||||
.. '? ""' -- point down
|
||||
.. ': ""' -- point to right
|
||||
.. ")"
|
||||
.. ': " "' -- blank for no fold, or inside fold
|
||||
.. "}"
|
||||
.. "%= " -- spacing between end of column and start of text
|
||||
|
||||
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
|
||||
require("which-key").register({
|
||||
z = {
|
||||
R = { require("ufo").openAllFolds, "Open all folds" },
|
||||
M = { require("ufo").closeAllFolds, "Close all folds" },
|
||||
},
|
||||
})
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
-- NOTE for nvim-ufo
|
||||
-- Tell the server the capability of foldingRange,
|
||||
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
require("ufo").setup()
|
||||
|
||||
require("lspsaga").setup({
|
||||
symbol_in_winbar = {
|
||||
enable = false,
|
||||
},
|
||||
lightbulb = {
|
||||
enable = false,
|
||||
enable_in_insert = false,
|
||||
},
|
||||
})
|
||||
-- NOTE https://github.com/neovim/neovim/pull/22405
|
||||
capabilities.didChangeWatchedFiles = {
|
||||
dynamicRegistration = true,
|
||||
}
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local on_attach_def = function(_, bufnr)
|
||||
local on_attach_def = function(client, bufnr)
|
||||
require("which-key").register({
|
||||
K = { "<cmd>Lspsaga hover_doc ++quiet<cr>", "show info" },
|
||||
K = {
|
||||
function()
|
||||
local winid = require("ufo").peekFoldedLinesUnderCursor()
|
||||
if not winid then
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end,
|
||||
"Hover",
|
||||
},
|
||||
["<leader>"] = {
|
||||
l = {
|
||||
d = { "<cmd>Lspsaga show_cursor_diagnostics<cr>", "open diagnostic window" },
|
||||
c = { "<cmd>Lspsaga code_action<cr>", "code action" },
|
||||
r = { "<cmd>Lspsaga rename<cr>", "rename" },
|
||||
i = { "<cmd>Lspsaga hover_doc ++keep<cr>", "show info (sticky)" },
|
||||
name = "lsp",
|
||||
d = { vim.diagnostic.open_float, "Open diagnostic window" },
|
||||
c = { vim.lsp.buf.code_action, "Code action" },
|
||||
r = {
|
||||
function()
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end,
|
||||
"Rename",
|
||||
expr = true,
|
||||
},
|
||||
f = {
|
||||
function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end,
|
||||
"format (lsp)",
|
||||
"Format (lsp)",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
},
|
||||
t = {
|
||||
l = { lsp_lines.toggle, "lsp lines" },
|
||||
l = { lsp_lines.toggle, "LSP lines" },
|
||||
i = {
|
||||
function()
|
||||
vim.lsp.inlay_hint(bufnr, nil)
|
||||
end,
|
||||
"LSP inlay hints",
|
||||
},
|
||||
},
|
||||
},
|
||||
g = {
|
||||
d = { "<cmd>Lspsaga peek_definition<cr>", "Goto definition" },
|
||||
t = { "<cmd>Lspsaga peek_type_definition<cr>", "Goto type defininition" },
|
||||
h = { "<cmd>Lspsaga lsp_finder<CR>", "Lsp finder" },
|
||||
r = { "<cmd>Telescope lsp_references<cr>", "Goto reference" },
|
||||
d = {
|
||||
function()
|
||||
require("telescope.builtin").lsp_definitions({ reuse_win = true })
|
||||
end,
|
||||
"Goto definition",
|
||||
},
|
||||
t = {
|
||||
function()
|
||||
require("telescope.builtin").lsp_type_definitions({ reuse_win = true })
|
||||
end,
|
||||
"Goto type defininition",
|
||||
},
|
||||
r = { "<cmd>Telescope lsp_references<cr>", "Goto references" },
|
||||
D = { vim.lsp.buf.declaration, "Goto declaration" },
|
||||
I = { "<cmd>Telescope lsp_implementations<cr>", "Goto implementation" },
|
||||
K = { vim.lsp.buf.signature_help, "Signature help" },
|
||||
},
|
||||
["["] = {
|
||||
d = { "<cmd>Lspsaga diagnostic_jump_prev<cr>", "Previous diagnostic" },
|
||||
d = { vim.diagnostic.goto_prev, "Previous diagnostic" },
|
||||
},
|
||||
["]"] = {
|
||||
d = { "<cmd>Lspsaga diagnostic_jump_next<cr>", "Next diagnostic" },
|
||||
d = { vim.diagnostic.goto_next, "Next diagnostic" },
|
||||
},
|
||||
}, { buffer = bufnr, silent = true })
|
||||
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
local slow_lsp_servers = {
|
||||
"rust_analyzer",
|
||||
}
|
||||
local timeout = vim.tbl_contains(slow_lsp_servers, client.name, {}) and 500 or 0
|
||||
vim.defer_fn(function()
|
||||
vim.lsp.inlay_hint(bufnr, true)
|
||||
end, timeout)
|
||||
end
|
||||
end
|
||||
|
||||
local lspconfig_default_options = {
|
||||
on_attach = on_attach_def,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 100,
|
||||
},
|
||||
}
|
||||
|
||||
---function to add default options to lspconfig
|
||||
|
|
@ -117,8 +107,9 @@ local lspconfig_default_options = {
|
|||
---@param options table
|
||||
---@return nil
|
||||
local function lspconfig_setup(lsp, options)
|
||||
local final_options = vim.tbl_deep_extend("force", lspconfig_default_options, options)
|
||||
lspconfig[lsp].setup(final_options)
|
||||
local coq_options = require("coq").lsp_ensure_capabilities({})
|
||||
local merged_options = vim.tbl_deep_extend("force", coq_options, lspconfig_default_options, options)
|
||||
lspconfig[lsp].setup(merged_options)
|
||||
end
|
||||
|
||||
local servers = {
|
||||
|
|
@ -126,19 +117,30 @@ local servers = {
|
|||
"nil_ls",
|
||||
"pylsp",
|
||||
"ruff_lsp",
|
||||
"rust_analyzer",
|
||||
"typst_lsp",
|
||||
"gopls",
|
||||
}
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig_setup(lsp, {})
|
||||
end
|
||||
|
||||
lspconfig_setup("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig_setup("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
path = vim.split(package.path, ";"),
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
|
|
@ -156,6 +158,9 @@ lspconfig_setup("lua_ls", {
|
|||
format = {
|
||||
enable = false,
|
||||
},
|
||||
hint = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
74
modules/programs/nvim/plugins/nvim-ufo.lua
Normal file
74
modules/programs/nvim/plugins/nvim-ufo.lua
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
vim.o.foldcolumn = "1" -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
|
||||
local ftMap = {
|
||||
vim = "indent",
|
||||
python = { "indent" },
|
||||
git = "",
|
||||
}
|
||||
|
||||
---@param bufnr number
|
||||
---@return Promise
|
||||
local function customizeSelector(bufnr)
|
||||
local function handleFallbackException(err, providerName)
|
||||
if type(err) == "string" and err:match("UfoFallbackException") then
|
||||
return require("ufo").getFolds(bufnr, providerName)
|
||||
else
|
||||
return require("promise").reject(err)
|
||||
end
|
||||
end
|
||||
|
||||
return require("ufo")
|
||||
.getFolds(bufnr, "lsp")
|
||||
:catch(function(err)
|
||||
return handleFallbackException(err, "treesitter")
|
||||
end)
|
||||
:catch(function(err)
|
||||
return handleFallbackException(err, "indent")
|
||||
end)
|
||||
end
|
||||
|
||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
local suffix = (" %d "):format(endLnum - lnum)
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
table.insert(newVirtText, { suffix, "MoreMsg" })
|
||||
return newVirtText
|
||||
end
|
||||
|
||||
require("ufo").setup({
|
||||
provider_selector = function(_, filetype, _)
|
||||
return ftMap[filetype] or customizeSelector
|
||||
end,
|
||||
fold_virt_text_handler = handler,
|
||||
})
|
||||
|
||||
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
|
||||
require("which-key").register({
|
||||
z = {
|
||||
R = { require("ufo").openAllFolds, "Open all folds" },
|
||||
M = { require("ufo").closeAllFolds, "Close all folds" },
|
||||
},
|
||||
})
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
require("oil").setup()
|
||||
require("which-key").register({
|
||||
d = { require("oil").toggle_float, "directory (oil)" },
|
||||
d = { require("oil").toggle_float, "Directory (oil)" },
|
||||
}, { prefix = "<leader>t" })
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
require("smartcolumn").setup({
|
||||
colorcolumn = 120,
|
||||
colorcolumn = "120",
|
||||
disabled_filetypes = { "help", "text", "markdown", "dashboard" },
|
||||
})
|
||||
|
|
|
|||
22
modules/programs/nvim/plugins/statuscol-nvim.lua
Normal file
22
modules/programs/nvim/plugins/statuscol-nvim.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
local builtin = require("statuscol.builtin")
|
||||
require("statuscol").setup({
|
||||
segments = {
|
||||
{
|
||||
sign = { name = { ".*" }, auto = true },
|
||||
click = "v:lua.ScSa",
|
||||
},
|
||||
{
|
||||
text = { builtin.lnumfunc },
|
||||
click = "v:lua.ScLa",
|
||||
},
|
||||
{
|
||||
sign = { name = { "GitSigns" }, auto = true },
|
||||
click = "v:lua.ScSa",
|
||||
},
|
||||
{
|
||||
text = { builtin.foldfunc, " " },
|
||||
click = "v:lua.ScFa",
|
||||
},
|
||||
},
|
||||
})
|
||||
27
modules/programs/nvim/plugins/zettelkasten-nvim.lua
Normal file
27
modules/programs/nvim/plugins/zettelkasten-nvim.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
local telekasten = require("telekasten")
|
||||
telekasten.setup({
|
||||
home = vim.fn.expand("~/Nextcloud/Notes/zettelkasten"),
|
||||
auto_set_filetype = false,
|
||||
image_subdir = "assets",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
|
||||
pattern = "*/zettelkasten/*",
|
||||
callback = function(_)
|
||||
require("which-key").register({
|
||||
g = {
|
||||
f = { telekasten.follow_link, "Follow link" },
|
||||
r = { telekasten.show_backlinks, "Show backlinks" },
|
||||
},
|
||||
["<leader>"] = {
|
||||
f = {
|
||||
f = { telekasten.find_notes, "Find note" },
|
||||
n = { telekasten.new_note, "New note" },
|
||||
},
|
||||
s = {
|
||||
g = { telekasten.search_note, "Grep notes" },
|
||||
},
|
||||
},
|
||||
}, { buffer = vim.fn.bufnr("%") })
|
||||
end,
|
||||
})
|
||||
33
modules/programs/spotify_player.nix
Normal file
33
modules/programs/spotify_player.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.programs.spotify-player;
|
||||
toml = pkgs.formats.toml { };
|
||||
in
|
||||
{
|
||||
options.my.programs.spotify-player = {
|
||||
enable = mkEnableOption "spotify-player";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.spotify-player;
|
||||
};
|
||||
config = mkOption {
|
||||
inherit (toml) type;
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.moritz = {
|
||||
xdg.configFile."spotify-player/app.toml" = {
|
||||
source = toml.generate "app.toml" cfg.config;
|
||||
};
|
||||
home.packages = [ cfg.package ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -4,30 +4,6 @@ with lib;
|
|||
let
|
||||
cfg = config.my.programs.tmux;
|
||||
|
||||
fzf1 = pkgs.writeShellApplication {
|
||||
name = "fzf1";
|
||||
runtimeInputs = with pkgs; [ coreutils fzf ];
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
options=$(fzf --filter "''$*" < /dev/stdin)
|
||||
|
||||
if [[ -z $options ]]; then
|
||||
exit 1
|
||||
elif [[ $(wc -l <<< "$options") -eq 1 ]]; then
|
||||
selected="$options"
|
||||
else
|
||||
selected=$(echo "$options" | fzf --query="$*")
|
||||
fi
|
||||
|
||||
if [[ -z $selected ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "$selected"
|
||||
'';
|
||||
};
|
||||
|
||||
tmux-switch = pkgs.writeShellApplication {
|
||||
name = "tmux-switch";
|
||||
runtimeInputs = with pkgs; [ tmux ];
|
||||
|
|
@ -41,32 +17,18 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
tmux-sessionizer = pkgs.writeShellApplication {
|
||||
tmux-sessionizer = pkgs.writeFishApplication {
|
||||
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
|
||||
|
||||
${getExe tmux-switch} "$selected_name"
|
||||
'';
|
||||
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd fzf1 tmux-switch ];
|
||||
text = readFile ./tmux-sessionizer/script.fish;
|
||||
completions = readFile ./tmux-sessionizer/completions.fish;
|
||||
};
|
||||
|
||||
tmux-attach = pkgs.writeShellApplication {
|
||||
tmux-attach = pkgs.writeFishApplication {
|
||||
name = "ta";
|
||||
runtimeInputs = with pkgs; [ tmux ];
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
selected=$(tmux list-sessions -F '#{session_name}' | ${getExe fzf1} "$*")
|
||||
${getExe tmux-switch} "$selected"
|
||||
'';
|
||||
runtimeInputs = with pkgs; [ tmux fzf1 tmux-switch ];
|
||||
text = readFile ./tmux-attach/script.fish;
|
||||
completions = readFile ./tmux-attach/completions.fish;
|
||||
};
|
||||
|
||||
in
|
||||
1
modules/programs/tmux/tmux-attach/completions.fish
Normal file
1
modules/programs/tmux/tmux-attach/completions.fish
Normal file
|
|
@ -0,0 +1 @@
|
|||
complete -c ta -f -a '(tmux list-sessions -F "#{session_name}" 2>/dev/null)'
|
||||
5
modules/programs/tmux/tmux-attach/script.fish
Normal file
5
modules/programs/tmux/tmux-attach/script.fish
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
set selected (tmux list-sessions -F '#{session_name}' 2>/dev/null | fzf1 $argv)
|
||||
if not test -n "$selected"
|
||||
exit 1
|
||||
end
|
||||
tmux-switch "$selected"
|
||||
1
modules/programs/tmux/tmux-sessionizer/completions.fish
Normal file
1
modules/programs/tmux/tmux-sessionizer/completions.fish
Normal file
|
|
@ -0,0 +1 @@
|
|||
complete -c ts -f -a '(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec realpath "{}/.." | xargs -I{} basename {} | string replace "." "")'
|
||||
13
modules/programs/tmux/tmux-sessionizer/script.fish
Normal file
13
modules/programs/tmux/tmux-sessionizer/script.fish
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
set selected (fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf1 $argv)
|
||||
|
||||
set selected_name (basename $selected 2>/dev/null | string replace "." "_")
|
||||
|
||||
if not test -n "$selected_name"
|
||||
exit 1
|
||||
end
|
||||
|
||||
if ! tmux has-session -t $selected_name 2> /dev/null
|
||||
tmux new-session -ds $selected_name -c $selected
|
||||
end
|
||||
|
||||
tmux-switch $selected_name
|
||||
|
|
@ -12,265 +12,9 @@ in
|
|||
options.my.services.dunst.enable = mkEnableOption "dunst";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home-manager.users.moritz = {
|
||||
services.dunst = {
|
||||
enable = true;
|
||||
settings = {
|
||||
global = {
|
||||
### Display ###
|
||||
|
||||
# Which monitor should the notifications be displayed on.
|
||||
monitor = 0;
|
||||
|
||||
# Display notification on focused monitor. Possible modes are:
|
||||
# mouse: follow mouse pointer
|
||||
# keyboard: follow window with keyboard focus
|
||||
# none: don't follow anything
|
||||
#
|
||||
# "keyboard" needs a window manager that exports the
|
||||
# _NET_ACTIVE_WINDOW property.
|
||||
# This should be the case for almost all modern window managers.
|
||||
#
|
||||
# If this option is set to mouse or keyboard, the monitor option
|
||||
# will be ignored.
|
||||
follow = "mouse";
|
||||
|
||||
# The geometry of the window:
|
||||
# [{width}]x{height}[+/-{x}+/-{y}]
|
||||
# The geometry of the message window.
|
||||
# The height is measured in number of notifications everything else
|
||||
# in pixels. If the width is omitted but the height is given
|
||||
# ("-geometry x2"), the message window expands over the whole screen
|
||||
# (dmenu-like). If width is 0, the window expands to the longest
|
||||
# message displayed. A positive x is measured from the left, a
|
||||
# negative from the right side of the screen. Y is measured from
|
||||
# the top and down respectively.
|
||||
# The width can be negative. In this case the actual width is the
|
||||
# screen width minus the width defined in within the geometry option.
|
||||
geometry = "0x4-25+25";
|
||||
|
||||
# Show how many messages are currently hidden (because of geometry).
|
||||
indicate_hidden = "yes";
|
||||
|
||||
# Shrink window if it's smaller than the width. Will be ignored if
|
||||
# width is 0.
|
||||
shrink = "no";
|
||||
|
||||
# The transparency of the window. Range: [0; 100].
|
||||
# This option will only work if a compositing window manager is
|
||||
# present (e.g. xcompmgr, compiz, etc.).
|
||||
transparency = "15";
|
||||
|
||||
# The height of the entire notification. If the height is smaller
|
||||
# than the font height and padding combined, it will be raised
|
||||
# to the font height and padding.
|
||||
notification_height = 0;
|
||||
|
||||
# Draw a line of "separator_height" pixel height between two
|
||||
# notifications.
|
||||
# Set to 0 to disable.
|
||||
separator_height = 1;
|
||||
|
||||
# Padding between text and separator.
|
||||
padding = 8;
|
||||
|
||||
# Horizontal padding.
|
||||
horizontal_padding = 10;
|
||||
|
||||
# Defines width in pixels of frame around the notification window.
|
||||
# Set to 0 to disable.
|
||||
frame_width = 0;
|
||||
|
||||
# Sort messages by urgency.
|
||||
sort = "yes";
|
||||
|
||||
# Don't remove messages, if the user is idle (no mouse or keyboard input)
|
||||
# for longer than idle_threshold seconds.
|
||||
# Set to 0 to disable.
|
||||
# A client can set the 'transient' hint to bypass this. See the rules
|
||||
# section for how to disable this if necessary
|
||||
idle_threshold = 120;
|
||||
|
||||
### Text ###
|
||||
|
||||
font = "Monospace 10";
|
||||
|
||||
# The spacing between lines. If the height is smaller than the
|
||||
# font height, it will get raised to the font height.
|
||||
line_height = 0;
|
||||
|
||||
# Possible values are:
|
||||
# full: Allow a small subset of html markup in notifications:
|
||||
# <b>bold</b>
|
||||
# <i>italic</i>
|
||||
# <s>strikethrough</s>
|
||||
# <u>underline</u>
|
||||
#
|
||||
# For a complete reference see
|
||||
# <https://developer.gnome.org/pango/stable/pango-Markup.html>.
|
||||
#
|
||||
# strip: This setting is provided for compatibility with some broken
|
||||
# clients that send markup even though it's not enabled on the
|
||||
# server. Dunst will try to strip the markup but the parsing is
|
||||
# simplistic so using this option outside of matching rules for
|
||||
# specific applications *IS GREATLY DISCOURAGED*.
|
||||
#
|
||||
# no: Disable markup parsing, incoming notifications will be treated as
|
||||
# plain text. Dunst will not advertise that it has the body-markup
|
||||
# capability if this is set as a global setting.
|
||||
#
|
||||
# It's important to note that markup inside the format option will be parsed
|
||||
# regardless of what this is set to.
|
||||
markup = "full";
|
||||
|
||||
# The format of the message. Possible variables are:
|
||||
# %a appname
|
||||
# %s summary
|
||||
# %b body
|
||||
# %i iconname (including its path)
|
||||
# %I iconname (without its path)
|
||||
# %p progress value if set ([ 0%] to [100%]) or nothing
|
||||
# %n progress value if set without any extra characters
|
||||
# %% Literal %
|
||||
# Markup is allowed
|
||||
format = ''
|
||||
%s %p
|
||||
%b'';
|
||||
|
||||
# Alignment of message text.
|
||||
# Possible values are "left", "center" and "right".
|
||||
alignment = "left";
|
||||
|
||||
# Vertical alignment of message text and icon.
|
||||
# Possible values are "top", "center" and "bottom".
|
||||
vertical_alignment = "center";
|
||||
|
||||
# Show age of message if message is older than show_age_threshold
|
||||
# seconds.
|
||||
# Set to -1 to disable.
|
||||
show_age_threshold = 60;
|
||||
|
||||
# Split notifications into multiple lines if they don't fit into
|
||||
# geometry.
|
||||
word_wrap = "yes";
|
||||
|
||||
# When word_wrap is set to no, specify where to make an ellipsis in long lines.
|
||||
# Possible values are "start", "middle" and "end".
|
||||
ellipsize = "middle";
|
||||
|
||||
# Ignore newlines '\n' in notifications.
|
||||
ignore_newline = "no";
|
||||
|
||||
# Stack together notifications with the same content
|
||||
stack_duplicates = true;
|
||||
|
||||
# Hide the count of stacked notifications with the same content
|
||||
hide_duplicate_count = false;
|
||||
|
||||
# Display indicators for URLs (U) and actions (A).
|
||||
show_indicators = "yes";
|
||||
|
||||
### Icons ###
|
||||
|
||||
# Align icons left/right/off
|
||||
icon_position = "left";
|
||||
|
||||
# Scale small icons up to this size, set to 0 to disable. Helpful
|
||||
# for e.g. small files or high-dpi screens. In case of conflict,
|
||||
# max_icon_size takes precedence over this.
|
||||
min_icon_size = 0;
|
||||
|
||||
# Scale larger icons down to this size, set to 0 to disable
|
||||
max_icon_size = 64;
|
||||
|
||||
# Paths to default icons.
|
||||
# icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
|
||||
|
||||
### History ###
|
||||
|
||||
# Should a notification popped up from history be sticky or timeout
|
||||
# as if it would normally do.
|
||||
sticky_history = "yes";
|
||||
|
||||
# Maximum amount of notifications kept in history
|
||||
history_length = 20;
|
||||
|
||||
### Misc/Advanced ###
|
||||
|
||||
# dmenu path.
|
||||
dmenu = "${pkgs.rofi}/bin/rofi -p dunst";
|
||||
|
||||
# Browser for opening urls in context menu.
|
||||
browser = "${pkgs.firefox}/bin/firefox -new-tab";
|
||||
|
||||
# Always run rule-defined scripts, even if the notification is suppressed
|
||||
always_run_script = true;
|
||||
|
||||
# Define the title of the windows spawned by dunst
|
||||
title = "Dunst";
|
||||
|
||||
# Define the class of the windows spawned by dunst
|
||||
class = "Dunst";
|
||||
|
||||
# Print a notification on startup.
|
||||
# This is mainly for error detection, since dbus (re-)starts dunst
|
||||
# automatically after a crash.
|
||||
startup_notification = false;
|
||||
|
||||
# Manage dunst's desire for talking
|
||||
# Can be one of the following values:
|
||||
# crit: Critical features. Dunst aborts
|
||||
# warn: Only non-fatal warnings
|
||||
# mesg: Important Messages
|
||||
# info: all unimportant stuff
|
||||
# debug: all less than unimportant stuff
|
||||
verbosity = "mesg";
|
||||
|
||||
# Define the corner radius of the notification window
|
||||
# in pixel size. If the radius is 0, you have no rounded
|
||||
# corners.
|
||||
# The radius will be automatically lowered if it exceeds half of the
|
||||
# notification height to avoid clipping text and/or icons.
|
||||
corner_radius = 0;
|
||||
|
||||
# Ignore the dbus closeNotification message.
|
||||
# Useful to enforce the timeout set by dunst configuration. Without this
|
||||
# parameter, an application may close the notification sent before the
|
||||
# user defined timeout.
|
||||
ignore_dbusclose = false;
|
||||
|
||||
### Legacy
|
||||
|
||||
# Use the Xinerama extension instead of RandR for multi-monitor support.
|
||||
# This setting is provided for compatibility with older nVidia drivers that
|
||||
# do not support RandR and using it on systems that support RandR is highly
|
||||
# discouraged.
|
||||
#
|
||||
# By enabling this setting dunst will not be able to detect when a monitor
|
||||
# is connected or disconnected which might break follow mode if the screen
|
||||
# layout changes.
|
||||
force_xinerama = false;
|
||||
|
||||
### mouse
|
||||
|
||||
# Defines list of actions for each mouse event
|
||||
# Possible values are:
|
||||
# * none: Don't do anything.
|
||||
# * do_action: If the notification has exactly one action, or one is marked as default,
|
||||
# invoke it. If there are multiple and no default, open the context menu.
|
||||
# * close_current: Close current notification.
|
||||
# * close_all: Close all notifications.
|
||||
# These values can be strung together for each mouse event, and
|
||||
# will be executed in sequence.
|
||||
mouse_left_click = "close_current";
|
||||
mouse_middle_click = "do_action, close_current";
|
||||
mouse_right_click = "close_all";
|
||||
};
|
||||
urgency_low.timeout = 10;
|
||||
urgency_normal.timeeout = 10;
|
||||
urgency_critical.timeout = 0;
|
||||
};
|
||||
};
|
||||
home-manager.users.moritz.services.dunst.enable = true;
|
||||
home-manager.users.moritz.services.dunst.settings.global = {
|
||||
font = "Monospace 10";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
58
modules/services/spotify_player.nix
Normal file
58
modules/services/spotify_player.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
toml = pkgs.formats.toml { };
|
||||
cfg = config.my.services.spotify-player;
|
||||
|
||||
tomlConfig =
|
||||
if cfg.configFile != null
|
||||
then cfg.configFile
|
||||
else toml.generate "app.toml" cfg.config;
|
||||
|
||||
configFolder = pkgs.runCommand "spotify-player-config" { } ''
|
||||
mkdir $out
|
||||
ln -s "${tomlConfig}" $out/app.toml
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.my.services.spotify-player = {
|
||||
enable = mkEnableOption "spotify_player";
|
||||
config = mkOption {
|
||||
inherit (toml) type;
|
||||
default = { };
|
||||
};
|
||||
configFile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
};
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.spotify-player;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.config == { } || cfg.configFile == null;
|
||||
message = "At least one of the options 'config' or 'configFile' must be set.";
|
||||
}
|
||||
{
|
||||
assertion = cfg.config != { } || cfg.configFile != null;
|
||||
message = "Only one of the options 'config' or 'configFile' may be set.";
|
||||
}
|
||||
];
|
||||
systemd.user.services.spotify-player = {
|
||||
after = [ "graphical-session.target" "network.target" ];
|
||||
partOf = [ "graphical-session.target" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
Restart = "always";
|
||||
RestartSec = "1s";
|
||||
ExecStart = "${getExe cfg.package} --daemon --config-folder ${configFolder}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ in
|
|||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
ExitType = "cgroup";
|
||||
Restart = "on-failure";
|
||||
Restart = "always";
|
||||
RestartSec = "1s";
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/rm -rf %h/.SynologyDrive/SynologyDrive.app %h/.SynologyDrive/cloud-connect.pid";
|
||||
ExecStart = "${cfg.package}/bin/synology-drive";
|
||||
|
|
|
|||
32
modules/services/timers.nix
Normal file
32
modules/services/timers.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.services.timers;
|
||||
in
|
||||
{
|
||||
options.my.services.timers.enable = mkEnableOption "timers";
|
||||
options.my.services.timers.package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.timers;
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
systemd.user.services.timers-daemon = {
|
||||
after = [ "graphical-session.target" ];
|
||||
partOf = [ "graphical-session.target" ];
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
RestartSec = "1s";
|
||||
ExecStart = "${getExe cfg.package} daemon";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -17,6 +17,8 @@ in
|
|||
package = pkgs.libvirt;
|
||||
};
|
||||
|
||||
programs.dconf.enable = true;
|
||||
|
||||
users.users.moritz = {
|
||||
extraGroups = [ "libvirtd" ];
|
||||
packages = with pkgs; [ virt-manager virt-viewer ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue