session.nix (2163B)
1 # modules/home/session.nix — what every Wayland session needs, whichever 2 # compositor is running: the polkit agent (privilege prompts), clipboard 3 # history, auto-mounting, and the screenshot / clipboard tools the Niri binds 4 # and the toolbox scripts expect on PATH. Gradia (patched, see niri.nix) is the 5 # screenshot editor the Print binds pipe into (arrows, text, censor, gradient 6 # backgrounds); Loupe opens images and zathura opens PDFs by default. Not gated on a desktop switch, so a 7 # Niri-only system keeps working. Everything hangs off graphical-session.target, 8 # which uwsm (Hyprland) and niri-session both manage. 9 { self, ... }: 10 { 11 flake.homeModules.session = 12 { lib, pkgs, ... }: 13 { 14 home.packages = with pkgs; [ 15 grim 16 slurp 17 wl-clipboard 18 libnotify 19 self.packages.${pkgs.stdenv.hostPlatform.system}.gradia # patched: modules/features/desktop/niri.nix 20 loupe 21 ]; 22 23 xdg.mimeApps = { 24 enable = true; 25 defaultApplications = 26 lib.genAttrs [ 27 "application/pdf" 28 "application/postscript" 29 "image/vnd.djvu" 30 "application/vnd.comicbook+zip" 31 ] (_: [ "org.pwmt.zathura.desktop" ]) 32 // lib.genAttrs [ 33 "image/png" 34 "image/jpeg" 35 "image/gif" 36 "image/webp" 37 "image/avif" 38 "image/heif" 39 "image/jxl" 40 "image/bmp" 41 "image/tiff" 42 "image/svg+xml" 43 "image/x-icon" 44 ] (_: [ "org.gnome.Loupe.desktop" ]); 45 }; 46 47 systemd.user.services.hyprpolkitagent = { 48 Unit = { 49 Description = "Hyprland polkit authentication agent"; 50 After = [ "graphical-session.target" ]; 51 PartOf = [ "graphical-session.target" ]; 52 }; 53 Service = { 54 ExecStart = "${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent"; 55 Restart = "on-failure"; 56 Slice = "session.slice"; 57 }; 58 Install.WantedBy = [ "graphical-session.target" ]; 59 }; 60 services.cliphist.enable = true; # history for `caelestia clipboard` and Noctalia's clipboard tab 61 services.udiskie = { 62 enable = true; 63 tray = "auto"; 64 }; 65 } 66 ; 67 }