summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2017-09-19 20:45:15 +0200
committerlassulus <lassulus@lassul.us>2017-09-19 20:45:15 +0200
commitd30480f1457cf4ac4f67f5e02faec75765706e50 (patch)
tree3351e0b97b3ea5ac5cdfc382559e0834714a9b9a /tv
parent358ff6da9c9b7b2ae574f759a8af6266ce642baa (diff)
parented9a1085946589409caba6e18233c329d99c0b4b (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'tv')
-rw-r--r--tv/1systems/xu/config.nix6
-rw-r--r--tv/2configs/br.nix49
-rw-r--r--tv/2configs/default.nix6
-rw-r--r--tv/3modules/charybdis/default.nix2
-rw-r--r--tv/3modules/default.nix1
-rw-r--r--tv/3modules/nixpkgs-overlays.nix23
-rw-r--r--tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix45
-rw-r--r--tv/5pkgs/simple/mfcl2700dnlpr/default.nix44
8 files changed, 170 insertions, 6 deletions
diff --git a/tv/1systems/xu/config.nix b/tv/1systems/xu/config.nix
index 0abd544ce..0363c983d 100644
--- a/tv/1systems/xu/config.nix
+++ b/tv/1systems/xu/config.nix
@@ -16,6 +16,7 @@ with import <stockholm/lib>;
<stockholm/tv/2configs/pulse.nix>
<stockholm/tv/2configs/retiolum.nix>
<stockholm/tv/2configs/binary-cache>
+ <stockholm/tv/2configs/br.nix>
<stockholm/tv/2configs/xserver>
{
environment.systemPackages = with pkgs; [
@@ -155,5 +156,10 @@ with import <stockholm/lib>;
# The NixOS release to be compatible with for stateful data such as databases.
system.stateVersion = "15.09";
+ tv.nixpkgs-overlays = {
+ krebs = "/home/tv/stockholm/krebs/5pkgs";
+ tv = "/home/tv/stockholm/tv/5pkgs";
+ };
+
virtualisation.virtualbox.host.enable = true;
}
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;
+}
diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix
index 241a16b25..9ad0253a3 100644
--- a/tv/2configs/default.nix
+++ b/tv/2configs/default.nix
@@ -90,11 +90,7 @@ with import <stockholm/lib>;
environment.variables = {
NIX_PATH = mkForce (concatStringsSep ":" [
"secrets=/var/src/stockholm/null"
- "nixpkgs-overlays=${pkgs.runCommand "nixpkgs-overlays" {} ''
- mkdir $out
- ln -s /home/tv/stockholm/krebs/5pkgs $out/krebs
- ln -s /home/tv/stockholm/tv/5pkgs $out/tv
- ''}"
+ "nixpkgs-overlays=${config.tv.nixpkgs-overlays}"
"/var/src"
]);
};
diff --git a/tv/3modules/charybdis/default.nix b/tv/3modules/charybdis/default.nix
index 859dc122c..e252f2e1d 100644
--- a/tv/3modules/charybdis/default.nix
+++ b/tv/3modules/charybdis/default.nix
@@ -52,7 +52,7 @@ in {
systemd.services.charybdis = {
wantedBy = [ "multi-user.target" ];
requires = [ "secret.service" ];
- after = [ "network.target" "secret.service" ];
+ after = [ "network-online.target" "secret.service" ];
environment = {
BANDB_DBPATH = "${cfg.user.home}/ban.db";
};
diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix
index 83dc212a6..57ffbfab8 100644
--- a/tv/3modules/default.nix
+++ b/tv/3modules/default.nix
@@ -6,6 +6,7 @@ _:
./ejabberd
./hosts.nix
./iptables.nix
+ ./nixpkgs-overlays.nix
./x0vncserver.nix
];
}
diff --git a/tv/3modules/nixpkgs-overlays.nix b/tv/3modules/nixpkgs-overlays.nix
new file mode 100644
index 000000000..4eb7a86bd
--- /dev/null
+++ b/tv/3modules/nixpkgs-overlays.nix
@@ -0,0 +1,23 @@
+with import <stockholm/lib>;
+{ config, pkgs, ... }: {
+
+ options.tv.nixpkgs-overlays = mkOption {
+ apply = src:
+ pkgs.runCommand "nixpkgs-overlays" {} ''
+ mkdir $out
+ ${concatStringsSep "\n" (mapAttrsToList (name: path:
+ "ln -s ${shell.escape path} $out/${shell.escape name}"
+ ) src)}
+ '' // {
+ inherit src;
+ };
+ type = types.attrsOf types.absolute-pathname;
+ };
+
+ config = {
+ tv.nixpkgs-overlays = {
+ krebs = mkDefault "/var/src/stockholm/krebs/5pkgs";
+ tv = mkDefault "/var/src/stockholm/tv/5pkgs";
+ };
+ };
+}
diff --git a/tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix b/tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix
new file mode 100644
index 000000000..1ef018b33
--- /dev/null
+++ b/tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix
@@ -0,0 +1,45 @@
+{ coreutils, dpkg, fetchurl, gnugrep, gnused, makeWrapper, mfcl2700dnlpr,
+perl, stdenv }:
+
+stdenv.mkDerivation rec {
+ name = "mfcl2700dncupswrapper-${meta.version}";
+
+ src = fetchurl {
+ url = "http://download.brother.com/welcome/dlf102086/${name}.i386.deb";
+ sha256 = "07w48mah0xbv4h8vsh1qd5cd4b463bx8y6gc5x9pfgsxsy6h6da1";
+ };
+
+ nativeBuildInputs = [ dpkg makeWrapper ];
+
+ phases = [ "installPhase" ];
+
+ installPhase = ''
+ dpkg-deb -x $src $out
+
+ basedir=${mfcl2700dnlpr}/opt/brother/Printers/MFCL2700DN
+ dir=$out/opt/brother/Printers/MFCL2700DN
+
+ substituteInPlace $dir/cupswrapper/brother_lpdwrapper_MFCL2700DN \
+ --replace /usr/bin/perl ${perl}/bin/perl \
+ --replace "basedir =~" "basedir = \"$basedir\"; #" \
+ --replace "PRINTER =~" "PRINTER = \"MFCL2700DN\"; #"
+
+ wrapProgram $dir/cupswrapper/brother_lpdwrapper_MFCL2700DN \
+ --prefix PATH : ${stdenv.lib.makeBinPath [ coreutils gnugrep gnused ]}
+
+ mkdir -p $out/lib/cups/filter
+ mkdir -p $out/share/cups/model
+
+ ln $dir/cupswrapper/brother_lpdwrapper_MFCL2700DN $out/lib/cups/filter
+ ln $dir/cupswrapper/brother-MFCL2700DN-cups-en.ppd $out/share/cups/model
+ '';
+
+ meta = {
+ description = "Brother MFC-L2700DN CUPS wrapper driver";
+ homepage = "http://www.brother.com/";
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.tv ];
+ platforms = stdenv.lib.platforms.linux;
+ version = "3.2.0-1";
+ };
+}
diff --git a/tv/5pkgs/simple/mfcl2700dnlpr/default.nix b/tv/5pkgs/simple/mfcl2700dnlpr/default.nix
new file mode 100644
index 000000000..fc11b53e9
--- /dev/null
+++ b/tv/5pkgs/simple/mfcl2700dnlpr/default.nix
@@ -0,0 +1,44 @@
+{ coreutils, dpkg, fetchurl, ghostscript, gnugrep, gnused, pkgsi686Linux, makeWrapper, perl, stdenv, which }:
+
+stdenv.mkDerivation rec {
+ name = "mfcl2700dnlpr-${meta.version}";
+
+ src = fetchurl {
+ url = "http://download.brother.com/welcome/dlf102085/${name}.i386.deb";
+ sha256 = "170qdzxlqikzvv2wphvfb37m19mn13az4aj88md87ka3rl5knk4m";
+ };
+
+ nativeBuildInputs = [ dpkg makeWrapper ];
+
+ phases = [ "installPhase" ];
+
+ installPhase = ''
+ dpkg-deb -x $src $out
+
+ dir=$out/opt/brother/Printers/MFCL2700DN
+
+ substituteInPlace $dir/lpd/filter_MFCL2700DN \
+ --replace /usr/bin/perl ${perl}/bin/perl \
+ --replace "BR_PRT_PATH =~" "BR_PRT_PATH = \"$dir\"; #" \
+ --replace "PRINTER =~" "PRINTER = \"MFCL2700DN\"; #"
+
+ wrapProgram $dir/lpd/filter_MFCL2700DN \
+ --prefix PATH : ${stdenv.lib.makeBinPath [
+ coreutils ghostscript gnugrep gnused which
+ ]}
+
+ interpreter=${pkgsi686Linux.stdenv.cc.libc.out}/lib/ld-linux.so.2
+ patchelf --set-interpreter "$interpreter" $dir/inf/braddprinter
+ patchelf --set-interpreter "$interpreter" $dir/lpd/brprintconflsr3
+ patchelf --set-interpreter "$interpreter" $dir/lpd/rawtobr3
+ '';
+
+ meta = {
+ description = "Brother MFC-L2700DN LPR driver";
+ homepage = "http://www.brother.com/";
+ license = stdenv.lib.licenses.unfree;
+ maintainers = [ stdenv.lib.maintainers.tv ];
+ platforms = stdenv.lib.platforms.linux;
+ version = "3.2.0-1";
+ };
+}