diff --git a/dotfiles/dots.zip b/dotfiles/dots.zip deleted file mode 100644 index 9e919a1..0000000 Binary files a/dotfiles/dots.zip and /dev/null differ diff --git a/dotfiles/inkscape/palettes b/dotfiles/inkscape/palettes index cd4527f..b60ff77 120000 --- a/dotfiles/inkscape/palettes +++ b/dotfiles/inkscape/palettes @@ -1 +1 @@ -/nix/store/4bp4cbx2311fk4h0mrflwd7d2q3z0zwa-home-manager-files/.config/inkscape/palettes \ No newline at end of file +/nix/store/vqp7indgm0igwilycffxj384y17x2g7z-home-manager-files/.config/inkscape/palettes \ No newline at end of file diff --git a/dotfiles/inkscape/templates b/dotfiles/inkscape/templates index 3f618ce..d77e01d 120000 --- a/dotfiles/inkscape/templates +++ b/dotfiles/inkscape/templates @@ -1 +1 @@ -/nix/store/4bp4cbx2311fk4h0mrflwd7d2q3z0zwa-home-manager-files/.config/inkscape/templates \ No newline at end of file +/nix/store/vqp7indgm0igwilycffxj384y17x2g7z-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 3b443d9..82fc856 120000 --- a/dotfiles/kitty/kitty.conf +++ b/dotfiles/kitty/kitty.conf @@ -1 +1 @@ -/nix/store/4bp4cbx2311fk4h0mrflwd7d2q3z0zwa-home-manager-files/.config/kitty/kitty.conf \ No newline at end of file +/nix/store/vqp7indgm0igwilycffxj384y17x2g7z-home-manager-files/.config/kitty/kitty.conf \ No newline at end of file diff --git a/home/afoucaultc/dotfiles_apps.nix b/home/afoucaultc/dotfiles_apps.nix index 76561ff..e7c663f 100644 --- a/home/afoucaultc/dotfiles_apps.nix +++ b/home/afoucaultc/dotfiles_apps.nix @@ -1,20 +1,18 @@ { config, ... }: +let + dots = "${config.home.homeDirectory}/nixos-config/dotfiles"; + link = config.lib.file.mkOutOfStoreSymlink; +in { - # dotfiles pour inkscape (fichier dimensionné pour LaTeX) xdg.configFile = { - "inkscape/templates".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos-config/dotfiles/inkscape/templates"; - "inkscape/palettes".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos-config/dotfiles/inkscape/palettes"; - }; # dotfiles pour Rofi - xdg.configFile."rofi".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos-config/dotfiles/rofi"; - # dotfiles pour hyprland - xdg.configFile."hypr".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos-config/dotfiles/hypr"; - # dotfiles nvim - xdg.configFile."nvim".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos-config/dotfiles/nvim"; + "inkscape/templates".source = link "${dots}/inkscape/templates"; + "inkscape/palettes".source = link "${dots}/inkscape/palettes"; + "rofi".source = link "${dots}/rofi"; + "nvim".source = link "${dots}/nvim"; + }; + + # hypr/conf est un symlink hors-store : utilise home.file, pas xdg.configFile + home.file.".config/hypr/conf".source = link "${dots}/hypr/conf"; } # xdg.configFile."i3blocks/config".source = ./i3blocks.conf; diff --git a/home/afoucaultc/home.nix b/home/afoucaultc/home.nix index d63379f..9c23a75 100644 --- a/home/afoucaultc/home.nix +++ b/home/afoucaultc/home.nix @@ -14,6 +14,7 @@ ./packages/mpv.nix #./packages/music.nix ./packages/neovim.nix + ./packages/niri.nix ./packages/nextcloud.nix ./packages/obs.nix ./packages/other_apps.nix diff --git a/home/afoucaultc/packages/hyprland.nix b/home/afoucaultc/packages/hyprland.nix index aa688df..6cab09c 100644 --- a/home/afoucaultc/packages/hyprland.nix +++ b/home/afoucaultc/packages/hyprland.nix @@ -1,5 +1,45 @@ -{ pkgs, ... }: { + pkgs, + config, + 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; + xwayland.enable = true; + configType = "lua"; + systemd = { + enable = true; + variables = [ "--all" ]; + }; + + extraConfig = '' + local hypr_config = os.getenv("XDG_CONFIG_HOME") or "${config.xdg.configHome}" + package.path = hypr_config .. "/hypr/?.lua;" + .. hypr_config .. "/hypr/?/init.lua;" + .. package.path + + require("conf.variables") + require("conf.binding") + require("conf.env") + require("conf.input") + require("conf.others") + require("conf.monitor") + require("conf.startup") + require("conf.style") + require("conf.windowrules") + require("conf.workspace") + ''; + }; + + services.hyprpolkitagent.enable = true; + home.packages = with pkgs; [ hyprpaper hyprlock diff --git a/home/afoucaultc/packages/niri.nix b/home/afoucaultc/packages/niri.nix index f3c9cc9..56c9a1e 100644 --- a/home/afoucaultc/packages/niri.nix +++ b/home/afoucaultc/packages/niri.nix @@ -1,22 +1,270 @@ -{ ... }: { - programs.niri = { + 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 = true; - input.keyboard.xkb = { - layout = "us"; - variant = "intl"; + 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 = 4; + 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 = { - enable = true; width = 2; - active.color = "#${config.colorScheme.palette.base0D}ff"; - inactive.color = "#${config.colorScheme.palette.base03}ff"; + 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/hosts/nixos-home/config/wayland.nix b/hosts/nixos-home/config/wayland.nix new file mode 100644 index 0000000..16efc53 --- /dev/null +++ b/hosts/nixos-home/config/wayland.nix @@ -0,0 +1,40 @@ +{ + pkgs, + lib, + inputs, + ... +}: +{ + security = { + polkit.enable = true; + pam.services.hyprlock = { }; + }; + + programs = { + dconf.enable = true; + xwayland.enable = true; + }; + + services.graphical-desktop.enable = true; + + services.xserver.desktopManager.runXdgAutostartIfNone = lib.mkDefault true; + + xdg.portal = { + enable = true; + extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; + }; + + nix.settings = { + substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIITfGmwGaMwaOAd6DDeaU=" + ]; + }; + + security.wrappers.Hyprland = { + owner = "root"; + group = "root"; + capabilities = "cap_sys_nice+ep"; + source = lib.getExe inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + }; +} diff --git a/hosts/nixos-home/configuration.nix b/hosts/nixos-home/configuration.nix index 693b843..501e740 100644 --- a/hosts/nixos-home/configuration.nix +++ b/hosts/nixos-home/configuration.nix @@ -25,7 +25,7 @@ ./config/programs/gamescope.nix ./config/programs/steam.nix # packages & others - ./config/hyprland.nix + ./config/wayland.nix ./config/system_packages.nix # profil nixos pour mon ordi portable maison # nécessite l'input nixos-hardware dans flake.nix. diff --git a/hosts/nixos-laptop/config/wayland.nix b/hosts/nixos-laptop/config/wayland.nix new file mode 100644 index 0000000..16efc53 --- /dev/null +++ b/hosts/nixos-laptop/config/wayland.nix @@ -0,0 +1,40 @@ +{ + pkgs, + lib, + inputs, + ... +}: +{ + security = { + polkit.enable = true; + pam.services.hyprlock = { }; + }; + + programs = { + dconf.enable = true; + xwayland.enable = true; + }; + + services.graphical-desktop.enable = true; + + services.xserver.desktopManager.runXdgAutostartIfNone = lib.mkDefault true; + + xdg.portal = { + enable = true; + extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; + }; + + nix.settings = { + substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIITfGmwGaMwaOAd6DDeaU=" + ]; + }; + + security.wrappers.Hyprland = { + owner = "root"; + group = "root"; + capabilities = "cap_sys_nice+ep"; + source = lib.getExe inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + }; +} diff --git a/hosts/nixos-laptop/configuration.nix b/hosts/nixos-laptop/configuration.nix index eace888..b97d124 100644 --- a/hosts/nixos-laptop/configuration.nix +++ b/hosts/nixos-laptop/configuration.nix @@ -10,7 +10,6 @@ ./config/drivers_video.nix ./config/extra-services.nix ./config/fonts.nix - ./config/hyprland.nix ./config/language.nix ./config/power_management.nix ./config/sound.nix @@ -19,6 +18,7 @@ ./config/system_saves.nix ./config/system_services.nix ./config/user.nix + ./config/wayland.nix # ajout pour forcer l'utilisation de cachix au max ./config/low-ram.nix # profil nixos-hardware pour le ThinkPad E560