aboutsummaryrefslogtreecommitdiffstats
path: root/hosts/common/optional/services/xorg.nix
blob: e0150f47eb1e23c6ce12aa7c44f6ae1abe51ac9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{ config, lib, pkgs, ... }:
{
  environment.systemPackages = [
    pkgs.chafa
    pkgs.evince
    pkgs.feh
    pkgs.gcr
    pkgs.geeqie
    pkgs.ghostty
    pkgs.gimp
    #pkgs.gimp-with-plugins
    pkgs.google-chrome
    pkgs.gv
    pkgs.inkscape
    pkgs.kdePackages.okular
    pkgs.libreoffice
    pkgs.libva-utils
    pkgs.mesa-demos
    pkgs.mpv
    pkgs.polkit_gnome
    pkgs.rdesktop
    pkgs.read-edid
    pkgs.st
    pkgs.sxiv
    pkgs.tigervnc
    pkgs.turbovnc
    pkgs.vdpauinfo
    pkgs.vlc
    pkgs.vulkan-tools
    pkgs.wireshark
    pkgs.x11vnc
    pkgs.xclip
    pkgs.xdotool
    pkgs.xorg.appres
    pkgs.xorg.editres
    pkgs.xorg.xdpyinfo
    pkgs.xorg.xev
    pkgs.xscreensaver
    pkgs.xsnow
    pkgs.xterm
  ];

  programs.firefox = {
    enable = true;
    package = pkgs.master.firefox;
  };

  security.polkit = {
    enable = true;
    extraConfig = ''
      polkit.addRule(function(action, subject) {
        if (
          subject.isInGroup("users")
            && (
              action.id == "org.freedesktop.login1.reboot" ||
              action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
              action.id == "org.freedesktop.login1.power-off" ||
              action.id == "org.freedesktop.login1.power-off-multiple-sessions"
            )
          )
        {
          return polkit.Result.YES;
        }
      })
    '';
  };

  services = {
    blueman.enable = true;
    displayManager = lib.mkIf (config.networking.hostName != "fangorn") {
      defaultSession = "xsession";
    };
    libinput.enable = true;
    picom.enable = true;
    printing.enable = true;
    xserver = {
      displayManager.lightdm = lib.mkMerge [
        (lib.mkIf (config.networking.hostName == "fangorn") {
          enable = true;
        })
        (lib.mkIf (config.networking.hostName != "fangorn") {
          enable = true;
          extraSeatDefaults = ''greeter-hide-users=true'';
        })
      ];
  
      displayManager.session = lib.mkIf (config.networking.hostName != "fangorn") [
        {
          manage = "desktop";
          name = "xsession";
          start = ''exec $HOME/.xsession'';
        }
      ];
  
      enable = true;
      xkb.layout = "us";
      xkb.options = "caps:super,compose:ralt";
    };
  };

  systemd = {
    user.services.polkit-gnome-authentication-agent-1 = {
      description = "polkit-gnome-authentication-agent-1";
      wantedBy = [ "graphical-session.target" ];
      wants = [ "graphical-session.target" ];
      after = [ "graphical-session.target" ];
      serviceConfig = {
          Type = "simple";
          ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
          Restart = "on-failure";
          RestartSec = 1;
          TimeoutStopSec = 10;
        };
    };
  };
}