From 3d45f25458cf0f64d509bb25fa5634c592399806 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 12 Sep 2017 21:13:37 +0200 Subject: tv charybdis: after network-online.target --- tv/3modules/charybdis/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tv') diff --git a/tv/3modules/charybdis/default.nix b/tv/3modules/charybdis/default.nix index 859dc122..e252f2e1 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"; }; -- cgit v1.2.3 From 388bed48209ad7f5c774ff005afc255c6a71934d Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Sep 2017 09:00:54 +0200 Subject: tv nixpkgs-overlays: init This module allows to have per-system nixpkgs-overlays and is required because at the moment of committing, only xu has an up-to-date stockholm development directory in /home/tv/stockholm. --- tv/1systems/xu/config.nix | 5 +++++ tv/2configs/default.nix | 6 +----- tv/3modules/default.nix | 1 + tv/3modules/nixpkgs-overlays.nix | 23 +++++++++++++++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 tv/3modules/nixpkgs-overlays.nix (limited to 'tv') diff --git a/tv/1systems/xu/config.nix b/tv/1systems/xu/config.nix index 0abd544c..d4a10fe1 100644 --- a/tv/1systems/xu/config.nix +++ b/tv/1systems/xu/config.nix @@ -155,5 +155,10 @@ with import ; # 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/default.nix b/tv/2configs/default.nix index 241a16b2..9ad0253a 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -90,11 +90,7 @@ with import ; 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/default.nix b/tv/3modules/default.nix index 83dc212a..57ffbfab 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 00000000..4eb7a86b --- /dev/null +++ b/tv/3modules/nixpkgs-overlays.nix @@ -0,0 +1,23 @@ +with import ; +{ 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"; + }; + }; +} -- cgit v1.2.3 From 4e2e9a63c4a0c8f191940e06092e5aa2f3822993 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Sep 2017 20:16:52 +0200 Subject: tv mfcl2700dnlpr: init at 3.2.0-1 --- tv/5pkgs/simple/mfcl2700dnlpr/default.nix | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tv/5pkgs/simple/mfcl2700dnlpr/default.nix (limited to 'tv') diff --git a/tv/5pkgs/simple/mfcl2700dnlpr/default.nix b/tv/5pkgs/simple/mfcl2700dnlpr/default.nix new file mode 100644 index 00000000..fc11b53e --- /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"; + }; +} -- cgit v1.2.3 From b2c02a186b0dba18f303c973b238e3b9c2de06b7 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Sep 2017 20:15:26 +0200 Subject: tv mfcl2700dncupswrapper: init at 3.2.0-1 --- tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix (limited to 'tv') diff --git a/tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix b/tv/5pkgs/simple/mfcl2700dncupswrapper/default.nix new file mode 100644 index 00000000..1ef018b3 --- /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"; + }; +} -- cgit v1.2.3 From 755e3a46682b90729be8a82026b08429cd7baea8 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Sep 2017 20:03:12 +0200 Subject: tv br config: init --- tv/2configs/br.nix | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tv/2configs/br.nix (limited to 'tv') diff --git a/tv/2configs/br.nix b/tv/2configs/br.nix new file mode 100644 index 00000000..c7eb20e9 --- /dev/null +++ b/tv/2configs/br.nix @@ -0,0 +1,49 @@ +with import ; +{ config, pkgs, ... }: { + + imports = [ + + ]; + + 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; +} -- cgit v1.2.3 From ed9a1085946589409caba6e18233c329d99c0b4b Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Sep 2017 20:04:22 +0200 Subject: tv xu: import br config --- tv/1systems/xu/config.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'tv') diff --git a/tv/1systems/xu/config.nix b/tv/1systems/xu/config.nix index d4a10fe1..0363c983 100644 --- a/tv/1systems/xu/config.nix +++ b/tv/1systems/xu/config.nix @@ -16,6 +16,7 @@ with import ; + { environment.systemPackages = with pkgs; [ -- cgit v1.2.3 From 516603010dfba3d8e3e1d4f7df210ddb99556dfd Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Sep 2017 22:27:16 +0200 Subject: tv cd: final commit --- tv/1systems/cd/config.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tv') diff --git a/tv/1systems/cd/config.nix b/tv/1systems/cd/config.nix index 341a62e4..e7e2cdc2 100644 --- a/tv/1systems/cd/config.nix +++ b/tv/1systems/cd/config.nix @@ -10,7 +10,8 @@ in { - + # TODO see XXX below + # ]; @@ -33,3 +34,17 @@ in { tcpdump ]; } + +# XXX this should be unnecessary, but when security.wrappers isn't defined, +# then install fails with: +# +# mktemp: failed to create directory via template '/run/wrappers/wrappers.XXXXXXXXXX': No such file or directory +# chmod: missing operand after 'a+rx' +# Try 'chmod --help' for more information. +# ln: failed to create symbolic link './bin': File exists +# cp: cannot create regular file '/run/wrappers/bin/exim': No such file or directory +# chown: cannot access '/run/wrappers/bin/exim': No such file or directory +# chmod: cannot access '/run/wrappers/bin/exim': No such file or directory +# cp: cannot create regular file '/run/wrappers/bin/sendmail': No such file or directory +# chown: cannot access '/run/wrappers/bin/sendmail': No such file or directory +# chmod: cannot access '/run/wrappers/bin/sendmail': No such file or directory -- cgit v1.2.3 From 94c57badae775cb863b76a6c6cb8c11012cd4f83 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Sep 2017 22:28:36 +0200 Subject: tv cd: RIP, thanks for alots of no fish --- tv/1systems/cd/config.nix | 50 ----------------------------------------------- tv/1systems/cd/source.nix | 3 --- 2 files changed, 53 deletions(-) delete mode 100644 tv/1systems/cd/config.nix delete mode 100644 tv/1systems/cd/source.nix (limited to 'tv') diff --git a/tv/1systems/cd/config.nix b/tv/1systems/cd/config.nix deleted file mode 100644 index e7e2cdc2..00000000 --- a/tv/1systems/cd/config.nix +++ /dev/null @@ -1,50 +0,0 @@ -with import ; -{ config, pkgs, ... }: let - - bestGuessGateway = addr: elemAt (match "(.*)(\.[^.])" addr) 0 + ".1"; - -in { - krebs.build.host = config.krebs.hosts.cd; - - imports = [ - - - - # TODO see XXX below - # - - ]; - - 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 - ]; -} - -# XXX this should be unnecessary, but when security.wrappers isn't defined, -# then install fails with: -# -# mktemp: failed to create directory via template '/run/wrappers/wrappers.XXXXXXXXXX': No such file or directory -# chmod: missing operand after 'a+rx' -# Try 'chmod --help' for more information. -# ln: failed to create symbolic link './bin': File exists -# cp: cannot create regular file '/run/wrappers/bin/exim': No such file or directory -# chown: cannot access '/run/wrappers/bin/exim': No such file or directory -# chmod: cannot access '/run/wrappers/bin/exim': No such file or directory -# cp: cannot create regular file '/run/wrappers/bin/sendmail': No such file or directory -# chown: cannot access '/run/wrappers/bin/sendmail': No such file or directory -# chmod: cannot access '/run/wrappers/bin/sendmail': No such file or directory diff --git a/tv/1systems/cd/source.nix b/tv/1systems/cd/source.nix deleted file mode 100644 index 019e8bc2..00000000 --- a/tv/1systems/cd/source.nix +++ /dev/null @@ -1,3 +0,0 @@ -import { - name = "cd"; -} -- cgit v1.2.3 From f4a094d5d431a6f852b71e1c13cb9d8f32fcd590 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 19 Sep 2017 23:18:58 +0200 Subject: tv wu: remove im config --- tv/1systems/wu/config.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'tv') diff --git a/tv/1systems/wu/config.nix b/tv/1systems/wu/config.nix index 79b5aa26..5c593894 100644 --- a/tv/1systems/wu/config.nix +++ b/tv/1systems/wu/config.nix @@ -8,7 +8,6 @@ with import ; - -- cgit v1.2.3 From a038ec100d480cb499366d64562369d3654895f7 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 20 Sep 2017 00:47:37 +0200 Subject: tv diff-so-fancy: init at ed8cf17 Based on nixpkgs 28dd1158ff18def37892677a9eef109ce5147b81 --- tv/5pkgs/default.nix | 4 ++++ tv/5pkgs/simple/diff-so-fancy.nix | 48 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tv/5pkgs/simple/diff-so-fancy.nix (limited to 'tv') diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix index 8a7a613b..1796609a 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 00000000..9ce6d923 --- /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 ]; + }; +} -- cgit v1.2.3 From 6fed88c5611f71726c82af93d0df0ac4112e9814 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 20 Sep 2017 11:58:04 +0200 Subject: tv q: print just no. of entries in ~ if PWD!=HOME --- tv/5pkgs/simple/q/default.nix | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'tv') diff --git a/tv/5pkgs/simple/q/default.nix b/tv/5pkgs/simple/q/default.nix index 2e7aa5cf..655c75e1 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}) || : '' -- cgit v1.2.3 From 82f459f7aeb4bc151a998308046431dd194160f8 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 20 Sep 2017 12:38:03 +0200 Subject: tv backup: RIP cd --- tv/2configs/backup.nix | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'tv') diff --git a/tv/2configs/backup.nix b/tv/2configs/backup.nix index 46e3f70f..f76fb2e0 100644 --- a/tv/2configs/backup.nix +++ b/tv/2configs/backup.nix @@ -52,12 +52,6 @@ with import ; 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 ; 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"; }; -- cgit v1.2.3