sane: use mkSaneConfig to set system environment

This commit is contained in:
Thomas Tuegel 2014-05-11 13:31:21 -05:00
parent 4fb9c3700a
commit 8df521bf0f

View File

@ -5,6 +5,8 @@ with lib;
let
pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends;
backends = [ pkg ] ++ config.hardware.sane.extraBackends;
saneConfig = pkgs.mkSaneConfig { paths = backends; };
in
@ -26,6 +28,12 @@ in
description = "Use a development snapshot of SANE scanner drivers.";
};
hardware.sane.extraBackends = mkOption {
type = types.listOf types.path;
default = [];
description = "Packages providing extra SANE backends to enable.";
};
};
@ -33,8 +41,12 @@ in
config = mkIf config.hardware.sane.enable {
environment.systemPackages = [ pkg ];
services.udev.packages = [ pkg ];
environment.systemPackages = backends;
environment.variables = {
SANE_CONFIG_DIR = "${saneConfig}/etc/sane.d";
LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ];
};
services.udev.packages = backends;
users.extraGroups."scanner".gid = config.ids.gids.scanner;