Merge remote-tracking branch 'origin/nixos' into nixos
This commit is contained in:
commit
ea59147fcd
31 changed files with 1449 additions and 369 deletions
|
|
@ -2,10 +2,16 @@
|
|||
pkgs.writeShellApplication {
|
||||
name = "randomWallpaper";
|
||||
|
||||
runtimeInputs = with pkgs; [ findutils coreutils feh ];
|
||||
runtimeInputs = with pkgs; [ findutils coreutils feh hyprland jq ];
|
||||
|
||||
text = ''
|
||||
wallpaper="$(find ~/.config/wallpapers/ -type f,l | shuf -n 1)"
|
||||
feh --bg-fill "$wallpaper"
|
||||
if [ -z ''${WAYLAND_DISPLAY+x} ]; then
|
||||
feh --bg-fill "$wallpaper"
|
||||
else
|
||||
hyprctl hyprpaper preload "$wallpaper"
|
||||
hyprctl monitors -j | jq '.[].name' | xargs -I{} hyprctl hyprpaper wallpaper '{}',"$wallpaper"
|
||||
hyprctl hyprpaper unload all
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ in
|
|||
options.my.theming = {
|
||||
enable = mkEnableOption "theming";
|
||||
scheme = mkOption {
|
||||
default = "catppuccin-macchiato";
|
||||
type = types.enum [
|
||||
"dracula"
|
||||
"catppuccin-latte"
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 MiB |
BIN
modules/config/wallpapers/little-ships.png
Normal file
BIN
modules/config/wallpapers/little-ships.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 MiB |
|
|
@ -5,6 +5,16 @@
|
|||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
nom-system = pkgs.writeShellApplication {
|
||||
name = "nom-system";
|
||||
runtimeInputs = with pkgs; [ nix-output-monitor ];
|
||||
text = ''
|
||||
nom build --no-link "/home/moritz/.dotfiles#nixosConfigurations.$(hostname).config.system.build.toplevel"
|
||||
'';
|
||||
};
|
||||
nom-system-command = command: "${nom-system}/bin/nom-system && ${command}";
|
||||
in
|
||||
{
|
||||
users.users.moritz = {
|
||||
isNormalUser = true;
|
||||
|
|
@ -39,8 +49,8 @@ with lib;
|
|||
rm = "rm -i";
|
||||
mv = "mv -i";
|
||||
|
||||
nixos-switch = "sudo nixos-rebuild switch --flake ~/.dotfiles";
|
||||
nixos-boot = "sudo nixos-rebuild boot --flake ~/.dotfiles";
|
||||
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'';
|
||||
|
|
@ -52,8 +62,6 @@ with lib;
|
|||
fish.enable = true;
|
||||
git.enable = true;
|
||||
gpg.enable = true;
|
||||
helix.enable = true;
|
||||
kakoune.enable = true;
|
||||
vim.enable = true;
|
||||
};
|
||||
};
|
||||
|
|
@ -67,7 +75,6 @@ with lib;
|
|||
zip
|
||||
|
||||
# file management
|
||||
ranger
|
||||
trash-cli
|
||||
|
||||
# monitoring
|
||||
|
|
@ -80,9 +87,10 @@ with lib;
|
|||
nixpkgs-fmt
|
||||
statix
|
||||
manix
|
||||
nix-output-monitor
|
||||
attic
|
||||
|
||||
# other
|
||||
arduino
|
||||
bat
|
||||
cht-sh
|
||||
du-dust
|
||||
|
|
@ -90,12 +98,9 @@ with lib;
|
|||
entr
|
||||
exa
|
||||
gparted
|
||||
hut
|
||||
lazygit
|
||||
neofetch
|
||||
ripgrep
|
||||
tmux
|
||||
ttyper
|
||||
up
|
||||
viu
|
||||
wget
|
||||
|
|
@ -122,7 +127,7 @@ with lib;
|
|||
};
|
||||
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_NUMERIC = "de_DE.UTF-8";
|
||||
# LC_NUMERIC = "de_DE.UTF-8";
|
||||
LC_PAPER = "de_DE.UTF-8";
|
||||
LC_TIME = "de_DE.UTF-8";
|
||||
};
|
||||
|
|
@ -140,4 +145,10 @@ with lib;
|
|||
};
|
||||
xdg.userDirs.enable = true;
|
||||
};
|
||||
|
||||
system.activationScripts.diff = ''
|
||||
if [ -e /run/current-system ]; then
|
||||
${pkgs.nvd}/bin/nvd --nix-bin-dir ${pkgs.nix}/bin diff /run/current-system/ "$systemConfig"
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,10 @@ with lib; {
|
|||
# config
|
||||
yubikey.enable = true;
|
||||
wallpapers.enable = true;
|
||||
theming.enable = true;
|
||||
shell.aliases = {
|
||||
feh = "feh --auto-zoom --scale-down";
|
||||
theming = {
|
||||
enable = true;
|
||||
scheme = "catppuccin-macchiato";
|
||||
};
|
||||
|
||||
virtualisation = {
|
||||
podman.enable = true;
|
||||
libvirtd.enable = true;
|
||||
|
|
@ -92,9 +91,9 @@ with lib; {
|
|||
kdeconnect.enable = true;
|
||||
mullvad.enable = true;
|
||||
openconnect.enable = true;
|
||||
openvpn.enable = true;
|
||||
printing.enable = true;
|
||||
redshift.enable = true;
|
||||
wireguard.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -104,7 +103,7 @@ with lib; {
|
|||
|
||||
# ripping
|
||||
abcde
|
||||
handbrake
|
||||
stable.handbrake # HACK to fix broken ffmpeg on unstable
|
||||
picard
|
||||
|
||||
# other
|
||||
|
|
@ -123,9 +122,14 @@ with lib; {
|
|||
jetbrains.pycharm-professional
|
||||
|
||||
synology-drive-client
|
||||
|
||||
texlive.combined.scheme-full
|
||||
];
|
||||
|
||||
programs.chromium.enable = true;
|
||||
programs = {
|
||||
chromium.enable = true;
|
||||
nix-ld.enable = true;
|
||||
};
|
||||
|
||||
home-manager.users.moritz = {
|
||||
services.nextcloud-client = {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
./ssh.nix
|
||||
./sway.nix
|
||||
./thunar.nix
|
||||
./vim.nix
|
||||
./nvim
|
||||
./xmonad
|
||||
./zathura.nix
|
||||
./zsh.nix
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@
|
|||
with lib;
|
||||
let
|
||||
cfg = config.my.programs.emacs;
|
||||
myEmacs = with pkgs; ((emacsPackagesFor emacsPgtk).emacsWithPackages
|
||||
(epkgs: [ epkgs.vterm ]));
|
||||
myEmacs = pkgs.emacsPgtkWithPackages;
|
||||
in
|
||||
{
|
||||
options.my.programs.emacs.enable = mkEnableOption "emacs";
|
||||
|
|
@ -22,20 +21,7 @@ in
|
|||
emacs-all-the-icons-fonts
|
||||
(iosevka-bin.override { variant = "aile"; })
|
||||
];
|
||||
users.users.moritz.packages = with pkgs; [
|
||||
myEmacs
|
||||
|
||||
(ripgrep.override { withPCRE2 = true; })
|
||||
# flyspell
|
||||
(hunspellWithDicts [
|
||||
hunspellDicts.en_GB-ize
|
||||
hunspellDicts.en_US
|
||||
hunspellDicts.de_DE
|
||||
])
|
||||
|
||||
# language servers
|
||||
nil
|
||||
];
|
||||
users.users.moritz.packages = [ myEmacs ];
|
||||
home-manager.users.moritz = {
|
||||
home.sessionPath = [ "/home/moritz/.config/emacs/bin/" ];
|
||||
services.emacs = {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
my.shell.abbreviations = {
|
||||
ga = "git add";
|
||||
gap = "git add --patch";
|
||||
gr = "git restore";
|
||||
grp = "git restore --patch";
|
||||
gb = "git branch";
|
||||
gc = "git commit";
|
||||
gco = "git checkout";
|
||||
|
|
@ -48,7 +51,7 @@ in
|
|||
userEmail = cfg.identity.email;
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
merge.conflictstyle = "diff3";
|
||||
merge.conflictstyle = "zdiff3";
|
||||
};
|
||||
delta.enable = true;
|
||||
signing = mkIf cfg.signing {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
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
|
||||
|
|
@ -55,12 +59,12 @@ in
|
|||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||
|
||||
rounding = 3
|
||||
blur = yes
|
||||
blur = ${boolToYesNo cfg.blur}
|
||||
blur_size = 3
|
||||
blur_passes = 3
|
||||
blur_new_optimizations = on
|
||||
|
||||
drop_shadow = yes
|
||||
drop_shadow = ${boolToYesNo cfg.shadows}
|
||||
shadow_range = 10
|
||||
shadow_render_power = 2
|
||||
|
||||
|
|
@ -72,13 +76,21 @@ in
|
|||
|
||||
# Some default Lanimations, see https://wiki.hyprland.org/Configuring/Animations/ for more
|
||||
|
||||
bezier = myBezier, 0.45, 0, 0.55, 1
|
||||
bezier = sine, 0.445, 0.05, 0.55, 0.95
|
||||
bezier = quad, 0.455, 0.03, 0.515, 0.955
|
||||
bezier = cubic, 0.68, -0.55, 0.265, 1.55
|
||||
bezier = quart, 0.77, 0, 0.175, 1
|
||||
bezier = quint, 0.86, 0, 0.07, 1
|
||||
bezier = expo, 1, 0, 0, 1
|
||||
bezier = circ, 0.785, 0.135, 0.15, 0.86
|
||||
bezier = back, 0.68, -0.55, 0.265, 1.55
|
||||
|
||||
animation = windows, 1, 3, myBezier
|
||||
animation = windowsOut, 1, 3, myBezier
|
||||
animation = border, 1, 3, myBezier
|
||||
animation = fade, 1, 3, myBezier
|
||||
animation = workspaces, 1, 3, myBezier
|
||||
|
||||
animation = windows, 1, 3, circ
|
||||
animation = windowsOut, 1, 2, quint
|
||||
animation = border, 1, 2, sine
|
||||
animation = fade, 1, 2, sine
|
||||
animation = workspaces, 1, 5, circ
|
||||
}
|
||||
|
||||
dwindle {
|
||||
|
|
@ -109,17 +121,19 @@ 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$
|
||||
|
||||
windowrulev2 = opacity 0.85 0.85, floating:1
|
||||
|
||||
# Firefox Sharing Indicator
|
||||
${mkRules ["float" "move 49% 40" "noborder"] ["title:^(.*Sharing Indicator)$"]}
|
||||
|
||||
# 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)$"]}
|
||||
|
||||
# Emacs
|
||||
windowrulev2 = opaque, class:^emacs$
|
||||
|
||||
|
|
@ -134,26 +148,32 @@ in
|
|||
$windowMod = ALT
|
||||
|
||||
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
|
||||
bind = $mainMod, D, exec, hyprctl keyword general:layout dwindle
|
||||
bind = $mainMod, E, exec, emacsclient -c -a emacs
|
||||
bind = $mainMod, F, togglefloating,
|
||||
bind = $mainMod SHIFT, F, fullscreen,
|
||||
bind = $mainMod, M, exec, hyprctl keyword general:layout master
|
||||
bind = $mainMod, P, pseudo, # dwindle
|
||||
bind = $mainMod, Q, killactive,
|
||||
bind = $mainMod, R, exec, rofi -x11 -show combi
|
||||
bind = $mainMod, C, exec, rofi -x11 -show calc -modi calc -no-show-match -no-sort | wl-copy
|
||||
bind = $mainMod, B, exec, rofi-bluetooth
|
||||
bind = $mainMod, RETURN, exec, kitty
|
||||
bind = $mainMod, T, togglesplit, # dwindle
|
||||
bind = , XF86AudioLowerVolume, exec, pamixer -d 5
|
||||
bind = , XF86AudioMute, exec, pamixer -t
|
||||
bind = , XF86AudioNext, exec, playerctl -p "spotifyd,firefox" next
|
||||
bind = , XF86AudioPlay, exec, playerctl -p "spotifyd,firefox" play-pause
|
||||
bind = , XF86AudioPrev, exec, playerctl -p "spotifyd,firefox" previous
|
||||
bind = , XF86AudioRaiseVolume, exec, pamixer -i 5
|
||||
bind = , XF86MonBrightnessDown, exec, brightnessctl s 10%-
|
||||
bind = , XF86MonBrightnessUp, exec, brightnessctl s 10%+
|
||||
|
||||
# Window binds
|
||||
bind = $mainMod , F , togglefloating ,
|
||||
bind = $mainMod , P , pseudo ,
|
||||
bind = $mainMod , Q , killactive ,
|
||||
bind = $mainMod , T , togglesplit ,
|
||||
bind = $mainMod SHIFT , F , fullscreen ,
|
||||
|
||||
# Program binds
|
||||
bind = $mainMod , B , exec , rofi-bluetooth
|
||||
bind = $mainMod , C , exec , rofi -show calc -modi calc -no-show-match -no-sort | wl-copy
|
||||
bind = $mainMod , D , exec , hyprctl keyword general:layout dwindle
|
||||
bind = $mainMod , E , exec , emacsclient -c -a emacs
|
||||
bind = $mainMod , M , exec , hyprctl keyword general:layout master
|
||||
bind = $mainMod , R , exec , rofi -show combi
|
||||
bind = $mainMod , RETURN , exec , kitty
|
||||
|
||||
# XF86 keys
|
||||
bind = , XF86AudioLowerVolume , exec , pamixer -d 5
|
||||
bind = , XF86AudioRaiseVolume , exec , pamixer -i 5
|
||||
bind = , XF86AudioMute , exec , pamixer -t
|
||||
bind = , XF86AudioNext , exec , playerctl -p "spotifyd,firefox" next
|
||||
bind = , XF86AudioPlay , exec , playerctl -p "spotifyd,firefox" play-pause
|
||||
bind = , XF86AudioPrev , exec , playerctl -p "spotifyd,firefox" previous
|
||||
bind = , XF86MonBrightnessDown , exec , brightnessctl s 10%-
|
||||
bind = , XF86MonBrightnessUp , exec , brightnessctl s 10%+
|
||||
|
||||
# Move focus with mainMod + hjkl
|
||||
bind = $mainMod, H, movefocus, l
|
||||
|
|
@ -161,11 +181,17 @@ in
|
|||
bind = $mainMod, K, movefocus, u
|
||||
bind = $mainMod, J, movefocus, d
|
||||
|
||||
# Change current active window size with mainMod + hjkl
|
||||
# Change current active window size with mainMod + SHIFT + hjkl
|
||||
bind = $mainMod SHIFT, H, resizeactive, -10 0
|
||||
bind = $mainMod SHIFT, L, resizeactive, 10 0
|
||||
bind = $mainMod SHIFT, K, resizeactive, 0 -10
|
||||
bind = $mainMod SHIFT, J, resizeactive, 0 10
|
||||
bind = $mainMod SHIFT, K, resizeactive, 0 -10
|
||||
bind = $mainMod SHIFT, L, resizeactive, 10 0
|
||||
|
||||
# Move current active window with mainMod + ALT + hjkl
|
||||
bind = $mainMod ALT, H, movewindow, l
|
||||
bind = $mainMod ALT, J, movewindow, d
|
||||
bind = $mainMod ALT, K, movewindow, u
|
||||
bind = $mainMod ALT, L, movewindow, r
|
||||
|
||||
# Switch workspaces with mainMod + [0-9]
|
||||
bind = $mainMod, 1, workspace, 1
|
||||
|
|
@ -200,4 +226,5 @@ in
|
|||
bindm = $mainMod, mouse:273, resizewindow
|
||||
|
||||
exec-once=synology-drive
|
||||
exec-once=randomWallpaper
|
||||
''
|
||||
|
|
|
|||
|
|
@ -15,6 +15,16 @@ in
|
|||
options.my.programs.hyprland = {
|
||||
enable = mkEnableOption "hyprland";
|
||||
nvidiaSupport = mkEnableOption "enable nvidia Support";
|
||||
blur = mkOption {
|
||||
type = types.bool;
|
||||
description = "enable window blurring";
|
||||
default = true;
|
||||
};
|
||||
shadows = mkOption {
|
||||
type = types.bool;
|
||||
description = "enable window shadows";
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
@ -26,39 +36,59 @@ in
|
|||
services.dunst.enable = true;
|
||||
};
|
||||
|
||||
home-manager.users.moritz = {
|
||||
imports = [ inputs.hyprland.homeManagerModules.default ];
|
||||
# enable nix module
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = null; # because we use the home-manager module
|
||||
};
|
||||
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
package = pkgs.waybar-hyprland;
|
||||
systemd = {
|
||||
enable = true;
|
||||
target = "hyprland-session.target";
|
||||
};
|
||||
settings = {
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
modules-left = [ "wlr/workspaces" ];
|
||||
modules-center = [ "hyprland/window" ];
|
||||
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
|
||||
modules = {
|
||||
"wlr/workspaces" = {
|
||||
on-click = "activate";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# enable home-manager module
|
||||
home-manager.users.moritz = {
|
||||
# import home-manager module
|
||||
imports = [ inputs.hyprland.homeManagerModules.default ];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
package = hyprland;
|
||||
extraConfig = import ./config.nix args;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# add waybar as a status bar
|
||||
home-manager.users.moritz.programs.waybar = {
|
||||
enable = true;
|
||||
|
||||
# use package with hyprland support for switching workspaces
|
||||
package = pkgs.waybar-hyprland;
|
||||
|
||||
# start using systemd service
|
||||
systemd = {
|
||||
enable = true;
|
||||
target = "hyprland-session.target";
|
||||
};
|
||||
|
||||
settings = {
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
modules-left = [ "wlr/workspaces" ];
|
||||
modules-center = [ "hyprland/window" ];
|
||||
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
|
||||
modules = {
|
||||
"wlr/workspaces" = {
|
||||
on-click = "activate";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# lock screen after timeout
|
||||
home-manager.users.moritz = {
|
||||
services.swayidle = {
|
||||
enable = true;
|
||||
events = [
|
||||
|
|
@ -83,49 +113,57 @@ in
|
|||
}
|
||||
];
|
||||
};
|
||||
|
||||
# start swayidle as part of hyprland, not sway
|
||||
systemd.user.services.swayidle.Install.WantedBy = lib.mkForce [ "hyprland-session.target" ];
|
||||
|
||||
xdg.configFile."hypr/hyprpaper.conf" = {
|
||||
text =
|
||||
let
|
||||
setWallpaper = wallpaper: ''
|
||||
preload = ${wallpaper}
|
||||
wallpaper = ,${wallpaper}
|
||||
'';
|
||||
in
|
||||
setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png";
|
||||
onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service";
|
||||
};
|
||||
};
|
||||
|
||||
# adds pam module for swaylock
|
||||
security.pam.services.swaylock = { };
|
||||
|
||||
|
||||
# start hyprpaper daemon using systemd unit (to set wallpaper)
|
||||
systemd.user.services.hyprpaper = {
|
||||
enable = true;
|
||||
path = [ pkgs.hyprpaper ];
|
||||
wantedBy = [ "hyprland-session.target" ];
|
||||
after = [ "display-manager.service" ];
|
||||
after = [ "hyprland-session.target" ];
|
||||
script = "hyprpaper";
|
||||
};
|
||||
|
||||
users.users.moritz.packages = with pkgs; [
|
||||
swayidle
|
||||
swaylock-effects
|
||||
pamixer
|
||||
playerctl
|
||||
brightnessctl
|
||||
grimblast
|
||||
slurp
|
||||
grim
|
||||
wl-clipboard
|
||||
wdisplays
|
||||
];
|
||||
|
||||
security.pam.services.swaylock = { };
|
||||
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
package = null;
|
||||
# set hyprpaper conf (for setting initial background)
|
||||
home-manager.users.moritz.xdg.configFile."hypr/hyprpaper.conf" = {
|
||||
text =
|
||||
let
|
||||
setWallpaper = wallpaper: ''
|
||||
preload = ${wallpaper}
|
||||
wallpaper = ,${wallpaper}
|
||||
'';
|
||||
in
|
||||
setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png";
|
||||
onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service";
|
||||
};
|
||||
|
||||
|
||||
# only consider graphical-session.target started when hyprland-sesstion.target is reached
|
||||
systemd.user.targets.hyprland-session = {
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
before = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
|
||||
# add user packages for wayland and hyprland in particular
|
||||
users.users.moritz.packages = with pkgs; [
|
||||
pamixer # pulse audio cli
|
||||
playerctl # control media playback
|
||||
brightnessctl # control brightness
|
||||
grimblast # screenshot tool for hyprland
|
||||
slurp # region select for wayland (for screensharing)
|
||||
wl-clipboard # clipboard tool for wayland
|
||||
];
|
||||
|
||||
|
||||
# additional environment variables
|
||||
environment.sessionVariables =
|
||||
{
|
||||
XDG_CURRENT_DESKTOP = "Hyprland";
|
||||
|
|
@ -136,18 +174,19 @@ in
|
|||
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
||||
QT_QPA_PLATFORMTHEME = "qt5ct";
|
||||
_JAVA_AWT_WM_NONEREPARENTING = "1";
|
||||
} //
|
||||
(if cfg.nvidiaSupport then
|
||||
} // (optionalAttrs cfg.nvidiaSupport
|
||||
{
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
GBM_BACKEND = "nvidia-drm";
|
||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||
WLR_NO_HARDWARE_CURSORS = "1";
|
||||
__GL_VRR_ALLOWED = "0";
|
||||
} else { });
|
||||
});
|
||||
|
||||
|
||||
services = {
|
||||
dbus.enable = true;
|
||||
# use pipewire (needed for screensharing)
|
||||
pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
|
|
@ -163,12 +202,14 @@ in
|
|||
user = "moritz";
|
||||
};
|
||||
defaultSession = "hyprland";
|
||||
sessionPackages = [ hyprland ];
|
||||
sessionPackages = [ hyprland ]; # can't set the defaultSession otherwise
|
||||
};
|
||||
};
|
||||
};
|
||||
security.rtkit.enable = true;
|
||||
|
||||
|
||||
# dekstop portal (for screensharing)
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
wlr.enable = true;
|
||||
|
|
|
|||
101
modules/programs/nvim/default.nix
Normal file
101
modules/programs/nvim/default.nix
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, inputs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.programs.vim;
|
||||
|
||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||
(builtins.substring 0 4 longDate)
|
||||
(builtins.substring 4 2 longDate)
|
||||
(builtins.substring 6 2 longDate)
|
||||
]);
|
||||
|
||||
mkVersionInput = input: mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
|
||||
|
||||
nvim-treesitter-textsubjects = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
pname = "nvim-treesitter-textsubjects";
|
||||
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
|
||||
src = inputs.nvim-treesitter-textsubjects;
|
||||
};
|
||||
|
||||
smartcolumn-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
pname = "smartcolumn-nvim";
|
||||
version = mkVersionInput inputs.smartcolumn-nvim;
|
||||
src = inputs.smartcolumn-nvim;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.my.programs.vim = {
|
||||
enable = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
example = false;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.moritz.programs.neovim = {
|
||||
enable = true;
|
||||
package = pkgs.neovim-nightly;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
withNodeJs = true;
|
||||
withPython3 = true;
|
||||
extraLuaConfig = builtins.readFile ./init.lua;
|
||||
extraPackages = with pkgs; [
|
||||
alejandra
|
||||
black
|
||||
isort
|
||||
nil
|
||||
nixpkgs-fmt
|
||||
rustfmt
|
||||
shfmt
|
||||
stylua
|
||||
sumneko-lua-language-server
|
||||
taplo
|
||||
yamlfmt
|
||||
];
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
catppuccin-nvim
|
||||
cmp-nvim-lsp
|
||||
cmp_luasnip
|
||||
comment-nvim
|
||||
copilot-cmp
|
||||
copilot-lua
|
||||
dashboard-nvim
|
||||
formatter-nvim
|
||||
gitsigns-nvim
|
||||
lsp_lines-nvim
|
||||
lspkind-nvim
|
||||
lualine-lsp-progress
|
||||
lualine-nvim
|
||||
luasnip
|
||||
neogit
|
||||
noice-nvim
|
||||
nui-nvim # for noice-nvim
|
||||
nvim-autopairs
|
||||
nvim-cmp
|
||||
nvim-lastplace
|
||||
nvim-lspconfig
|
||||
nvim-surround
|
||||
nvim-tree-lua
|
||||
nvim-treesitter-textsubjects
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-ts-context-commentstring
|
||||
nvim-web-devicons # for dashboard-nvim
|
||||
orgmode
|
||||
plenary-nvim # for telescope, neogit
|
||||
smartcolumn-nvim
|
||||
telescope-fzf-native-nvim
|
||||
telescope-nvim
|
||||
vim-lion
|
||||
which-key-nvim
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
481
modules/programs/nvim/init.lua
Normal file
481
modules/programs/nvim/init.lua
Normal file
|
|
@ -0,0 +1,481 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = ","
|
||||
|
||||
-- FIX to create spell dir if not existent
|
||||
local spelldir = vim.fn.stdpath("data") .. "/site/spell"
|
||||
if not vim.loop.fs_stat(spelldir) then
|
||||
vim.fn.mkdir(spelldir, "p")
|
||||
end
|
||||
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup//" } -- don't store backup in files dir
|
||||
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
|
||||
vim.opt.conceallevel = 2
|
||||
vim.opt.expandtab = true -- spaces instead of tabs
|
||||
vim.opt.guifont = "Fira Code Nerd Font:h1"
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.mouse = "a" -- mouse for all modes
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.scrolloff = 4 -- lines of context
|
||||
vim.opt.shiftround = true -- round indent
|
||||
vim.opt.shiftwidth = 0 -- use tabstop value
|
||||
vim.opt.shortmess:append({ c = true })
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undolevels = 10000
|
||||
vim.opt.updatetime = 300
|
||||
vim.opt_local.spell = true
|
||||
vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling
|
||||
|
||||
require("catppuccin").setup({
|
||||
compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store
|
||||
integrations = {
|
||||
which_key = true,
|
||||
},
|
||||
})
|
||||
vim.cmd.colorscheme("catppuccin-macchiato")
|
||||
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 500
|
||||
local wk = require("which-key")
|
||||
|
||||
require("noice").setup({
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
progress = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
})
|
||||
|
||||
wk.register({
|
||||
f = {
|
||||
name = "find",
|
||||
f = { "<cmd>Telescope find_files<cr>", "find file" },
|
||||
g = { "<cmd>Telescope live_grep<cr>", "live grep" },
|
||||
b = { "<cmd>Telescope buffers<cr>", "find buffer" },
|
||||
},
|
||||
}, { prefix = "<leader>" })
|
||||
-- To get fzf loaded and working with telescope, you need to call
|
||||
-- load_extension, somewhere after setup function:
|
||||
require("telescope").load_extension("fzf")
|
||||
|
||||
require("neogit").setup({
|
||||
disable_commit_confirmation = true,
|
||||
})
|
||||
wk.register({
|
||||
g = { "<cmd>Neogit<cr>", "git" },
|
||||
}, { prefix = "<leader>" })
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
sync_install = false,
|
||||
auto_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = true,
|
||||
},
|
||||
})
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
cmp.setup({
|
||||
formatting = {
|
||||
format = 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 = {
|
||||
{ name = "buffer", priority = 1 },
|
||||
{ name = "copilot", priority = 8 },
|
||||
{ name = "luasnip", priority = 7 },
|
||||
{ name = "nvim_lsp", priority = 9 },
|
||||
{ name = "orgmode", priority = 9 },
|
||||
},
|
||||
})
|
||||
|
||||
---merge tables
|
||||
---@param ... table[]
|
||||
---@return table
|
||||
local function table_merge(...)
|
||||
local tables_to_merge = { ... }
|
||||
assert(#tables_to_merge > 1, "There should be at least two tables to merge them")
|
||||
|
||||
for k, t in ipairs(tables_to_merge) do
|
||||
assert(type(t) == "table", string.format("Expected a table as function parameter %d", k))
|
||||
end
|
||||
|
||||
local result = tables_to_merge[1]
|
||||
|
||||
for i = 2, #tables_to_merge do
|
||||
local from = tables_to_merge[i]
|
||||
for k, v in pairs(from) do
|
||||
if type(v) == "table" then
|
||||
result[k] = result[k] or {}
|
||||
result[k] = table_merge(result[k], v)
|
||||
else
|
||||
result[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
||||
require("formatter").setup({
|
||||
-- Enable or disable logging
|
||||
logging = true,
|
||||
-- Set the log level
|
||||
log_level = vim.log.levels.WARN,
|
||||
-- All formatter configurations are opt-in
|
||||
filetype = {
|
||||
-- Formatter configurations for filetype "lua" go here
|
||||
-- and will be executed in order
|
||||
lua = {
|
||||
-- "formatter.filetypes.lua" defines default configurations for the
|
||||
-- "lua" filetype
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
},
|
||||
nix = {
|
||||
require("formatter.filetypes.nix").nixpkgs_fmt,
|
||||
},
|
||||
python = {
|
||||
require("formatter.filetypes.python").black,
|
||||
},
|
||||
rust = {
|
||||
require("formatter.filetypes.rust").rustfmt,
|
||||
},
|
||||
sh = {
|
||||
require("formatter.filetypes.sh").shfmt,
|
||||
},
|
||||
toml = {
|
||||
require("formatter.filetypes.toml").taplo,
|
||||
},
|
||||
yaml = {
|
||||
require("formatter.filetypes.yaml").yamlfmt,
|
||||
},
|
||||
|
||||
-- HACK to use specific formatters only when specified
|
||||
alejandra = {
|
||||
require("formatter.filetypes.nix").alejandra,
|
||||
},
|
||||
isort = {
|
||||
require("formatter.filetypes.python").isort,
|
||||
},
|
||||
|
||||
-- Use the special "*" filetype for defining formatter configurations on
|
||||
-- any filetype
|
||||
["*"] = {
|
||||
-- "formatter.filetypes.any" defines default configurations for any
|
||||
-- filetype
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.api.nvim_create_user_command("Fmt", function(opts)
|
||||
local params = vim.split(opts.args, "%s+", { trimempty = true })
|
||||
local filetype = vim.bo.filetype
|
||||
vim.cmd("set filetype=" .. params[1]) -- fake filetype
|
||||
vim.cmd(":Format")
|
||||
vim.cmd("set filetype=" .. filetype) -- restore original filetype
|
||||
end, {
|
||||
nargs = 1,
|
||||
complete = function()
|
||||
local languages = {
|
||||
nix = { "alejandra" },
|
||||
python = { "isort" },
|
||||
}
|
||||
return languages[vim.bo.filetype] or {}
|
||||
end,
|
||||
})
|
||||
wk.register({
|
||||
["="] = { "<cmd>Format<cr>", "format (formatter)" },
|
||||
}, { noremap = true, silent = true })
|
||||
|
||||
local lsp_lines = require("lsp_lines")
|
||||
lsp_lines.setup()
|
||||
-- Disable virtual_text since it's redundant due to lsp_lines.
|
||||
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()
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local on_attach_def = function(_, bufnr)
|
||||
wk.register({
|
||||
K = { vim.lsp.buf.hover, "show info" },
|
||||
["<leader>"] = {
|
||||
l = {
|
||||
name = "lsp",
|
||||
d = { vim.diagnostic.open_float, "open diagnostic window" },
|
||||
n = { vim.diagnostic.goto_next, "next error" },
|
||||
p = { vim.diagnostic.goto_prev, "prev error" },
|
||||
c = { vim.lsp.buf.code_action, "code action" },
|
||||
r = { vim.lsp.buf.rename, "rename" },
|
||||
f = {
|
||||
function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end,
|
||||
"format (lsp)",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
},
|
||||
w = {
|
||||
name = "workspace",
|
||||
a = { vim.lsp.buf.add_workspace_folder, "add workspace folder" },
|
||||
r = { vim.lsp.buf.remove_workspace_folder, "remove workspace folder" },
|
||||
l = {
|
||||
function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end,
|
||||
"list workspace folders",
|
||||
},
|
||||
},
|
||||
t = {
|
||||
name = "toggle",
|
||||
l = { lsp_lines.toggle, "lsp lines" },
|
||||
},
|
||||
},
|
||||
g = {
|
||||
name = "goto",
|
||||
r = { vim.lsp.buf.references, "references" },
|
||||
d = { vim.lsp.buf.definition, "definition" },
|
||||
D = { vim.lsp.buf.declaration, "declaration" },
|
||||
i = { vim.lsp.buf.implementation, "implementation" },
|
||||
t = { vim.lsp.buf.type_definition, "type defininition" },
|
||||
},
|
||||
}, { buffer = bufnr, silent = true })
|
||||
end
|
||||
|
||||
local lspconfig_default_options = {
|
||||
on_attach = on_attach_def,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 100,
|
||||
},
|
||||
}
|
||||
|
||||
---function to add default options to lspconfig
|
||||
---@param lsp string
|
||||
---@param options table
|
||||
---@return nil
|
||||
local function lspconfig_setup(lsp, options)
|
||||
local final_options = table_merge(lspconfig_default_options, options)
|
||||
lspconfig[lsp].setup(final_options)
|
||||
end
|
||||
|
||||
local servers = { "nil_ls", "pylsp", "rust_analyzer" }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig_setup(lsp, {})
|
||||
end
|
||||
|
||||
lspconfig_setup("lua_ls", {
|
||||
on_attach = on_attach_def,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
format = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("dashboard").setup({
|
||||
theme = "hyper",
|
||||
config = {
|
||||
packages = { enable = true },
|
||||
week_header = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = "|",
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{ "mode", separator = { left = "" }, right_padding = 2 },
|
||||
},
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "filename", "lsp_progress" },
|
||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = {
|
||||
{ "location", separator = { right = "" }, left_padding = 2 },
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
})
|
||||
|
||||
require("Comment").setup()
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
|
||||
require("nvim-surround").setup({})
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
textsubjects = {
|
||||
enable = true,
|
||||
prev_selection = ",", -- (Optional) keymap to select the previous selection
|
||||
keymaps = { ["."] = "textsubjects-smart" },
|
||||
},
|
||||
})
|
||||
|
||||
require("copilot").setup({
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
})
|
||||
require("copilot_cmp").setup()
|
||||
|
||||
local orgmode = require("orgmode")
|
||||
-- Load custom treesitter grammar for org filetype
|
||||
orgmode.setup_ts_grammar()
|
||||
-- Treesitter configuration
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
|
||||
-- highlighting will fallback to default Vim syntax highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Required for spellcheck, some LaTex highlights and
|
||||
-- code block highlights that do not have ts grammar
|
||||
additional_vim_regex_highlighting = { "org" },
|
||||
},
|
||||
})
|
||||
orgmode.setup({
|
||||
org_agenda_files = { "~/Notes/org" },
|
||||
org_default_notes_file = "~/Notes/org/refile.org",
|
||||
})
|
||||
|
||||
require("gitsigns").setup()
|
||||
|
||||
require("nvim-lastplace").setup({
|
||||
lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
|
||||
lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" },
|
||||
lastplace_open_folds = true,
|
||||
})
|
||||
|
||||
require("nvim-autopairs").setup()
|
||||
|
||||
-- disable netrw at the very start of your init.lua (strongly advised)
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
-- set termguicolors to enable highlight groups
|
||||
vim.opt.termguicolors = true
|
||||
-- empty setup using defaults
|
||||
require("nvim-tree").setup()
|
||||
wk.register({
|
||||
t = { "<cmd>NvimTreeFindFileToggle<cr>", "nvim tree" },
|
||||
}, { prefix = "<leader>t", silent = true })
|
||||
|
||||
require("smartcolumn").setup({
|
||||
colorcolumn = 120,
|
||||
})
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.programs.vim;
|
||||
in
|
||||
{
|
||||
options.my.programs.vim = {
|
||||
enable = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
example = false;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.moritz.programs.neovim = {
|
||||
enable = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
withNodeJs = true;
|
||||
withPython3 = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -70,9 +70,11 @@
|
|||
|
||||
# SSH
|
||||
services.openssh = {
|
||||
# Disable ssh password login
|
||||
passwordAuthentication = lib.mkDefault false;
|
||||
logLevel = "VERBOSE";
|
||||
settings = {
|
||||
# Disable ssh password login
|
||||
passwordAuthentication = lib.mkDefault false;
|
||||
logLevel = "VERBOSE";
|
||||
};
|
||||
extraConfig = ''
|
||||
AllowAgentForwarding no
|
||||
AllowTcpForwarding no
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
./kdeconnect.nix
|
||||
./mullvad.nix
|
||||
./openconnect.nix
|
||||
./openvpn.nix
|
||||
./picom.nix
|
||||
./printing.nix
|
||||
./redshift.nix
|
||||
./wireguard.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.services.openvpn;
|
||||
in
|
||||
{
|
||||
options.my.services.openvpn.enable = mkEnableOption "openvpn";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
age.secrets = {
|
||||
homeVPN = {
|
||||
file = ../../secrets/home-vpn.age;
|
||||
owner = "1000";
|
||||
};
|
||||
homeVPNPassword = {
|
||||
file = ../../secrets/home-vpn-password.age;
|
||||
owner = "1000";
|
||||
};
|
||||
};
|
||||
services.openvpn.servers = {
|
||||
homeVPN = {
|
||||
config = "config /run/agenix/homeVPN ";
|
||||
autoStart = false;
|
||||
updateResolvConf = true;
|
||||
};
|
||||
};
|
||||
systemd.services.openvpn-homeVPN-password = {
|
||||
description = "Enter homeVPN password";
|
||||
script = "cat /run/agenix/homeVPNPassword | systemd-tty-ask-password-agent";
|
||||
wantedBy = [ "openvpn-homeVPN.service" ];
|
||||
after = [ "openvpn-homeVPN.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
42
modules/services/wireguard.nix
Normal file
42
modules/services/wireguard.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.services.wireguard;
|
||||
in
|
||||
{
|
||||
options.my.services.wireguard.enable = mkEnableOption "wireguard";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
age.secrets = {
|
||||
wireguard-private-key.file = ../../secrets/wireguard-private-key.age;
|
||||
wireguard-preshared-key.file = ../../secrets/wireguard-preshared-key.age;
|
||||
};
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [ 51820 ];
|
||||
};
|
||||
networking.wg-quick.interfaces = {
|
||||
wg0 = {
|
||||
autostart = false;
|
||||
address = [ "10.8.0.3/24" ];
|
||||
listenPort = 51820;
|
||||
privateKeyFile = "/run/agenix/wireguard-private-key";
|
||||
dns = [ "192.168.0.4" "9.9.9.9" ];
|
||||
peers = [
|
||||
{
|
||||
publicKey = "bT/U8ko3i//vH8LNn2R56JkGMg+0GLFrZSF81BBax08=";
|
||||
presharedKeyFile = "/run/agenix/wireguard-preshared-key";
|
||||
# Forward all the traffic via VPN.
|
||||
allowedIPs = [ "0.0.0.0/0" ];
|
||||
endpoint = "wg.moritzboeh.me:51820";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue