diff --git a/home/default.nix b/home/default.nix index 1a27515..37a6033 100644 --- a/home/default.nix +++ b/home/default.nix @@ -7,11 +7,12 @@ ./programs/git.nix # ./programs/emacs.nix ./programs/jetbrains-toolbox.nix - ./programs/kitty.nix ./programs/vscode.nix ./programs/direnv.nix ./programs/chromium.nix ./programs/flatpak.nix + + ./homePrograms ]; home = { @@ -24,4 +25,6 @@ programs.home-manager.enable = true; nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + homePrograms.kitty.enable = true; } diff --git a/home/homePrograms/default.nix b/home/homePrograms/default.nix new file mode 100644 index 0000000..9166110 --- /dev/null +++ b/home/homePrograms/default.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + imports = [ + ./hyprland.nix + ./kitty.nix + ./zsh + ]; +} \ No newline at end of file diff --git a/home/homePrograms/hyprland.nix b/home/homePrograms/hyprland.nix new file mode 100644 index 0000000..4f55784 --- /dev/null +++ b/home/homePrograms/hyprland.nix @@ -0,0 +1,200 @@ +{ config, pkgs, lib, ... }: +with lib; +{ + options.homePrograms.hyprland = { + enable = mkEnableOption '' + Enable hyprland with my custom configurations + ''; + }; + config = + let + cfg = config.homePrograms.hyprland; + in + mkIf cfg.enable { + wayland.windowManager.hyprland = { + enable = true; + + settings = { + exec-once = [ + "dunst -conf ~/.config/hypr/dunstrc" + "~/.config/hypr/eww/scripts/start" + "~/.config/hypr/swww/start" + + # Keyring daemon + "gnome-keyring-daemon --start --components=gpg" + "gnome-keyring-daemon --start --components=secrets" + "gnome-keyring-daemon --start --components=ssh" + "gnome-keyring-daemon --start --components=pkcs11" + + "/usr/libexec/kf5/polkit-kde-authentication-agent-1" + "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + ]; + + env = "XCURSOR_SIZE,24"; + + # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ + input = { + kb_layout = config.services.xserver.xkb.layout; + kb_variant = config.services.xserver.xkb.variant; + kb_model = ""; + kb_options = ""; + kb_rules = ""; + + follow_mouse = 1; + numlock_by_default = 1; + + touchpad = { + natural_scroll = "no"; + disable_while_typing = "yes"; + tap-to-click = "yes"; + }; + + sensitivity = 0; # -1.0 - 1.0, 0 means no modification. + }; + + # See https://wiki.hyprland.org/Configuring/Variables/ for more + general = { + gaps_in = 5; + gaps_out = 20; + border_size = 3; + col.active_border = "rgb()"; + col.inactive_border = "rgb()"; + + layout = "dwindle"; + }; + + # See https://wiki.hyprland.org/Configuring/Variables/ for more + decoration = { + rounding = 10; + + blur = { + enabled = true; + size = 3; + passes = 1; + }; + + drop_shadow = "yes"; + shadow_range = 15; + shadow_render_power = 4; + col.shadow = "rgb()"; + col.shadow_inactive = "rgb()"; + }; + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + animations = { + enabled = "yes"; + + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + dwindle = { + pseudotile = "yes"; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = "yes"; # you probably want this + }; + + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + master = { + new_is_master = "true"; + }; + + # See https://wiki.hyprland.org/Configuring/Variables/ for more + gestures = { + workspace_swipe = "on"; + workspace_swipe_forever = "on"; + }; + + # Example per-device config + # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more + "device:epic-mouse-v1" = { + sensitivity = "-0.5"; + }; + + "$mod" = "SUPER"; + + bind = [ + "SUPERSHIFT,R,hyprload,reload" + "SUPERSHIFT,U,hyprload,update" + + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + "$mainMod, RETURN, exec, kitty -c ~/.config/hypr/kitty.conf" + "$mainMod, C, killactive," + "$mainMod SHIFT, C, exec, hyprpicker -a -f hex" + "$mainMod SHIFT, Q, exit," + "$mainMod, E, exec, nautilus" + "$mainMod, V, togglefloating," + "$mainMod, F, fullscreen, 0" + "$mainMod, D, exec, wofi -i -s ~/.config/hypr/wofi/style.css --show drun" + "$mainMod, P, pseudo," # dwindle + "$mainMod, B, togglesplit," # dwindle + + # Move focus with mainMod + arrow keys + "$mainMod, h, movefocus, l" + "$mainMod, l, movefocus, r" + "$mainMod, j, movefocus, u" + "$mainMod, k, movefocus, d" + + "$mainMod SHIFT_L, h, movewindow, l" + "$mainMod SHIFT_L, l, movewindow, r" + "$mainMod SHIFT_L, j, movewindow, u" + "$mainMod SHIFT_L, k, movewindow, d" + + "$mainMod ALT_L, v, exec, dunstctl context" + "$mainMod ALT_L, c, exec, dunstctl close-all" + "$mainMod ALT_L, x, exec, dunstctl close" + + # Switch workspaces with mainMod + [0-9] + "$mainMod, 1, split-workspace, 1" + "$mainMod, 2, split-workspace, 2" + "$mainMod, 3, split-workspace, 3" + "$mainMod, 4, split-workspace, 4" + "$mainMod, 5, split-workspace, 5" + "$mainMod, 6, split-workspace, 6" + "$mainMod, 7, split-workspace, 7" + "$mainMod, 8, split-workspace, 8" + "$mainMod, 9, split-workspace, 9" + "$mainMod, 0, split-workspace, 10" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mainMod SHIFT, 1, split-movetoworkspace, 1" + "$mainMod SHIFT, 2, split-movetoworkspace, 2" + "$mainMod SHIFT, 3, split-movetoworkspace, 3" + "$mainMod SHIFT, 4, split-movetoworkspace, 4" + "$mainMod SHIFT, 5, split-movetoworkspace, 5" + "$mainMod SHIFT, 6, split-movetoworkspace, 6" + "$mainMod SHIFT, 7, split-movetoworkspace, 7" + "$mainMod SHIFT, 8, split-movetoworkspace, 8" + "$mainMod SHIFT, 9, split-movetoworkspace, 9" + "$mainMod SHIFT, 0, split-movetoworkspace, 10" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + ]; + + bindm = [ + # mouse movements + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + "$mod ALT, mouse:272, resizewindow" + ]; + + binde = [ + "$mainMod CTRL_L, h, resizeactive, -50 0" + "$mainMod CTRL_L, l, resizeactive, 50 0" + "$mainMod CTRL_L, j, resizeactive, 0 -50" + "$mainMod CTRL_L, k, resizeactive, 0 50" + ]; + }; + }; + }; +} \ No newline at end of file diff --git a/home/homePrograms/kitty.nix b/home/homePrograms/kitty.nix new file mode 100644 index 0000000..850b7d6 --- /dev/null +++ b/home/homePrograms/kitty.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, ... }: +with lib; +{ + options.homePrograms.kitty = { + enable = mkEnableOption '' + Enable kitty with my custom configurations + ''; + + enableBlur = mkEnableOption '' + Enable blur (Usefull to disable with hyprland) + ''; + }; + config = + let + cfg = config.homePrograms.kitty; + in + mkIf cfg.enable { + programs.kitty = { + enable = true; + + font = { + name = "FiraCode Nerd Font"; + package = pkgs.fira-code-nerdfont; + }; + + settings = lib.mkMerge [ + { + shell = "zsh"; + disable_ligatures = "never"; + sync_to_monitor = "yes"; # Avoid to update a lot + confirm_os_window_close = 0; # Disable close confirmation + + background_opacity = "0.7"; + } + + (lib.mkIf cfg.enableBlur { background_blur = "1"; }) + ]; + }; + }; +} \ No newline at end of file diff --git a/home/homePrograms/zsh/default.nix b/home/homePrograms/zsh/default.nix new file mode 100644 index 0000000..cab5730 --- /dev/null +++ b/home/homePrograms/zsh/default.nix @@ -0,0 +1,37 @@ +{ config, pkgs, lib, ... }: +with lib; +{ + options.homePrograms.zsh = { + enable = mkEnableOption '' + Enable zsh with my custom configurations + ''; + }; + config = + let + cfg = config.homePrograms.zsh; + in + mkIf cfg.enable { + programs.zsh = { + enable = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + initExtra = '' + [[ ! -f ${./p10k.zsh} ]] || source ${./p10k.zsh} + ''; + + plugins = with pkgs; [ + { + file = "powerlevel10k.zsh-theme"; + name = "powerlevel10k"; + src = "${zsh-powerlevel10k}/share/zsh-powerlevel10k"; + } + { + file = "p10k.zsh"; + name = "powerlevel10k-config"; + src = zsh-powerlevel10k; + } + ]; + }; + }; +} \ No newline at end of file diff --git a/home/files/p10k.zsh b/home/homePrograms/zsh/p10k.zsh similarity index 100% rename from home/files/p10k.zsh rename to home/homePrograms/zsh/p10k.zsh diff --git a/home/programs/kitty.nix b/home/programs/kitty.nix deleted file mode 100644 index 2cb3078..0000000 --- a/home/programs/kitty.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.kitty = { - enable = true; - - font = { - name = "FiraCode Nerd Font"; - package = pkgs.fira-code-nerdfont; - }; - - settings = { - shell = "zsh"; - disable_ligatures = "never"; - sync_to_monitor = "yes"; # Avoid to update a lot - confirm_os_window_close = 0; # Disable close confirmation - - background_opacity = "0.7"; - background_blur = "1"; - }; - }; -} \ No newline at end of file diff --git a/home/programs/shell.nix b/home/programs/shell.nix index 3f87e96..fbc1dff 100644 --- a/home/programs/shell.nix +++ b/home/programs/shell.nix @@ -1,26 +1,5 @@ { config, pkgs, users, ... }: { - programs.zsh = { - enable = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - - initExtra = '' - [[ ! -f ${../files/p10k.zsh} ]] || source ${../files/p10k.zsh} - ''; - - plugins = with pkgs; [ - { - file = "powerlevel10k.zsh-theme"; - name = "powerlevel10k"; - src = "${zsh-powerlevel10k}/share/zsh-powerlevel10k"; - } - { - file = "p10k.zsh"; - name = "powerlevel10k-config"; - src = zsh-powerlevel10k; - } - ]; - }; + homePrograms.zsh.enable = true; }