Summary Files Commits Branches @commit @diff @stats
path: root / services.nix
blob: 0ba14cfd74a94bb494ca61b32b754d324c22f1df (plain) (blame)
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

{ config, pkgs, ... }:

{
  virtualisation.libvirtd.enable = true;
  systemd.user.services = {
    lxqt-policykit = {
      description = "lxqt-policykit runner";
      wantedBy = [ "graphical-session.target" ];
      wants = [ "graphical-session.target" ];
      after = [ "graphical-session.target" ];
      serviceConfig = {
        Type = "simple";
        ExecStart = "${pkgs.lxqt.lxqt-policykit}/bin/lxqt-policykit-agent";
        Restart = "on-failure";
        RestartSec = 1;
        TimeoutStopSec = 10;
      };
    };

    devilspie2 = {
      description = "devilspie2 runner";
      wantedBy = [ "graphical-session.target" ];
      wants = [ "graphical-session.target" ];
      after = [ "graphical-session.target" ];
      serviceConfig = {
        ExecStart = "${pkgs.devilspie2}/bin/devilspie2";
        Restart = "on-failure";
        RestartSec = 1;
        TimeoutStopSec = 10;
      };
    };

    # This is kinda gross, because the xautolock service is already defined and configured
    # inside services.xserver.xautolock, but it's the only way I know
    xautolock.serviceConfig.Environment = [ "DISPLAY=:0" "PATH=/run/current-system/sw/bin" ];
  };

  systemd.services = {
    lockscreen = {
      wantedBy = [ "sleep.target" ];
      before = [ "suspend.target" ];
      serviceConfig = {
        User = "kamen";
        Environment = [ "DISPLAY=:0" "PATH=/run/current-system/sw/bin" "DBUS_SESSION_BUS_ADDRESS=\"unix:path=/run/user/1000/bus\"" ];
        ExecStart = "/home/kamen/.a/sys/lock.sh";
      };
    };
  };

  services = {
    upower.enable = true;
    tlp.enable = true;
    udisks2.enable = true; # gnome-disks disk access
    gnome.gnome-keyring.enable = true;
    gvfs.enable = true; # MTP (for nemo)

    logind.extraConfig = ''
      InhibitDelayMaxSec=1
      HoldoffTimeoutSec=1s
      HandlePowerKey=poweroff'';

    thinkfan = {
      enable = true;
      levels = [
        [0  0 35]
        [1 35 38]
        [3 38 53]
        ["level auto" 53 32767]
      ];
    };

    httpd = {
      enable = true;

      virtualHosts = {
        syndamiadotcom-local = {
          hostName = "synd.local";
          listen = [ { port = 80; } ];
          documentRoot = "/home/kamen/Programming/GitLab-repos/syndamiadotcom/website";
        };
      };
    };

    xserver = {
      enable = true;
      # xkbmap
      layout = "us,bg"; # TODO us,bg-custom
      xkbVariant = ",phonetic";
      xkbOptions = "grp:alt_shift_toggle,lv3:switch,caps:escape";

      # Window manager
      windowManager.openbox.enable = true;

      # touchpad support
      libinput = {
        enable = true;
        touchpad.naturalScrolling = true;
      };

      xautolock = {
        enable = true;
        time = 15;
        locker = "/home/kamen/.a/sys/lock.sh";
        extraOptions = [ "-detectsleep" "-secure" ];
      };
    };
  };
}