This repository has no description
4.9 kB
177 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 # (gamescope.overrideAttrs (old: {
93 # patches = old.patches ++ [
94 # ./gamescope_libinput.patch
95 # ];
96 #
97 # }))
98 swaylock-effects # lockscreen
99 pavucontrol
100 swayidle
101 rofi
102 rofi-rbw
103 eog
104 libnotify
105 mako # notifications
106 kanshi # auto-configure display outputs
107 wdisplays # buggy with qtile?
108 wlr-randr
109 wl-clipboard
110 wev
111 blueman
112 grim # screenshots
113 wtype
114 zathura
115 nsxiv
116
117 pavucontrol
118 evince
119 libnotify
120 pamixer
121 file-roller
122 xdg-utils
123 # polkit agent
124 polkit_gnome
125
126 self.packages.${pkgs.system}.menu
127
128 # gtk3 themes
129 gsettings-desktop-schemas
130 (pkgs.writers.writeDashBin "screenshot" ''
131 ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy
132 '')
133 (pkgs.writers.writeDashBin "type_paste" ''
134 ${pkgs.wl-clipboard}/bin/wl-paste | ${pkgs.wtype}/bin/wtype -d 10 -s 400 -
135 '')
136 ];
137
138 environment.pathsToLink = [
139 "/libexec" # for polkit
140 "/share/gsettings-schemas" # for XDG_DATA_DIRS
141 ];
142
143 qt.platformTheme = "qt5ct";
144
145 # from nixpkgs/nixos/modules/services/system/systemd-lock-handler.md
146 services.systemd-lock-handler.enable = true;
147
148 systemd.user.services.swaylock = {
149 description = "Screen locker for Wayland";
150 documentation = [ "man:swaylock(1)" ];
151
152 # Requires graphical session
153 requisite = [ "graphical-session.target" ];
154 after = [ "graphical-session.target" ];
155
156 # If swaylock exits cleanly, unlock the session:
157 onSuccess = [ "unlock.target" ];
158
159 # When lock.target is stopped, stops this too:
160 partOf = [ "lock.target" ];
161
162 # Delay lock.target until this service is ready:
163 before = [ "lock.target" ];
164 wantedBy = [ "lock.target" ];
165
166 serviceConfig = {
167 Type = "simple";
168 # If swaylock crashes, always restart it immediately:
169 Restart = "on-failure";
170 RestartSec = 0;
171 };
172
173 path = [ pkgs.bash ];
174
175 serviceConfig.ExecStart = lib.getExe self.packages.${pkgs.system}.lockscreen;
176 };
177}