summaryrefslogtreecommitdiffstats
path: root/krebs
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 /krebs
parent9d9e9bc3d8087974370e3d62bc05d2332b2efab2 (diff)
parent37951eed3dd7806f73c40c47ec9cd047ad76c15d (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs')
-rw-r--r--krebs/2configs/hw/x220.nix2
-rw-r--r--krebs/3modules/lass/default.nix79
-rw-r--r--krebs/3modules/tv/default.nix46
-rw-r--r--krebs/5pkgs/simple/git-preview/default.nix15
-rw-r--r--krebs/5pkgs/simple/weechat/default.nix80
-rw-r--r--krebs/5pkgs/simple/withGetopt.nix118
6 files changed, 214 insertions, 126 deletions
diff --git a/krebs/2configs/hw/x220.nix b/krebs/2configs/hw/x220.nix
index c85bac0d4..44743b87d 100644
--- a/krebs/2configs/hw/x220.nix
+++ b/krebs/2configs/hw/x220.nix
@@ -8,6 +8,8 @@ with import <stockholm/lib>;
hardware.cpu.intel.updateMicrocode = true;
+ hardware.opengl.enable = true;
+
services.tlp.enable = true;
boot = {
diff --git a/krebs/3modules/lass/default.nix b/krebs/3modules/lass/default.nix
index ce19c0a05..ca3c8b45b 100644
--- a/krebs/3modules/lass/default.nix
+++ b/krebs/3modules/lass/default.nix
@@ -381,6 +381,85 @@ with import <stockholm/lib>;
};
};
};
+ eddie = {
+ ci = false;
+ external = true;
+ nets = {
+ retiolum = {
+ ip4.addr = "10.243.29.170";
+ ip6.addr = "42:4992:6a6d:700::1";
+ aliases = [ "eddie.r" ];
+ tinc.pubkey = ''
+ -----BEGIN RSA PUBLIC KEY-----
+ MIICCgKCAgEAuRQphRlSIC/aqRTfvStPdJOJCx1ACeFIDEjRdgoxuu32qoBl7i6d
+ j7Voh+Msditf2a5+f0fVsNDaPnjPGfk0NkZBjmn+RZQDRXk0krpTNj2Vb6W5quTm
+ 3yrjJMFJR9CU5khfppc47X+ir8bjn7RusWTFNEuDvUswHmRmnJHLS3Y+utOaRbCF
+ 2hxpyxCn423gpsaBfORPEK8X90nPbuNpFDugWPnC+R45TpNmIf4qyKvfhd9OKrua
+ KNanGHG30xhBW/DclUwwWi8D44d94xFnIRVcG1O+Uto93WoUWZn90lI1qywSj5Aq
+ iWstBK4tc7VwvAj0UzPlaRYYPfFjOEkPQzj8xC6l/leJcgxkup252uo6m1njMx3t
+ 6QWMgevjqosY22OZReZfIwb14aDWFKLTWs30J+zmWK4TjlRITdsOEKxlpODMbJAD
+ kfSoPwuwkWIzFhNOrFiD/NtKaRYmV8bTBCT3a9cvvObshJx13BP+IUFzBS1N1n/u
+ hJWYH5WFsQZn/8rHDwZGkS1zKPEaNoydjqCZNyJpJ5nhggyl6gpuD7wpXM/8tFay
+ pAjRP40+qRQLUWXmswV0hsZTOX1tvZs4f68y3WJ+GwCWw9HvvwmzYes5ayJrPsbJ
+ lyK301Jb42wGEsVWxu3Eo/PLtp8OdD+Wdh6o/ELcc0k/YCUGFMujUM8CAwEAAQ==
+ -----END RSA PUBLIC KEY-----
+ '';
+ };
+ };
+ };
+ borg = {
+ ci = false;
+ external = true;
+ nets = {
+ retiolum = {
+ ip4.addr = "10.243.29.171";
+ ip6.addr = "42:4992:6a6d:700::2";
+ aliases = [ "borg.r" ];
+ tinc.pubkey = ''
+ -----BEGIN PUBLIC KEY-----
+ MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0bHZApTM7Hl4qqNakSwq
+ bt7zJoTVK9ePoC3Mue1VmJ1mCKMaxKdzlO31kPeHtkilAzgyIJdgikyKFlApGsQL
+ aIuU9h55X7TbikoDD6ghbSrAe3Pgc+sJ3OZ7wO7Qb8CKgJvEbkk/u68YiJgyTjYD
+ HNjIQzlsGdpoSke9vwC8qWanfgN7c2MMGtakqfXDjYjCgp7O43i+SMupkMSXIXMA
+ 5XUFh/vVp6xgPxBofcw0uQIyZ5v4PPFjnGPm4rnMbFzbhubntHjDadwGd5Niyw4O
+ zNNKNchTLfNiuNGqTZeYd0kJ5fNMKykhpSs+ou34MvexvpuyPlFuotnPXN/nOMml
+ 3nwiqzthzPuBZRLswxT0WvlA8wlbeTOKJ0wTIR4dDuAF+euDtoNocVEN5PJNc7yN
+ fmwAV6geESoJbZQMSCtAp1NioaBlRPp1pFfoM/GotHywuFrTIxyoIBiYhkpWyQvq
+ WYw5j13IKqkL7jDchhoBmcardmh+AP5bL3uQ84BgaYNwFzHp04qIRrrdpF0eMaHB
+ /8zaqsNLn4/zQJB5ffkelwoIqfvLPQeCMLzHGHgP5xUnWgmZZGiiDLvhuaMeNq4U
+ EpCKoTL178sPOgNfHfd8mEqx0qKYuPrNQEdlpa5xOZqwx56pfYpGWY+KtF2FHLhS
+ iO64GCJqCi1MKBYx/NhaxKMCAwEAAQ==
+ -----END PUBLIC KEY-----
+ '';
+ };
+ };
+ };
+ inspector = {
+ ci = false;
+ external = true;
+ nets = {
+ retiolum = {
+ ip4.addr = "10.243.29.172";
+ ip6.addr = "42:4992:6a6d:800::1";
+ aliases = [ "inspector.r" ];
+ tinc.pubkey = ''
+ -----BEGIN RSA PUBLIC KEY-----
+ MIICCgKCAgEAr3l/u7qcxmFa2hUICU3oPDhB2ij2R3lKHyjSsVFVLNfl6TpOdppG
+ EDXOapeXL0s+PfBRHdRI3v/dibj4PG9eyKmFxsUJ2gRz4ghb1UE23aQ3pkr3x8sZ
+ 7GR+nJYATYf+jolFF9O1x+f0Uo5xaYWkGOMH8wVVzm6+kcsZOYuTEbJAsbTRZywF
+ m1MdRfk54hLiDsj2rjGRZIR+ZfUKVs2MTWOLCpBAHLJK+r3HfUiR2nAgeNkJCFLw
+ WIir1ftDIViT3Ly6b7enaOkVZ695FNYdPWFZCE4AJI0s9wsbMClzUqCl+0mUkumd
+ eRXgWXkmvBsxR4GECnxUhxs6U8Wh3kbQavvemt4vcIKNhkw32+toYc1AFK/n4G03
+ OUJBbRqgJYx9wIvo8PEu4DTTdsPlQZnMwiaKsn+Gi4Ap6JAnG/iLN8sChoQf7Dau
+ ARZA3sf9CkKx5sZ+9dVrLbzGynKE18Z/ysvf1BLd/rVVOps1B/YRBxDwPj8MZJ0x
+ B7b0j+hRVV5palp3RRdcExuWaBrMQQGsXwLUZOFHJJaZUHF9XRdy+5XVJdNOArkG
+ q1+yGhosL1DLTQE/VwCxmBHyYTr3L7yZ2lSaeWdIeYvcRvouDROUjREVFrQjdqwj
+ 7vIP1cvDxSSqA07h/xEC4YZKACBYc/PI2mqYK5dvAUG3mGrEsjHktPUCAwEAAQ==
+ -----END RSA PUBLIC KEY-----
+ '';
+ };
+ };
+ };
};
users = {
lass = {
diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix
index 79fa27bad..e80becfa7 100644
--- a/krebs/3modules/tv/default.nix
+++ b/krebs/3modules/tv/default.nix
@@ -32,52 +32,6 @@ with import <stockholm/lib>;
ssh.privkey.path = <secrets/ssh.id_rsa>;
ssh.pubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDP9JS2Nyjx4Pn+/4MrFi1EvBBYVKkGm2Q4lhgaAiSuiGLol53OSsL2KIo01mbcSSBWow9QpQpn8KDoRnT2aMLDrdTFqL20ztDLOXmtrSsz3flgCjmW4f6uOaoZF0RNjAybd1coqwSJ7EINugwoqOsg1zzN2qeIGKYFvqFIKibYFAnQ8hcksmkvPdIO5O8CbdIiP9sZSrSDp0ZyLK2T0PML2jensVZOeqSPulQDFqLsbmavpVLkpDjdzzPRwbZWNB4++YeipbYNOkX4GR1EB4wMZ93IbBV7kpJtib2Zb2AnUf7UW37hxWBjILdstj9ClwNOQggn8kD9ub7YxBzH1dz0Xd8a0mPOAWIDJz9MypXgFRc3vdvPB/W1I4Se0CLbgOkORun9CkgijKr9oEY8JNt8HFd6viZcAaQxOyIm6PNHZTnHfdSc7bIBS2n3e3IZBv0fTd77knGLXg402aTuu2bm/kxsKivxsILXIaGbeXe4ceN3Fynr3FzSM2bUkzHb0mAHu1BQ9YaX0xzCwjVueA5nzGls7ODSFkXsiBfg2FvMN/sTLFca6tnwyqcnD6nujoiS5+BxjDWPgnZYqCaW3B/IkpTsRMsX6QrfhOFcsP8qlJ2Cp82orWoDK/D0vZ9pdzAc6PFGga0RofuJKY2yiq+SRZ7/e9E6VncIVCYZ1OfN0Q==";
};
- cd = {
- ci = true;
- cores = 2;
- extraZones = {
- # TODO generate krebsco.de zone from nets and don't use extraZones at all
- "krebsco.de" = ''
- cd 60 IN A ${config.krebs.hosts.cd.nets.internet.ip4.addr}
- '';
- };
- nets = {
- internet = {
- ip4.addr = "45.62.237.203";
- aliases = [
- "cd.i"
- "cd.krebsco.de"
- ];
- ssh.port = 11423;
- };
- retiolum = {
- via = config.krebs.hosts.cd.nets.internet;
- ip4.addr = "10.243.113.222";
- ip6.addr = "42:4522:25f8:36bb:8ccb:150:231a:2af3";
- aliases = [
- "cd.r"
- "cgit.cd.r"
- ];
- tinc.pubkey = ''
- -----BEGIN RSA PUBLIC KEY-----
- MIICCgKCAgEAvmCBVNKT/Su4v9nl/Nm3STPo5QxWPg7xEkzIs3Oh39BS8+r6/7UQ
- rebib7mczb+ebZd+Rg2yFoGrWO8cmM0VcLy5bYRMK7in8XroLEjWecNNM4TRfNR4
- e53+LhcPdkxo0A3/D+yiut+A2Mkqe+4VXDm/JhAiAYkZTn7jUtj00Atrc7CWW1gN
- sP3jIgv4+CGftdSYOB4dm699B7OD9XDLci2kOaFqFl4cjDYUok03G0AduUlRx10v
- CKbKOTIdm8C36A902/3ms+Hyzkruu+VagGIZuPSwqXHJPCu7Ju+jarKQstMmpQi0
- PubweWDL0o/Dfz2qT3DuL4xDecIvGE6kv3m41hHJYiK+2/azTSehyPFbsVbL7w0V
- LgKN3usnZNcpTsBWxRGT7nMFSnX2FLDu7d9OfCuaXYxHVFLZaNrpccOq8NF/7Hbk
- DDW81W7CvLyJDlp0WLnAawSOGTUTPoYv/2wAapJ89i8QGCueGvEc6o2EcnBVMFEW
- ejWTQzyD816f4RsplnrRqLVlIMbr9Q/n5TvlgjjhX7IMEfMy4+7qLGRQkNbFzgwK
- jxNG2fFSCjOEQitm0gAtx7QRIyvYr6c7/xiHz4AwxYzBmvQsL/OK57NO4+Krwgj5
- Vk8TQ2jGO7J4bB38zaxK+Lrtfl8i1AK1171JqFMhOc34JSJ7T4LWDMECAwEAAQ==
- -----END RSA PUBLIC KEY-----
- '';
- };
- };
- ssh.privkey.path = <secrets/ssh.id_ed25519>;
- ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOd/HqZIO9Trn3eycl23GZAz21HQCISaVNfNyaLSQvJ6";
- };
ju = {
external = true;
nets = {
diff --git a/krebs/5pkgs/simple/git-preview/default.nix b/krebs/5pkgs/simple/git-preview/default.nix
new file mode 100644
index 000000000..f20f2a636
--- /dev/null
+++ b/krebs/5pkgs/simple/git-preview/default.nix
@@ -0,0 +1,15 @@
+{ coreutils, git, stdenv, writeDashBin }:
+
+writeDashBin "git-preview" ''
+ PATH=${stdenv.lib.makeBinPath [
+ coreutils
+ git
+ ]}''${PATH+:$PATH}
+ hashes=$(git log --format=%h "..$1")
+ end=$(echo "$hashes" | head -1)
+ start=$(echo "$hashes" | tail -1)
+ # exit if no diff was found
+ test -z "$start" && exit 0
+ shift
+ git diff "$start^..$end" "$@"
+''
diff --git a/krebs/5pkgs/simple/weechat/default.nix b/krebs/5pkgs/simple/weechat/default.nix
deleted file mode 100644
index c703ca8bf..000000000
--- a/krebs/5pkgs/simple/weechat/default.nix
+++ /dev/null
@@ -1,80 +0,0 @@
-{ stdenv, fetchurl, ncurses, openssl, aspell, gnutls
-, zlib, curl , pkgconfig, libgcrypt
-, cmake, makeWrapper, libiconv
-, asciidoctor # manpages
-, guileSupport ? true, guile
-, luaSupport ? true, lua5
-, perlSupport ? true, perl
-, pythonPackages
-, rubySupport ? true, ruby
-, tclSupport ? true, tcl
-, extraBuildInputs ? [] }:
-
-assert guileSupport -> guile != null;
-assert luaSupport -> lua5 != null;
-assert perlSupport -> perl != null;
-assert rubySupport -> ruby != null;
-assert tclSupport -> tcl != null;
-
-let
- inherit (pythonPackages) python pycrypto pync;
-in
-
-stdenv.mkDerivation rec {
- version = "1.8";
- name = "weechat-${version}";
-
- src = fetchurl {
- url = "http://weechat.org/files/src/weechat-${version}.tar.bz2";
- sha256 = "10km0437lg9ms6f16h20s89l2w9f9g597rykybxb16s95ql48z08";
- };
-
- outputs = [ "out" "doc" ];
-
- enableParallelBuilding = true;
- cmakeFlags = with stdenv.lib; [
- "-DENABLE_MAN=ON"
- "-DENABLE_DOC=ON"
- ]
- ++ optionals stdenv.isDarwin ["-DICONV_LIBRARY=${libiconv}/lib/libiconv.dylib" "-DCMAKE_FIND_FRAMEWORK=LAST"]
- ++ optional (!guileSupport) "-DENABLE_GUILE=OFF"
- ++ optional (!luaSupport) "-DENABLE_LUA=OFF"
- ++ optional (!perlSupport) "-DENABLE_PERL=OFF"
- ++ optional (!rubySupport) "-DENABLE_RUBY=OFF"
- ++ optional (!tclSupport) "-DENABLE_TCL=OFF"
- ;
-
- buildInputs = with stdenv.lib; [
- ncurses python openssl aspell gnutls zlib curl pkgconfig
- libgcrypt pycrypto makeWrapper
- cmake
- asciidoctor
- ]
- ++ optional guileSupport guile
- ++ optional luaSupport lua5
- ++ optional perlSupport perl
- ++ optional rubySupport ruby
- ++ optional tclSupport tcl
- ++ extraBuildInputs;
-
- NIX_CFLAGS_COMPILE = "-I${python}/include/${python.libPrefix}"
- # Fix '_res_9_init: undefined symbol' error
- + (stdenv.lib.optionalString stdenv.isDarwin "-DBIND_8_COMPAT=1 -lresolv");
-
- postInstall = with stdenv.lib; ''
- NIX_PYTHONPATH="$out/lib/${python.libPrefix}/site-packages"
- wrapProgram "$out/bin/weechat" \
- ${optionalString perlSupport "--prefix PATH : ${perl}/bin"} \
- --prefix PATH : ${pythonPackages.python}/bin \
- --prefix PYTHONPATH : "$PYTHONPATH" \
- --prefix PYTHONPATH : "$NIX_PYTHONPATH"
- '';
-
- meta = {
- homepage = http://www.weechat.org/;
- description = "A fast, light and extensible chat client";
- license = stdenv.lib.licenses.gpl3;
- maintainers = with stdenv.lib.maintainers; [ lovek323 garbas the-kenny ];
- platforms = stdenv.lib.platforms.unix;
- };
-}
diff --git a/krebs/5pkgs/simple/withGetopt.nix b/krebs/5pkgs/simple/withGetopt.nix
new file mode 100644
index 000000000..196e6765a
--- /dev/null
+++ b/krebs/5pkgs/simple/withGetopt.nix
@@ -0,0 +1,118 @@
+with import <stockholm/lib>;
+{ utillinux, writeDash }:
+
+opt-spec: cmd-spec: let
+
+ cmd = cmd-spec opts;
+
+ cmd-script =
+ if typeOf cmd == "set"
+ then "exec ${cmd}"
+ else cmd;
+
+ opts = mapAttrs (name: value: value // rec {
+ long = value.long or (replaceStrings ["_"] ["-"] name);
+ ref = value.ref or "\"\$${varname}\"";
+ short = value.short or null;
+ switch = value.switch or false;
+ varname = value.varname or (replaceStrings ["-"] ["_"] name);
+ }) opt-spec;
+
+ # true if b requires a to define its default value
+ opts-before = a: b:
+ test ".*[$]${stringAsChars (c: "[${c}]") a.varname}\\>.*" (b.default or "");
+
+ opts-list = let
+ sort-out = toposort opts-before (attrValues opts);
+ in
+ if sort-out ? result
+ then sort-out.result
+ else throw "toposort output: ${toJSON sort-out}";
+
+ wrapper-name =
+ if typeOf cmd == "set" && cmd ? name
+ then "${cmd.name}-getopt"
+ else "getopt-wrapper";
+
+in writeDash wrapper-name ''
+ set -efu
+
+ wrapper_name=${shell.escape wrapper-name}
+
+ ${concatStringsSep "\n" (mapAttrsToList (name: opt: /* sh */ ''
+ unset ${opt.varname}
+ '') opts)}
+
+ args=$(${utillinux}/bin/getopt \
+ -l ${shell.escape
+ (concatMapStringsSep ","
+ (opt: opt.long + optionalString (!opt.switch) ":")
+ (filter (opt: opt.long != null)
+ (attrValues opts)))} \
+ -n "$wrapper_name" \
+ -o ${shell.escape
+ (concatMapStringsSep ""
+ (opt: opt.short + optionalString (!opt.switch) ":")
+ (filter (opt: opt.short != null)
+ (attrValues opts)))} \
+ -s sh \
+ -- "$@")
+ if \test $? != 0; then exit 1; fi
+ eval set -- "$args"
+
+ while :; do
+ case $1 in
+ ${concatStringsSep "\n" (mapAttrsToList (name: opt: /* sh */ ''
+ (${concatMapStringsSep "|" shell.escape (filter (x: x != "") [
+ (optionalString (opt.long != null) "--${opt.long}")
+ (optionalString (opt.short != null) "-${opt.short}")
+ ])})
+ ${if opt.switch then /* sh */ ''
+ ${opt.varname}=true
+ shift
+ '' else /* sh */ ''
+ ${opt.varname}=$2
+ shift 2
+ ''}
+ ;;
+ '') (filterAttrs
+ (_: opt: opt.long != null || opt.short != null)
+ opts))}
+ --)
+ shift
+ break
+ esac
+ done
+
+ ${concatMapStringsSep "\n"
+ (opt: /* sh */ ''
+ if \test "''${${opt.varname}+1}" != 1; then
+ printf '%s: missing mandatory option '--%s'\n' \
+ "$wrapper_name" \
+ ${shell.escape opt.long}
+ error=1
+ fi
+ '')
+ (filter
+ (x: ! hasAttr "default" x)
+ (attrValues opts))}
+ if test "''${error+1}" = 1; then
+ exit 1
+ fi
+
+ ${concatMapStringsSep "\n"
+ (opt: /* sh */ ''
+ if \test "''${${opt.varname}+1}" != 1; then
+ ${opt.varname}=${opt.default}
+ fi
+ '')
+ (filter
+ (hasAttr "default")
+ opts-list)}
+
+ ${concatStringsSep "\n" (mapAttrsToList (name: opt: /* sh */ ''
+ export ${opt.varname}
+ '') opts)}
+
+ ${cmd-script} "$@"
+''