From 77b3ecebb7ea2a554e0d1c56426f5a129ef41ae8 Mon Sep 17 00:00:00 2001 From: afoucaultc Date: Sat, 8 Aug 2026 13:33:07 +0200 Subject: [PATCH] add hyprland and greetd --- dotfiles/inkscape/palettes | 2 +- dotfiles/inkscape/templates | 2 +- dotfiles/kitty/kitty.conf | 2 +- flake.nix | 3 +- home/afoucaultc/home-laptop.nix | 2 +- home/afoucaultc/home.nix | 2 +- home/afoucaultc/packages/hyprland.nix | 8 +- home/afoucaultc/packages/mako.nix | 6 + home/afoucaultc/packages/niri.nix | 270 ------------------ .../afoucaultc/packages/niri/conf/keybind.nix | 49 ++-- home/afoucaultc/packages/niri/conf/layout.nix | 2 +- home/afoucaultc/packages/niri/conf/misc.nix | 11 +- home/afoucaultc/packages/niri/niri.nix | 5 + home/afoucaultc/packages/other_apps.nix | 4 - home/afoucaultc/packages/other_apps_light.nix | 4 - hosts/common/hyprland.nix | 4 + hosts/common/services/gnome-keyring.nix | 1 + hosts/common/services/greetd.nix | 13 + .../common/services}/protonmail.nix | 8 +- hosts/common/wayland.nix | 1 + hosts/nixos-home/configuration.nix | 3 + hosts/nixos-laptop/configuration.nix | 3 + 22 files changed, 84 insertions(+), 321 deletions(-) create mode 100644 home/afoucaultc/packages/mako.nix delete mode 100644 home/afoucaultc/packages/niri.nix create mode 100644 hosts/common/hyprland.nix create mode 100644 hosts/common/services/greetd.nix rename {home/afoucaultc/packages => hosts/common/services}/protonmail.nix (58%) diff --git a/dotfiles/inkscape/palettes b/dotfiles/inkscape/palettes index 1b6daea..d36ecae 120000 --- a/dotfiles/inkscape/palettes +++ b/dotfiles/inkscape/palettes @@ -1 +1 @@ -/nix/store/s13yx204km1b2wcpy7p2va1nyh9jd1f4-home-manager-files/.config/inkscape/palettes \ No newline at end of file +/nix/store/lc7307i2h8wffkfgdmy22wm9xf7cllj2-home-manager-files/.config/inkscape/palettes \ No newline at end of file diff --git a/dotfiles/inkscape/templates b/dotfiles/inkscape/templates index 2dad081..f6eb0bf 120000 --- a/dotfiles/inkscape/templates +++ b/dotfiles/inkscape/templates @@ -1 +1 @@ -/nix/store/s13yx204km1b2wcpy7p2va1nyh9jd1f4-home-manager-files/.config/inkscape/templates \ No newline at end of file +/nix/store/lc7307i2h8wffkfgdmy22wm9xf7cllj2-home-manager-files/.config/inkscape/templates \ No newline at end of file diff --git a/dotfiles/kitty/kitty.conf b/dotfiles/kitty/kitty.conf index e2f9fce..ab48de9 120000 --- a/dotfiles/kitty/kitty.conf +++ b/dotfiles/kitty/kitty.conf @@ -1 +1 @@ -/nix/store/s13yx204km1b2wcpy7p2va1nyh9jd1f4-home-manager-files/.config/kitty/kitty.conf \ No newline at end of file +/nix/store/lc7307i2h8wffkfgdmy22wm9xf7cllj2-home-manager-files/.config/kitty/kitty.conf \ No newline at end of file diff --git a/flake.nix b/flake.nix index 8705705..d0f120b 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - # flake hyprland (git version) + # flake hyprland (git version) (when lua was not yet available on nixpkgs) #hyprland.url = "github:hyprwm/Hyprland"; # hardware nixos-hardware.url = "github:NixOS/nixos-hardware"; @@ -79,6 +79,7 @@ ./hosts/nixos-laptop/configuration.nix stylix.nixosModules.stylix home-manager.nixosModules.home-manager + niri.nixosModules.niri { # default config home-manager = { diff --git a/home/afoucaultc/home-laptop.nix b/home/afoucaultc/home-laptop.nix index 3053476..33da192 100644 --- a/home/afoucaultc/home-laptop.nix +++ b/home/afoucaultc/home-laptop.nix @@ -16,7 +16,7 @@ ./packages/niri/niri.nix ./packages/nextcloud.nix ./packages/other_apps_light.nix - ./packages/protonmail.nix + ./packages/mako.nix ./packages/python.nix ./packages/texlive.nix ./packages/thunderbird.nix diff --git a/home/afoucaultc/home.nix b/home/afoucaultc/home.nix index 99f1e9f..2b9c059 100644 --- a/home/afoucaultc/home.nix +++ b/home/afoucaultc/home.nix @@ -18,7 +18,7 @@ ./packages/nextcloud.nix ./packages/obs.nix ./packages/other_apps.nix - ./packages/protonmail.nix + ./packages/mako.nix ./packages/python.nix ./packages/texlive.nix ./packages/thunderbird.nix diff --git a/home/afoucaultc/packages/hyprland.nix b/home/afoucaultc/packages/hyprland.nix index 4f7db93..9cb5d9d 100644 --- a/home/afoucaultc/packages/hyprland.nix +++ b/home/afoucaultc/packages/hyprland.nix @@ -2,17 +2,13 @@ pkgs, config, lib, - inputs, ... }: -let - hyprPkgs = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}; -in { wayland.windowManager.hyprland = { enable = true; - package = hyprPkgs.hyprland; - portalPackage = hyprPkgs.xdg-desktop-portal-hyprland; + package = pkgs.hyprland; + portalPackage = pkgs.xdg-desktop-portal-hyprland; xwayland.enable = true; configType = "lua"; systemd = { diff --git a/home/afoucaultc/packages/mako.nix b/home/afoucaultc/packages/mako.nix new file mode 100644 index 0000000..9156e97 --- /dev/null +++ b/home/afoucaultc/packages/mako.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + services.mako = { + enable = true; + }; +} diff --git a/home/afoucaultc/packages/niri.nix b/home/afoucaultc/packages/niri.nix deleted file mode 100644 index 56c9a1e..0000000 --- a/home/afoucaultc/packages/niri.nix +++ /dev/null @@ -1,270 +0,0 @@ -{ - pkgs, - config, - ... -}: -let - # Stylix expose sa palette base16 ici (pas `config.colorScheme`, qui vient de - # nix-colors et n'existe pas dans cette config). - c = config.lib.stylix.colors.withHashtag; - - wallpaper = "${config.home.homeDirectory}/nixos-config/dotfiles/hypr/wallpaper/nix-wallpaper.png"; -in -{ - wayland.windowManager.niri = { - enable = true; - package = pkgs.niri; - - # xwayland-satellite dans le PATH suffit : niri démarre XWayland à la demande - xwaylandSatellitePackage = pkgs.xwayland-satellite; - - # niri recommande le portail gnome (screencast, file chooser) - portalPackage = pkgs.xdg-desktop-portal-gnome; - - # valide le KDL généré au moment du build : les erreurs de config - # apparaissent pendant `nixos-rebuild`, pas au premier login - checkConfig = true; - - settings = { - prefer-no-csd = { }; - screenshot-path = "~/Screenshots/%Y-%m-%d %H-%M-%S.png"; - hotkey-overlay.skip-at-startup = { }; - - # --- entrées ------------------------------------------------------- - input = { - keyboard.xkb.layout = "fr"; - keyboard.numlock = { }; - touchpad = { - tap = { }; - dwt = { }; - accel-profile = "adaptive"; - scroll-factor = 1.2; - }; - mouse = { - accel-profile = "adaptive"; - accel-speed = -0.3; - }; - focus-follows-mouse = { }; - }; - - # --- disposition --------------------------------------------------- - layout = { - gaps = 8; - center-focused-column = "never"; - - default-column-width.proportion = 0.5; - preset-column-widths._children = [ - { proportion = 0.33333; } - { proportion = 0.5; } - { proportion = 0.66667; } - ]; - - focus-ring = { - width = 2; - active-color = c.base0D; - inactive-color = c.base03; - }; - border.off = { }; - }; - - # --- raccourcis ---------------------------------------------------- - # calqués sur conf/binding.lua pour garder les réflexes. - # NB : dans niri `Mod` = Super. J/K reprennent ton inversion Hyprland - # (J = haut, K = bas). - binds = { - "Mod+Shift+Slash".show-hotkey-overlay = { }; - - # session - "Ctrl+Alt+M".quit = { }; - "Ctrl+Alt+L".spawn = [ "hyprlock" ]; - - # lanceurs - "Alt+Q".spawn = [ "kitty" ]; - "Alt+N".spawn = [ - "kitty" - "-e" - "nvim" - ]; - "Alt+D".spawn = [ "dolphin" ]; - "Alt+F".spawn = [ "zen-beta" ]; - "Alt+Z".spawn = [ "zotero" ]; - "Alt+T".spawn = [ "thunderbird" ]; - "Alt+W".spawn = [ - "rofi" - "-show" - "drun" - ]; - "Alt+X".spawn = [ - "rofi" - "-show" - "window" - ]; - "Alt+C".spawn = [ - "rofi" - "-show" - "filebrowser" - ]; - "Super+V".spawn = [ - "sh" - "-c" - "cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy" - ]; - - # fenêtres - "Alt+F4".close-window = { }; - "Alt+V".toggle-window-floating = { }; - "Alt+M".maximize-column = { }; - "Alt+Shift+F".fullscreen-window = { }; - - # focus (colonnes = gauche/droite, fenêtres dans la colonne = haut/bas) - "Alt+H".focus-column-left = { }; - "Alt+L".focus-column-right = { }; - "Alt+J".focus-window-up = { }; - "Alt+K".focus-window-down = { }; - - # déplacement de fenêtre - "Ctrl+Super+H".move-column-left = { }; - "Ctrl+Super+L".move-column-right = { }; - "Ctrl+Super+J".move-window-up = { }; - "Ctrl+Super+K".move-window-down = { }; - - # espaces de travail (verticaux dans niri) - "Super+L".focus-workspace-down = { }; - "Super+H".focus-workspace-up = { }; - "Super+K".move-column-to-workspace-down = { }; - "Super+J".move-column-to-workspace-up = { }; - - # écrans - "Alt+A".focus-monitor-left = { }; - "Alt+B".focus-monitor-right = { }; - "Ctrl+Super+A".move-column-to-monitor-left = { }; - "Ctrl+Super+B".move-column-to-monitor-right = { }; - - # largeur de colonne - "Alt+R".switch-preset-column-width = { }; - "Alt+Minus".set-column-width = [ "-10%" ]; - "Alt+Equal".set-column-width = [ "+10%" ]; - - # captures d'écran (intégrées à niri, pas besoin de grim/slurp) - "Print".screenshot = { }; - "Ctrl+Print".screenshot-screen = { }; - "Alt+Print".screenshot-window = { }; - - # multimédia / luminosité - "XF86MonBrightnessUp" = { - _props.allow-when-locked = true; - spawn = [ - "brightnessctl" - "-e4" - "-n2" - "set" - "5%+" - ]; - }; - "XF86MonBrightnessDown" = { - _props.allow-when-locked = true; - spawn = [ - "brightnessctl" - "-e4" - "-n2" - "set" - "5%-" - ]; - }; - "XF86AudioRaiseVolume" = { - _props.allow-when-locked = true; - spawn = [ - "wpctl" - "set-volume" - "-l" - "1" - "@DEFAULT_AUDIO_SINK@" - "5%+" - ]; - }; - "XF86AudioLowerVolume" = { - _props.allow-when-locked = true; - spawn = [ - "wpctl" - "set-volume" - "@DEFAULT_AUDIO_SINK@" - "5%-" - ]; - }; - "XF86AudioMute" = { - _props.allow-when-locked = true; - spawn = [ - "wpctl" - "set-mute" - "@DEFAULT_AUDIO_SINK@" - "toggle" - ]; - }; - "XF86AudioMicMute" = { - _props.allow-when-locked = true; - spawn = [ - "wpctl" - "set-mute" - "@DEFAULT_AUDIO_SOURCE@" - "toggle" - ]; - }; - }; - - # --- nœuds répétés / paramétrés ------------------------------------ - _children = [ - # écrans : niri prend le mode « preferred » si on ne précise rien - { - output = { - _args = [ "eDP-1" ]; - scale = 1.0; - position._props = { - x = 0; - y = 0; - }; - }; - } - { output._args = [ "HDMI-A-1" ]; } - - # démarrage - { - spawn-at-startup._args = [ - "swaybg" - "-i" - wallpaper - "-m" - "fill" - ]; - } - { spawn-at-startup._args = [ "mako" ]; } - { - spawn-at-startup._args = [ - "sh" - "-c" - "wl-paste --type text --watch cliphist store" - ]; - } - { - spawn-at-startup._args = [ - "sh" - "-c" - "wl-paste --type image --watch cliphist store" - ]; - } - - # règles de fenêtres : exemple, à étoffer au fur et à mesure - { - window-rule._children = [ - { match._props.app-id = "^org\\.keepassxc\\.KeePassXC$"; } - { block-out-from = "screen-capture"; } - ]; - } - ]; - }; - }; - - home.packages = with pkgs; [ - swaybg # niri n'a pas de gestionnaire de fond d'écran intégré - xwayland-satellite - ]; -} diff --git a/home/afoucaultc/packages/niri/conf/keybind.nix b/home/afoucaultc/packages/niri/conf/keybind.nix index dc8eb3e..1745001 100644 --- a/home/afoucaultc/packages/niri/conf/keybind.nix +++ b/home/afoucaultc/packages/niri/conf/keybind.nix @@ -1,4 +1,8 @@ { ... }: +# General idea +# Alt is for focus switch or open/close windows shortcut +# Ctrl is for changing size or state +# Mod is for moving windows { programs.niri.settings.binds = { # open programs @@ -25,43 +29,40 @@ "-e" "nvim" ]; - "Alt+F".action.spawn = [ "zen-beta" ]; "Alt+Z".action.spawn = [ "zotero" ]; "Alt+T".action.spawn = [ "thunderbird" ]; - # other actions "ALT+F4".action.close-window = { }; - "ALT+V".action.toggle-window-floating = { }; + "ALT+V".action.switch-focus-between-floating-and-tiling = { }; + # size control + "Ctrl+V".action.toggle-window-floating = { }; "CTRL+M".action.maximize-column = { }; "CTRL+F".action.fullscreen-window = { }; - - "ALT+H".action.focus-column-left = { }; - "ALT+L".action.focus-column-right = { }; - "ALT+K".action.focus-workspace-up = { }; - "ALT+J".action.focus-workspace-down = { }; - - "Super+H".action.move-column-left = { }; - "Super+L".action.move-column-right = { }; - "Super+K".action.move-column-to-workspace-up = { }; - "Super+J".action.move-column-to-workspace-down = { }; - - "Alt+A".action.focus-monitor-left = { }; - "Alt+B".action.focus-monitor-right = { }; - "Super+A".action.move-column-to-monitor-left = { }; - "Super+B".action.move-column-to-monitor-right = { }; - - "Alt+R".action.switch-preset-column-width = { }; + "Ctrl+R".action.switch-preset-column-width = { }; "Ctrl+Alt+H".action.set-column-width = [ "-10%" ]; "Ctrl+Alt+L".action.set-column-width = [ "+10%" ]; "Ctrl+Alt+J".action.set-window-height = "-10%"; "Ctrl+Alt+K".action.set-window-height = "+10%"; - + # switch focus + "ALT+H".action.focus-column-left = { }; + "ALT+L".action.focus-column-right = { }; + "ALT+K".action.focus-workspace-up = { }; + "ALT+J".action.focus-workspace-down = { }; + "Alt+A".action.focus-monitor-left = { }; + "Alt+B".action.focus-monitor-right = { }; + # move windows + "Super+H".action.move-column-left = { }; + "Super+L".action.move-column-right = { }; + "Super+K".action.move-column-to-workspace-up = { }; + "Super+J".action.move-column-to-workspace-down = { }; + "Super+A".action.move-column-to-monitor-left = { }; + "Super+B".action.move-column-to-monitor-right = { }; + # screenshot "Print".action.screenshot = { }; "Ctrl+Print".action.screenshot-screen = { }; "Alt+Print".action.screenshot-window = { }; - - # multimédia / luminosité + # special shortcut "XF86MonBrightnessUp" = { allow-when-locked = true; action.spawn = [ @@ -128,5 +129,7 @@ }; # Aperçu global (overview) "Alt+Tab".action.toggle-overview = { }; + # Quitter niri + "Ctrl+Alt+M".action.quit = { }; }; } diff --git a/home/afoucaultc/packages/niri/conf/layout.nix b/home/afoucaultc/packages/niri/conf/layout.nix index de5fbc6..10d79c1 100644 --- a/home/afoucaultc/packages/niri/conf/layout.nix +++ b/home/afoucaultc/packages/niri/conf/layout.nix @@ -3,7 +3,7 @@ programs.niri.settings.layout = { gaps = 8; center-focused-column = "never"; # never, always, on-overflow - always-center-single-column = true; + always-center-single-column = false; preset-column-widths = [ { proportion = 0.33333; } diff --git a/home/afoucaultc/packages/niri/conf/misc.nix b/home/afoucaultc/packages/niri/conf/misc.nix index 0f3278a..80564d2 100644 --- a/home/afoucaultc/packages/niri/conf/misc.nix +++ b/home/afoucaultc/packages/niri/conf/misc.nix @@ -1,4 +1,4 @@ -{ ... }: +{ config, ... }: { programs.niri.settings = { prefer-no-csd = true; @@ -8,7 +8,14 @@ command = [ "swaybg" "-i" - "~/nixos-config/dotfiles/hypr/wallpaper/nix-wallpaper.png" + "${config.home.homeDirectory}/nixos-config/dotfiles/hypr/wallpaper/nix-wallpaper.png" + ]; + } + { + command = [ + "gnome-keyring-daemon" + "--start" + "--components=secrets" ]; } ]; diff --git a/home/afoucaultc/packages/niri/niri.nix b/home/afoucaultc/packages/niri/niri.nix index 29206d2..db53f88 100644 --- a/home/afoucaultc/packages/niri/niri.nix +++ b/home/afoucaultc/packages/niri/niri.nix @@ -8,7 +8,12 @@ rofi kitty swaylock + swaybg wireplumber brightnessctl + xwayland-satellite + wl-clipboard ]; + # when greetd active + systemd.user.services.niri.enableDefaultPath = false; } diff --git a/home/afoucaultc/packages/other_apps.nix b/home/afoucaultc/packages/other_apps.nix index cd2e2e9..a99039a 100644 --- a/home/afoucaultc/packages/other_apps.nix +++ b/home/afoucaultc/packages/other_apps.nix @@ -34,10 +34,6 @@ ffmpeg fastfetch pkg-config - mako - cliphist - grim - slurp mullvad-vpn rofi bitwarden-desktop diff --git a/home/afoucaultc/packages/other_apps_light.nix b/home/afoucaultc/packages/other_apps_light.nix index bbc49dc..c8e39f0 100644 --- a/home/afoucaultc/packages/other_apps_light.nix +++ b/home/afoucaultc/packages/other_apps_light.nix @@ -31,10 +31,6 @@ fastfetch pkg-config brightnessctl - mako - cliphist - grim - slurp mullvad-vpn rofi # --- Themes diff --git a/hosts/common/hyprland.nix b/hosts/common/hyprland.nix new file mode 100644 index 0000000..2d22b20 --- /dev/null +++ b/hosts/common/hyprland.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + programs.hyprland.enable = true; +} diff --git a/hosts/common/services/gnome-keyring.nix b/hosts/common/services/gnome-keyring.nix index 40fcf95..4f8b115 100644 --- a/hosts/common/services/gnome-keyring.nix +++ b/hosts/common/services/gnome-keyring.nix @@ -2,4 +2,5 @@ { services.gnome.gnome-keyring.enable = true; security.pam.services.login.enableGnomeKeyring = true; + security.pam.services.greetd.enableGnomeKeyring = true; } diff --git a/hosts/common/services/greetd.nix b/hosts/common/services/greetd.nix new file mode 100644 index 0000000..a850557 --- /dev/null +++ b/hosts/common/services/greetd.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: +{ + services.greetd = { + enable = true; + settings = { + default_session = { + # for niri + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --remember-user-session --cmd ${config.programs.niri.package}/bin/niri-session"; + # for hyprland + }; + }; + }; +} diff --git a/home/afoucaultc/packages/protonmail.nix b/hosts/common/services/protonmail.nix similarity index 58% rename from home/afoucaultc/packages/protonmail.nix rename to hosts/common/services/protonmail.nix index a6070b1..c2dcdff 100644 --- a/home/afoucaultc/packages/protonmail.nix +++ b/hosts/common/services/protonmail.nix @@ -1,13 +1,11 @@ { pkgs, ... }: + { - services.gnome-keyring = { + services.protonmail-bridge = { enable = true; - components = [ "secrets" ]; }; - services.protonmail-bridge.enable = true; - - systemd.user.services.protonmail-bridge.Service = { + systemd.user.services.protonmail-bridge.serviceConfig = { ExecStartPre = "${pkgs.bash}/bin/bash -c 'until ${pkgs.systemd}/bin/busctl --user list | grep -q org.freedesktop.secrets; do sleep 1; done'"; RestartSec = "10s"; }; diff --git a/hosts/common/wayland.nix b/hosts/common/wayland.nix index 02fda16..2853451 100644 --- a/hosts/common/wayland.nix +++ b/hosts/common/wayland.nix @@ -7,6 +7,7 @@ security = { polkit.enable = true; pam.services.hyprlock = { }; + pam.services.swaylock = { }; }; programs = { diff --git a/hosts/nixos-home/configuration.nix b/hosts/nixos-home/configuration.nix index 34d75a0..1dadb30 100644 --- a/hosts/nixos-home/configuration.nix +++ b/hosts/nixos-home/configuration.nix @@ -22,11 +22,14 @@ ../common/services/gnome-keyring.nix ../common/services/mullvad.nix ../common/services/sound.nix + ../common/services/greetd.nix + ../common/services/protonmail.nix # programs ../common/programs/gamescope.nix ../common/programs/steam.nix # packages & others ../common/niri.nix + ../common/hyprland.nix ../common/wayland.nix ../common/system_packages.nix # profil nixos pour mon ordi portable maison diff --git a/hosts/nixos-laptop/configuration.nix b/hosts/nixos-laptop/configuration.nix index 8f6c704..8e15c3b 100644 --- a/hosts/nixos-laptop/configuration.nix +++ b/hosts/nixos-laptop/configuration.nix @@ -23,11 +23,14 @@ ../common/services/gnome-keyring.nix ../common/services/mullvad.nix ../common/services/sound.nix + ../common/services/greetd.nix + ../common/services/protonmail.nix # programs ../common/programs/gamescope.nix ../common/programs/steam.nix # packages & others ../common/niri.nix + ../common/hyprland.nix ../common/wayland.nix ../common/system_packages.nix # profil nixos-hardware pour le ThinkPad E560 # nécessite l'input nixos-hardware dans flake.nix