summaryrefslogtreecommitdiffstats
path: root/tv/2configs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-09-19 20:03:12 +0200
committertv <tv@krebsco.de>2017-09-19 20:17:06 +0200
commit755e3a46682b90729be8a82026b08429cd7baea8 (patch)
treed455db306921544c17f2fc7997505b5ccc62fdf6 /tv/2configs
parentb2c02a186b0dba18f303c973b238e3b9c2de06b7 (diff)
tv br config: init
Diffstat (limited to 'tv/2configs')
-rw-r--r--tv/2configs/br.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/tv/2configs/br.nix b/tv/2configs/br.nix
new file mode 100644
index 000000000..c7eb20e90
--- /dev/null
+++ b/tv/2configs/br.nix
@@ -0,0 +1,49 @@
+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.1.214";
+ };
+ };
+ };
+ };
+
+ 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
+ ];
+ };
+
+ systemd.services.cups.serviceConfig.PrivateTmp = true;
+}