2017-10-26 18:01:37 +00:00
|
|
|
with import <stockholm/lib>;
|
|
|
|
{ config, pkgs, ... }: {
|
|
|
|
|
|
|
|
imports = [
|
|
|
|
<nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix>
|
|
|
|
];
|
|
|
|
|
2019-09-04 18:17:56 +00:00
|
|
|
krebs.nixpkgs.allowUnfreePredicate = pkg: any (eq (packageName pkg)) [
|
|
|
|
"brother-udev-rule-type1"
|
|
|
|
"brscan4"
|
|
|
|
"brscan4-etc-files"
|
|
|
|
"mfcl2700dnlpr"
|
2017-10-26 18:01:37 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
hardware.sane = {
|
|
|
|
enable = true;
|
|
|
|
brscan4 = {
|
|
|
|
enable = true;
|
|
|
|
netDevices = {
|
|
|
|
bra = {
|
|
|
|
model = "MFCL2700DN";
|
2019-12-07 21:43:59 +00:00
|
|
|
ip = "10.42.0.4";
|
2017-10-26 18:01:37 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.saned.enable = true;
|
|
|
|
|
|
|
|
# usage: scanimage -d "$(find-scanner bra)" --batch --format=tiff --resolution 150 -x 211 -y 298
|
|
|
|
environment.systemPackages = [
|
|
|
|
(pkgs.writeDashBin "find-scanner" ''
|
|
|
|
set -efu
|
|
|
|
name=$1
|
|
|
|
${pkgs.sane-backends}/bin/scanimage -f '%m %d
|
|
|
|
' \
|
|
|
|
| ${pkgs.gawk}/bin/awk -v dev="*$name" '$1 == dev { print $2; exit }' \
|
|
|
|
| ${pkgs.gnugrep}/bin/grep .
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
|
|
|
services.printing = {
|
|
|
|
enable = true;
|
|
|
|
drivers = [
|
|
|
|
pkgs.mfcl2700dncupswrapper
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2022-05-29 17:47:05 +00:00
|
|
|
users.users.mainUser.extraGroups = [ "scanner" "lp" ];
|
|
|
|
|
2017-10-26 18:01:37 +00:00
|
|
|
}
|