summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-09-29 21:28:23 +0200
committermakefu <github@syntax-fehler.de>2017-09-29 21:28:23 +0200
commitc352397385d5e7cbf2095ead0aa4a74be116da34 (patch)
tree72a730cb2b451b5700a8eaf9420b4bd46f513ba9 /tv
parent9d9e9bc3d8087974370e3d62bc05d2332b2efab2 (diff)
parent37951eed3dd7806f73c40c47ec9cd047ad76c15d (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'tv')
-rw-r--r--tv/1systems/cd/config.nix35
-rw-r--r--tv/1systems/cd/source.nix3
-rw-r--r--tv/1systems/wu/config.nix1
-rw-r--r--tv/1systems/xu/config.nix6
-rw-r--r--tv/2configs/backup.nix12
-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/default.nix4
-rw-r--r--tv/5pkgs/simple/diff-so-fancy.nix48
-rw-r--r--tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix45
-rw-r--r--tv/5pkgs/simple/mfcl2700dnlpr/default.nix44
-rw-r--r--tv/5pkgs/simple/q/default.nix18
15 files changed, 233 insertions, 64 deletions
diff --git a/tv/1systems/cd/config.nix b/tv/1systems/cd/config.nix
deleted file mode 100644
index 341a62e45..000000000
--- a/tv/1systems/cd/config.nix
+++ /dev/null
@@ -1,35 +0,0 @@
-with import <stockholm/lib>;
-{ config, pkgs, ... }: let
-
- bestGuessGateway = addr: elemAt (match "(.*)(\.[^.])" addr) 0 + ".1";
-
-in {
- krebs.build.host = config.krebs.hosts.cd;
-
- imports = [
- <stockholm/tv>
- <stockholm/tv/2configs/hw/CAC-Developer-2.nix>
- <stockholm/tv/2configs/fs/CAC-CentOS-7-64bit.nix>
- <stockholm/tv/2configs/exim-smarthost.nix>
- <stockholm/tv/2configs/retiolum.nix>
- ];
-
- networking = let
- address = config.krebs.build.host.nets.internet.ip4.addr;
- in {
- defaultGateway = bestGuessGateway address;
- interfaces.enp2s1.ip4 = singleton {
- inherit address;
- prefixLength = 24;
- };
- nameservers = ["8.8.8.8"];
- };
-
- environment.systemPackages = with pkgs; [
- iftop
- iotop
- iptables
- nethogs
- tcpdump
- ];
-}
diff --git a/tv/1systems/cd/source.nix b/tv/1systems/cd/source.nix
deleted file mode 100644
index 019e8bc22..000000000
--- a/tv/1systems/cd/source.nix
+++ /dev/null
@@ -1,3 +0,0 @@
-import <stockholm/tv/source.nix> {
- name = "cd";
-}
diff --git a/tv/1systems/wu/config.nix b/tv/1systems/wu/config.nix
index 79b5aa269..5c593894a 100644
--- a/tv/1systems/wu/config.nix
+++ b/tv/1systems/wu/config.nix
@@ -8,7 +8,6 @@ with import <stockholm/lib>;
<stockholm/tv/2configs/hw/w110er.nix>
<stockholm/tv/2configs/exim-retiolum.nix>
<stockholm/tv/2configs/gitrepos.nix>
- <stockholm/tv/2configs/im.nix>
<stockholm/tv/2configs/mail-client.nix>
<stockholm/tv/2configs/man.nix>
<stockholm/tv/2configs/nginx/public_html.nix>
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/backup.nix b/tv/2configs/backup.nix
index 46e3f70f2..f76fb2e01 100644
--- a/tv/2configs/backup.nix
+++ b/tv/2configs/backup.nix
@@ -52,12 +52,6 @@ with import <stockholm/lib>;
dst = { host = config.krebs.hosts.zu; path = "/bku/xu-home"; };
startAt = "06:20";
};
- xu-pull-cd-home = {
- method = "pull";
- src = { host = config.krebs.hosts.cd; path = "/home"; };
- dst = { host = config.krebs.hosts.xu; path = "/bku/cd-home"; };
- startAt = "07:00";
- };
xu-pull-ni-ejabberd = {
method = "pull";
src = { host = config.krebs.hosts.ni; path = "/var/ejabberd"; };
@@ -76,12 +70,6 @@ with import <stockholm/lib>;
dst = { host = config.krebs.hosts.xu; path = "/bku/zu-home"; };
startAt = "05:00";
};
- zu-pull-cd-home = {
- method = "pull";
- src = { host = config.krebs.hosts.cd; path = "/home"; };
- dst = { host = config.krebs.hosts.zu; path = "/bku/cd-home"; };
- startAt = "06:30";
- };
zu-pull-ni-ejabberd = {
method = "pull";
src = { host = config.krebs.hosts.ni; path = "/var/ejabberd"; };
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/default.nix b/tv/5pkgs/default.nix
index 8a7a613ba..1796609a9 100644
--- a/tv/5pkgs/default.nix
+++ b/tv/5pkgs/default.nix
@@ -24,6 +24,10 @@ foldl' mergeAttrs {}
"$@"
'';
+ gitAndTools = super.gitAndTools // {
+ inherit (self) diff-so-fancy;
+ };
+
ff = self.writeDashBin "ff" ''
exec ${self.firefoxWrapper}/bin/firefox "$@"
'';
diff --git a/tv/5pkgs/simple/diff-so-fancy.nix b/tv/5pkgs/simple/diff-so-fancy.nix
new file mode 100644
index 000000000..9ce6d9234
--- /dev/null
+++ b/tv/5pkgs/simple/diff-so-fancy.nix
@@ -0,0 +1,48 @@
+{stdenv, git, perl, ncurses, coreutils, fetchFromGitHub, makeWrapper, ...}:
+
+stdenv.mkDerivation rec {
+ name = "diff-so-fancy-${version}";
+ version = "ed8cf17";
+
+ src = fetchFromGitHub {
+ owner = "so-fancy";
+ repo = "diff-so-fancy";
+ rev = "ed8cf1763d38bdd79ceb55a73b9ce7e30f1e184d";
+ sha256 = "176qn0w2rn6mr5ymvkblyiznqq7yyibfsnnjfivcyhz69w6yr9r9";
+ };
+
+ # Perl is needed here for patchShebangs
+ nativeBuildInputs = [ perl makeWrapper ];
+
+ buildPhase = null;
+
+ installPhase = ''
+ mkdir -p $out/bin $out/lib/diff-so-fancy
+
+ # diff-so-fancy executable searches for it's library relative to
+ # itself, so we are copying executable to lib, and only symlink it
+ # from bin/
+ cp diff-so-fancy $out/lib/diff-so-fancy
+ cp -r lib $out/lib/diff-so-fancy
+ ln -s $out/lib/diff-so-fancy/diff-so-fancy $out/bin
+
+ # ncurses is needed for `tput`
+ wrapProgram $out/lib/diff-so-fancy/diff-so-fancy \
+ --prefix PATH : "${git}/share/git/contrib/diff-highlight" \
+ --prefix PATH : "${git}/bin" \
+ --prefix PATH : "${coreutils}/bin" \
+ --prefix PATH : "${ncurses.out}/bin"
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = https://github.com/so-fancy/diff-so-fancy;
+ description = "Good-looking diffs filter for git";
+ license = licenses.mit;
+ platforms = platforms.all;
+ longDescription = ''
+ diff-so-fancy builds on the good-lookin' output of git contrib's
+ diff-highlight to upgrade your diffs' appearances.
+ '';
+ maintainers = with maintainers; [ fpletz ];
+ };
+}
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";
+ };
+}
diff --git a/tv/5pkgs/simple/q/default.nix b/tv/5pkgs/simple/q/default.nix
index 2e7aa5cf2..655c75e1b 100644
--- a/tv/5pkgs/simple/q/default.nix
+++ b/tv/5pkgs/simple/q/default.nix
@@ -262,7 +262,7 @@ let
'';
q-todo = ''
- TODO_file=$HOME/TODO
+ TODO_file=$PWD/TODO
if test -e "$TODO_file"; then
${pkgs.coreutils}/bin/cat "$TODO_file" \
| ${pkgs.gawk}/bin/gawk -v now=$(${pkgs.coreutils}/bin/date +%s) '
@@ -294,13 +294,7 @@ in
pkgs.writeBashBin "q" ''
set -eu
export PATH=/var/empty
- (${q-todo}) || :
- if [ "$PWD" != "$HOME" ]; then
- (HOME=$PWD; ${q-todo}) || :
- fi
- echo
${q-cal}
- echo
${q-isodate}
${q-sgtdate}
(${q-gitdir}) &
@@ -311,4 +305,14 @@ pkgs.writeBashBin "q" ''
(${q-online}) &
(${q-thermal_zone}) &
wait
+ if test "$PWD" != "$HOME" && test -e "$HOME/TODO"; then
+ TODO_home_entries=$(cd; (${q-todo}) | ${pkgs.coreutils}/bin/wc -l)
+ if test "$TODO_home_entries" = 1; then
+ TODO_format='There is %d entry in ~/TODO'
+ else
+ TODO_format='There are %d entries in ~/TODO'
+ fi
+ printf "\x1b[38;5;238m$TODO_format\x1b[m\n" "$TODO_home_entries"
+ fi
+ (${q-todo}) || :
''