aboutsummaryrefslogtreecommitdiffstats
path: root/hosts/common/optional/services/xorg.nix
blob: b426408e960b4619ec6255d54671d1200111a481 (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
{ pkgs, ... }:
{
  #environment.systemPackages = builtins.attrValues {
  #  inherit (pkgs)
  environment.systemPackages = with pkgs; [
    evince
    feh
    gcr
    geeqie
    gimp
    #gimp-with-plugins
    google-chrome
    gv
    inkscape
    libreoffice
    libva-utils
    mesa-demos
    mpv
    polkit_gnome
    rdesktop
    read-edid
    st
    sxiv
    tigervnc
    turbovnc
    vdpauinfo
    vlc
    vulkan-tools
    wireshark
    x11vnc
    xclip
    xdotool
    xorg.appres
    xorg.editres
    xorg.xdpyinfo
    xorg.xev
    xscreensaver
    xsnow
    xterm#;
  ];
  #};

  programs.firefox.enable = true;

  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;
  services.printing.enable = true;
  services.displayManager.defaultSession = "xsession";
  services.libinput.enable = true;
  services.xserver = {
    displayManager.lightdm = {
      enable = true;
      extraSeatDefaults = ''greeter-hide-users=true'';
    };

    displayManager.session = [
      {
        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;
        };
    };
  };
}