about summary refs log tree commit diff
path: root/users/fcuny/desktop/wm/screenlock.nix
blob: 24fde8c3172996d059ce644e16f835cbe157309d (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
{ pkgs, config, ... }:

{

  xdg.configFile."swaylock/config" = {
    source = ../../configs/swaylock/config;
  };

  # https://github.com/nix-community/home-manager/pull/2610
  # won't be needed for ever
  systemd.user.services.swayidle = {
    Unit.PartOf = [ "sway-session.target" ];
    Install.WantedBy = [ "sway-session.target" ];

    Service = {
      Environment = "PATH=${pkgs.bash}/bin:${config.wayland.windowManager.sway.package}/bin";
      ExecStart = ''
        ${pkgs.swayidle}/bin/swayidle -w \
            timeout 300 "${pkgs.swaylock}/bin/swaylock" \
            timeout 300 'swaymsg "output * dpms off"' \
                resume 'swaymsg "output * dpms on"' \
            before-sleep "${pkgs.swaylock}/bin/swaylock"
      '';
      Restart = "on-failure";
    };
  };
}