sane: use mkSaneConfig to set system environment
This commit is contained in:
parent
4fb9c3700a
commit
8df521bf0f
|
@ -5,6 +5,8 @@ with lib;
|
||||||
let
|
let
|
||||||
|
|
||||||
pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends;
|
pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends;
|
||||||
|
backends = [ pkg ] ++ config.hardware.sane.extraBackends;
|
||||||
|
saneConfig = pkgs.mkSaneConfig { paths = backends; };
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -26,6 +28,12 @@ in
|
||||||
description = "Use a development snapshot of SANE scanner drivers.";
|
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 {
|
config = mkIf config.hardware.sane.enable {
|
||||||
|
|
||||||
environment.systemPackages = [ pkg ];
|
environment.systemPackages = backends;
|
||||||
services.udev.packages = [ pkg ];
|
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;
|
users.extraGroups."scanner".gid = config.ids.gids.scanner;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user