summaryrefslogtreecommitdiffstats
path: root/lass/2configs/br.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-11-02 21:44:31 +0100
committertv <tv@krebsco.de>2017-11-02 21:44:31 +0100
commit7f342406b7e5e65467128c2c06d443e437fffb28 (patch)
tree39ebfca930d1c331b54b7bf3bfb422c6cfa80348 /lass/2configs/br.nix
parentab98a1be65369ae3c06de8f6219275e882f08fa7 (diff)
parent6934b5d83f245b723cf7d685d7ab0a758947bdc8 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'lass/2configs/br.nix')
-rw-r--r--lass/2configs/br.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/lass/2configs/br.nix b/lass/2configs/br.nix
new file mode 100644
index 000000000..35bac8fee
--- /dev/null
+++ b/lass/2configs/br.nix
@@ -0,0 +1,48 @@
+with import <stockholm/lib>;
+{ config, pkgs, ... }: {
+
+ imports = [
+ <nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix>
+ ];
+
+ krebs.nixpkgs.allowUnfreePredicate = pkg: any (flip hasPrefix pkg.name) [
+ "brother-udev-rule-type1-"
+ "brscan4-"
+ "mfcl2700dnlpr-"
+ ];
+
+ hardware.sane = {
+ enable = true;
+ brscan4 = {
+ enable = true;
+ netDevices = {
+ bra = {
+ model = "MFCL2700DN";
+ ip = "10.23.42.221";
+ };
+ };
+ };
+ };
+
+ 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
+ ];
+ };
+
+}