about summary refs log tree commit diff
path: root/nixos/modules/services/hardware/sane.nix
blob: 5979feb824094c7955fffbafd99459daa9a294a7 (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
{ config, pkgs, ... }:

with pkgs.lib;

let

  pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends;

in

{

  ###### interface

  options = {

    hardware.sane.enable = mkOption {
      type = types.bool;
      default = false;
      description = "Enable support for SANE scanners.";
    };

    hardware.sane.snapshot = mkOption {
      type = types.bool;
      default = false;
      description = "Use a development snapshot of SANE scanner drivers.";
    };

  };


  ###### implementation

  config = mkIf config.hardware.sane.enable {

    environment.systemPackages = [ pkg ];
    services.udev.packages = [ pkg ];

    users.extraGroups."scanner".gid = config.ids.gids.scanner;

  };

}