This repository has no description
4.7 kB
171 lines
1{
2 self,
3 pkgs,
4 lib,
5 ...
6}:
7{
8 imports = [
9 ../../alacritty.nix
10 ../../kitty.nix
11 ../../xdg-open.nix
12 ../../yubikey.nix
13 ../../themes.nix
14 ../../fonts.nix
15 # ../pipewire.nix
16 # ./tty-share.nix
17 {
18 users.users.mainUser.packages = [
19 pkgs.sshuttle
20 self.packages.${pkgs.system}.mpv
21 ];
22 security.sudo.extraConfig = ''
23 lass ALL= (root) NOPASSWD:SETENV: ${pkgs.sshuttle}/bin/.sshuttle-wrapped
24 '';
25 }
26 ];
27
28 services.earlyoom = {
29 enable = true;
30 freeMemThreshold = 5;
31 };
32
33 users.users.mainUser.extraGroups = [
34 "audio"
35 "video"
36 "input"
37 ];
38
39 xdg.portal.enable = true;
40 xdg.portal.extraPortals = [
41 pkgs.xdg-desktop-portal-gtk
42 pkgs.xdg-desktop-portal-wlr
43 ];
44 xdg.portal.config.common.default = "wlr";
45 # Firefox (and chromium, obs) always ask the ScreenCast portal for
46 # MONITOR|WINDOW. xdg-desktop-portal-wlr then skips the slurp entry of its
47 # default chooser list — slurp cannot pick a window — and falls through to the
48 # dmenu-style entries (wmenu, wofi, rofi, bemenu, ...), none of which nixpkgs
49 # wraps into the portal: NixOS/nixpkgs#471244. So SelectSources died with
50 # "no output found" before any picker appeared and every screenshare failed.
51 # Pin an absolute dmenu chooser, which lists monitors and windows alike.
52 xdg.portal.wlr.settings.screencast = {
53 chooser_type = "dmenu";
54 chooser_cmd = "${lib.getExe pkgs.wofi} -d -n --prompt='Select a source to share:'";
55 };
56 fonts.enableDefaultPackages = true;
57
58 # PipeWire runs system-wide and is usually not ready yet when sway starts the
59 # screencast portal at login. The default unit retries every 100ms and trips
60 # the start-limit within a second, then stays dead for the whole session —
61 # which silently breaks screensharing. Keep retrying with a sane delay and no
62 # give-up so it comes up as soon as PipeWire accepts connections.
63 systemd.user.services.xdg-desktop-portal-wlr = {
64 startLimitIntervalSec = 0;
65 serviceConfig = {
66 Restart = lib.mkForce "on-failure";
67 RestartSec = lib.mkForce 2;
68 };
69 };
70
71 security.polkit.enable = true;
72 security.pam.services.swaylock = { };
73 security.pam.services.swaylock-plugin = { };
74
75 programs.dconf.enable = lib.mkDefault true;
76 services.gnome.gnome-keyring.enable = lib.mkDefault true;
77 programs.xwayland.enable = lib.mkDefault true;
78
79 environment.sessionVariables = {
80 MOZ_ENABLE_WAYLAND = "1";
81 XDG_SESSION_TYPE = "wayland";
82 SDL_VIDEODRIVER = "wayland";
83 QT_QPA_PLATFORM = "wayland";
84 QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
85 _JAVA_AWT_WM_NONREPARENTING = "1";
86 NIXOS_OZONE_WL = "1"; # Hint for electron apps to use wayland
87 };
88
89 programs.wshowkeys.enable = true;
90
91 environment.systemPackages = with pkgs; [
92 swaylock-effects # lockscreen
93 pavucontrol
94 swayidle
95 rofi
96 rofi-rbw
97 eog
98 libnotify
99 mako # notifications
100 kanshi # auto-configure display outputs
101 wdisplays # buggy with qtile?
102 wlr-randr
103 wl-clipboard
104 wev
105 blueman
106 grim # screenshots
107 wtype
108 zathura
109 nsxiv
110
111 pavucontrol
112 evince
113 libnotify
114 pamixer
115 file-roller
116 xdg-utils
117 # polkit agent
118 polkit_gnome
119
120 self.packages.${pkgs.system}.menu
121
122 # gtk3 themes
123 gsettings-desktop-schemas
124 (pkgs.writers.writeDashBin "screenshot" ''
125 ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy
126 '')
127 (pkgs.writers.writeDashBin "type_paste" ''
128 ${pkgs.wl-clipboard}/bin/wl-paste | ${pkgs.wtype}/bin/wtype -d 10 -s 400 -
129 '')
130 ];
131
132 environment.pathsToLink = [
133 "/libexec" # for polkit
134 "/share/gsettings-schemas" # for XDG_DATA_DIRS
135 ];
136
137 qt.platformTheme = "qt5ct";
138
139 # from nixpkgs/nixos/modules/services/system/systemd-lock-handler.md
140 services.systemd-lock-handler.enable = true;
141
142 systemd.user.services.swaylock = {
143 description = "Screen locker for Wayland";
144 documentation = [ "man:swaylock(1)" ];
145
146 # Requires graphical session
147 requisite = [ "graphical-session.target" ];
148 after = [ "graphical-session.target" ];
149
150 # If swaylock exits cleanly, unlock the session:
151 onSuccess = [ "unlock.target" ];
152
153 # When lock.target is stopped, stops this too:
154 partOf = [ "lock.target" ];
155
156 # Delay lock.target until this service is ready:
157 before = [ "lock.target" ];
158 wantedBy = [ "lock.target" ];
159
160 serviceConfig = {
161 Type = "simple";
162 # If swaylock crashes, always restart it immediately:
163 Restart = "on-failure";
164 RestartSec = 0;
165 };
166
167 path = [ pkgs.bash ];
168
169 serviceConfig.ExecStart = lib.getExe self.packages.${pkgs.system}.lockscreen;
170 };
171}