summary refs log tree commit diff
path: root/nixos/modules/programs/light.nix
blob: c89f8e937216f3c5bfd2d0d0b5ab194e3729f34b (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
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.programs.light;

in
{
  options = {
    programs.light = {
      enable = mkOption {
        default = false;
        type = types.bool;
        description = ''
          Whether to install Light backlight control with setuid wrapper.
        '';
      };
    };
  };

  config = mkIf cfg.enable {
    environment.systemPackages = [ pkgs.light ];

    security.permissionsWrappers.setuid =
    [ { program = "light";
        source  = "${pkgs.light.out}/bin/light";
        owner   = "root";
        group   = "root";
        setuid  = true;        
    }];
  };
}