From 8df521bf0f73d2ac6a01aa912725b30d78973bcc Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 11 May 2014 13:31:21 -0500 Subject: [PATCH] sane: use mkSaneConfig to set system environment --- nixos/modules/services/hardware/sane.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix index 01d910575bb5..56e28b50350b 100644 --- a/nixos/modules/services/hardware/sane.nix +++ b/nixos/modules/services/hardware/sane.nix @@ -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;