From b4580347a657de5be97c59e8f8edc6cebde04c26 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 26 Oct 2017 20:41:16 +0200 Subject: ma pkgs.internetarchive: init --- makefu/5pkgs/internetarchive/default.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 makefu/5pkgs/internetarchive/default.nix diff --git a/makefu/5pkgs/internetarchive/default.nix b/makefu/5pkgs/internetarchive/default.nix new file mode 100644 index 000000000..b661aeeed --- /dev/null +++ b/makefu/5pkgs/internetarchive/default.nix @@ -0,0 +1,32 @@ +{ pkgs, fetchFromGitHub, ... }: +with pkgs.python3Packages; +buildPythonPackage rec { + pname = "internetarchive"; + version = "1.7.3"; + name = "${pname}-${version}"; + propagatedBuildInputs = [ + requests + jsonpatch + docopt + clint + six + schema + backports_csv + ]; + + # check only works when cloned from git repo + doCheck = false; + checkInputs = [ + pytest + responses + ]; + + prePatch = '' + sed -i "s/'schema.*'/'schema>=0.4.0'/" setup.py + ''; + + src = fetchPypi { + inherit pname version; + sha256 = "0x3saklabdx7qrr11h5bjfd75hfbih7pw5gvl2784zvvvrqrz45g"; + }; +} -- cgit v1.2.3 From 346ba71f9c7e170583e8f3aa10575d1b260b2b3d Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 27 Oct 2017 10:32:42 +0200 Subject: ma pkgs.slog: init --- makefu/5pkgs/slog/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 makefu/5pkgs/slog/default.nix diff --git a/makefu/5pkgs/slog/default.nix b/makefu/5pkgs/slog/default.nix new file mode 100644 index 000000000..a4dc33d28 --- /dev/null +++ b/makefu/5pkgs/slog/default.nix @@ -0,0 +1,20 @@ +{ pkgs, stdenv, fetchFromGitHub }: + +## Posix shell logging, use with: +# . $(command -v slog.sh) +stdenv.mkDerivation rec { + name = "slog-${version}"; + version = "2017-10-27"; + + src = fetchFromGitHub { + owner = "makefu"; + repo = "slog"; + rev = "50367c3"; + sha256 = "16wlh8xz430101lrxmgl2wangbbhvyj4pg8k5aibnh76sgj6x77r"; + }; + + installPhase = '' + mkdir -p $out/bin + install -m755 slog.sh $out/bin + ''; +} -- cgit v1.2.3 From 2e39f7b3d1805346e067bdc7236bd7dfe87381a2 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 27 Oct 2017 11:07:19 +0200 Subject: mv makefu/{slog,internetarchive} krebs/ --- krebs/5pkgs/simple/internetarchive/default.nix | 38 ++++++++++++++++++++++++++ krebs/5pkgs/simple/slog/default.nix | 26 ++++++++++++++++++ makefu/5pkgs/internetarchive/default.nix | 32 ---------------------- makefu/5pkgs/slog/default.nix | 20 -------------- 4 files changed, 64 insertions(+), 52 deletions(-) create mode 100644 krebs/5pkgs/simple/internetarchive/default.nix create mode 100644 krebs/5pkgs/simple/slog/default.nix delete mode 100644 makefu/5pkgs/internetarchive/default.nix delete mode 100644 makefu/5pkgs/slog/default.nix diff --git a/krebs/5pkgs/simple/internetarchive/default.nix b/krebs/5pkgs/simple/internetarchive/default.nix new file mode 100644 index 000000000..f5e1bbff3 --- /dev/null +++ b/krebs/5pkgs/simple/internetarchive/default.nix @@ -0,0 +1,38 @@ +{ pkgs, fetchFromGitHub, ... }: +with pkgs.python3Packages; +buildPythonPackage rec { + pname = "internetarchive"; + version = "1.7.3"; + name = "${pname}-${version}"; + propagatedBuildInputs = [ + requests + jsonpatch + docopt + clint + six + schema + backports_csv + ]; + +# check only works when cloned from git repo + doCheck = false; + checkInputs = [ + pytest + responses + ]; + + prePatch = '' + sed -i "s/'schema.*'/'schema>=0.4.0'/" setup.py + ''; + + src = fetchPypi { + inherit pname version; + sha256 = "0x3saklabdx7qrr11h5bjfd75hfbih7pw5gvl2784zvvvrqrz45g"; + }; + + meta = with stdenv.lib; { + description = "python library and cli for uploading files to internet archive"; + license = licenses.agpl3; + }; + +} diff --git a/krebs/5pkgs/simple/slog/default.nix b/krebs/5pkgs/simple/slog/default.nix new file mode 100644 index 000000000..c74a2ad80 --- /dev/null +++ b/krebs/5pkgs/simple/slog/default.nix @@ -0,0 +1,26 @@ +{ pkgs, stdenv, fetchFromGitHub }: + +## use with: +# . $(command -v slog.sh) +stdenv.mkDerivation rec { + name = "slog-${version}"; + version = "2017-10-27"; + + src = fetchFromGitHub { + owner = "makefu"; + repo = "slog"; + rev = "50367c3"; + sha256 = "16wlh8xz430101lrxmgl2wangbbhvyj4pg8k5aibnh76sgj6x77r"; + }; + + installPhase = '' + mkdir -p $out/bin + install -m755 slog.sh $out/bin + ''; + + meta = with stdenv.lib; { + description = "POSIX shell logging"; + license = licenses.mit; + }; + +} diff --git a/makefu/5pkgs/internetarchive/default.nix b/makefu/5pkgs/internetarchive/default.nix deleted file mode 100644 index b661aeeed..000000000 --- a/makefu/5pkgs/internetarchive/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ pkgs, fetchFromGitHub, ... }: -with pkgs.python3Packages; -buildPythonPackage rec { - pname = "internetarchive"; - version = "1.7.3"; - name = "${pname}-${version}"; - propagatedBuildInputs = [ - requests - jsonpatch - docopt - clint - six - schema - backports_csv - ]; - - # check only works when cloned from git repo - doCheck = false; - checkInputs = [ - pytest - responses - ]; - - prePatch = '' - sed -i "s/'schema.*'/'schema>=0.4.0'/" setup.py - ''; - - src = fetchPypi { - inherit pname version; - sha256 = "0x3saklabdx7qrr11h5bjfd75hfbih7pw5gvl2784zvvvrqrz45g"; - }; -} diff --git a/makefu/5pkgs/slog/default.nix b/makefu/5pkgs/slog/default.nix deleted file mode 100644 index a4dc33d28..000000000 --- a/makefu/5pkgs/slog/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ pkgs, stdenv, fetchFromGitHub }: - -## Posix shell logging, use with: -# . $(command -v slog.sh) -stdenv.mkDerivation rec { - name = "slog-${version}"; - version = "2017-10-27"; - - src = fetchFromGitHub { - owner = "makefu"; - repo = "slog"; - rev = "50367c3"; - sha256 = "16wlh8xz430101lrxmgl2wangbbhvyj4pg8k5aibnh76sgj6x77r"; - }; - - installPhase = '' - mkdir -p $out/bin - install -m755 slog.sh $out/bin - ''; -} -- cgit v1.2.3 From 0ed8f933f6baf26e43e632ada61ec4367d956033 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 2 Nov 2017 14:26:50 +0100 Subject: wolf.r: add extra mibs for telegraf --- krebs/1systems/wolf/config.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/krebs/1systems/wolf/config.nix b/krebs/1systems/wolf/config.nix index 21ae20ea0..4d0c0ffa5 100644 --- a/krebs/1systems/wolf/config.nix +++ b/krebs/1systems/wolf/config.nix @@ -26,9 +26,13 @@ in { systemd.services.telegraf.path = [ pkgs.net_snmp ]; # for snmptranslate - #systemd.services.telegraf.environment = { - # "MIBDIRS" : ""; # extra mibs like ADSL - #}; + systemd.services.telegraf.environment = { + MIBDIRS = pkgs.fetchgit { + url = "http://git.shackspace.de/makefu/modem-mibs.git"; + sha256 = + "a4244aa43ddd6e3ef9e64bb80f4ee952f68232aa008d3da9c78e3b627e5675c8"; + }; # extra mibs like ADSL + }; services.telegraf = { enable = true; extraConfig = { -- cgit v1.2.3 From 0f2fe8b6f5306976da3f230ea350f2f6596fe3f5 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 2 Nov 2017 14:27:23 +0100 Subject: ma: update gum ip --- krebs/3modules/makefu/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix index 401cba97a..acd4184c0 100644 --- a/krebs/3modules/makefu/default.nix +++ b/krebs/3modules/makefu/default.nix @@ -545,8 +545,8 @@ with import ; }; nets = rec { internet = { - ip4.addr = "188.68.40.19"; - ip6.addr = "2a03:4000:17:2df::1"; + ip4.addr = "185.194.143.140"; + ip6.addr = "2a03:4000:1c:43f::1"; aliases = [ "gum.i" ]; -- cgit v1.2.3 From 7c146a105a81bb543c68445b98d746c628d62eed Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 2 Nov 2017 14:27:55 +0100 Subject: ma gum.r: update hw specifics --- makefu/1systems/gum/config.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix index e769b1e22..667804bf0 100644 --- a/makefu/1systems/gum/config.nix +++ b/makefu/1systems/gum/config.nix @@ -2,16 +2,22 @@ with import ; let - external-mac = "3a:66:48:8e:82:b2"; + # hw-specific + external-mac = "2a:c5:6e:d2:fc:7f"; + main-disk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0"; + external-gw = "185.194.140.1"; + # single partition, label "nixos" + # cd /var/src; curl https://github.com/nixos/nixpkgs/tarball/809cf38 -L | tar zx ; mv * nixpkgs && touch .populate + + + # static external-ip = config.krebs.build.host.nets.internet.ip4.addr; external-ip6 = config.krebs.build.host.nets.internet.ip6.addr; - external-gw = "188.68.40.1"; external-gw6 = "fe80::1"; external-netmask = 22; external-netmask6 = 64; - ext-if = "et0"; # gets renamed on the fly internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr; - main-disk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-0"; + ext-if = "et0"; # gets renamed on the fly in { imports = [ @@ -19,6 +25,7 @@ in { # + # -- cgit v1.2.3 From 0c4460731a457c03a1716a74c57cdcf54df5c99b Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 2 Nov 2017 14:29:11 +0100 Subject: ma pkgs.pwqgen-ger: add archive.org mirror --- makefu/5pkgs/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/makefu/5pkgs/default.nix b/makefu/5pkgs/default.nix index e99aa696b..80a453ddc 100644 --- a/makefu/5pkgs/default.nix +++ b/makefu/5pkgs/default.nix @@ -31,7 +31,10 @@ in { }); pwqgen-ger = callPackage { wordset-file = super.pkgs.fetchurl { - url = https://gist.githubusercontent.com/makefu/b56f5554c9ef03fe6e09878962e6fd8d/raw/1f147efec51325bc9f80c823bad8381d5b7252f6/wordset_4k.c ; + urls = [ + https://gist.githubusercontent.com/makefu/b56f5554c9ef03fe6e09878962e6fd8d/raw/1f147efec51325bc9f80c823bad8381d5b7252f6/wordset_4k.c + https://archive.org/download/nixos-stockholm-tarballs/pviar5j1gxiqcf3l34b4n2pil06xc8zf-wordset_4k.c + ]; sha256 = "18ddzyh11bywrhzdkzvrl7nvgp5gdb4k1s0zxbz2bkhd14vi72bb"; }; }; -- cgit v1.2.3 From 4f94853b616dce3410a7b28d37757c659deb50a6 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 2 Nov 2017 14:29:31 +0100 Subject: ma source: bump to 2017-11-02 --- makefu/source.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/makefu/source.nix b/makefu/source.nix index 8c880a8e2..0e5bd1a93 100644 --- a/makefu/source.nix +++ b/makefu/source.nix @@ -11,9 +11,8 @@ let then "buildbot" else "makefu"; _file = + "/makefu/1systems/${name}/source.nix"; - ref = "809cf38"; # unstable @ 2017-10-07 + ref = "e4d07bd"; # unstable @ 2017-11-02 # + ruby stuff (2f0b17e4be9,55a952be5b5) - # + mitmproxy fix (360a5efd,ef52c95b) in evalSource (toString _file) [ -- cgit v1.2.3 From c25ece931d4b9e0f76330563345b9a54965363c7 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 2 Nov 2017 16:28:25 +0100 Subject: rtorrent module: replace legacy commands --- krebs/3modules/rtorrent.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/krebs/3modules/rtorrent.nix b/krebs/3modules/rtorrent.nix index 472accef9..b7ef824b5 100644 --- a/krebs/3modules/rtorrent.nix +++ b/krebs/3modules/rtorrent.nix @@ -38,12 +38,12 @@ let ${optionalString (cfg.enableXMLRPC ) '' # prepare socket and set permissions. rtorrent user is part of group nginx # TODO: configure a shared torrent group - execute_nothrow = rm,${cfg.xmlrpc-socket} + execute.nothrow = rm,${cfg.xmlrpc-socket} scgi_local = ${cfg.xmlrpc-socket} schedule = scgi_permission,0,0,"execute.nothrow=chmod,\"ug+w,o=\",${cfg.xmlrpc-socket}" ''} - system.file_allocate.set = ${if cfg.preAllocate then "yes" else "no"} + system.file.allocate.set = ${if cfg.preAllocate then "yes" else "no"} # Prepare systemd logging log.open_file = "rtorrent-systemd", ${systemd-logfile} -- cgit v1.2.3 From 24ef0f56ba48da109b7288e37304958b0320dc0e Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Nov 2017 21:12:27 +0100 Subject: tv querel: init --- krebs/3modules/tv/default.nix | 32 +++++++++++++++ tv/1systems/querel/config.nix | 95 +++++++++++++++++++++++++++++++++++++++++++ tv/1systems/querel/source.nix | 3 ++ 3 files changed, 130 insertions(+) create mode 100644 tv/1systems/querel/config.nix create mode 100644 tv/1systems/querel/source.nix diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix index e80becfa7..98145274c 100644 --- a/krebs/3modules/tv/default.nix +++ b/krebs/3modules/tv/default.nix @@ -254,6 +254,36 @@ with import ; ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIcJvu8JDVzObLUtlAQg9qVugthKSfitwCljuJ5liyHa"; }; + querel = { + ci = true; + cores = 2; + nets = { + retiolum = { + ip4.addr = "10.243.22.22"; + ip6.addr = "42::2222"; + aliases = [ + "querel.r" + ]; + tinc.pubkey = '' + -----BEGIN RSA PUBLIC KEY----- + MIICCgKCAgEArv9eB8acpUhJwRaLY9kGeM7DEPvInVvoduEbec10p4Y2PFx2MjSz + 2OhyxFRkONC4EMV9oVTKD+NRtpbRGZGLYD8ZPB622SvccgB0XnL6ZZfie1feSgrn + bPyVnX8EnEgtx9IQckHyaxWgtyrluJnY2CbLkCYgD+50KFT12rdHyAa3+QoYU65x + ACQo28i9xIpsl6dm7iWBb+ecHc7fST35OqWywtVxSpHPe1nvwaYm1p3rqqtkCGVh + iXE5ruAscri7Dskc5dGR1p7LquhBaebuylH6sfRKA6kre05+/IkXi+JLeAmAtJ+W + xezYlecEvxhguql9ZmSYAYkR4KknZb56KtvCnm29o0evvEpsaYcbtgq1D0JhoGyk + 4DixS5e+5dg470icVKxPfz1AzejxrTUTtMlI28qjAIx1FcmCBGM+T6yHs/MhNGbf + aqUmN+FwtsJ2QWFYqu9zjxxyAfrAw+gqHm0LnsKK1ttwF/2fYCTRLowY+ItB3axs + UVq7DQxyunyYalKGX2RSJ5BHczREHrfgX43HCSlcAuMuow9jHLOjzul0A49rSZ9E + vOPqbjrki0KEEQj0HN3Ax4UVqZ6mPWaTQzuup+bPQ/2Sjkx6COzMSAPmKo4l6DkA + J++ZonpnOCUkwCeCU6qJgMuHeXn0uh117Ypj/3J9eKYMO/RTSs3x8l0CAwEAAQ== + -----END RSA PUBLIC KEY----- + ''; + }; + }; + ssh.privkey.path = ; + ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPFM2GdL9yOjSBmYBE07ClywNOADc/zxqXwZuWd7Mael root@querel.r"; + }; xu = { binary-cache = { pubkey = "xu-1:pYRENvaxZqGeImwLA9qHmRwHV4jfKaYx4u1VcZ31x0s="; @@ -339,6 +369,8 @@ with import ; dv = { mail = "dv@alnus.r"; }; + itak = { + }; mv-ni = { mail = "mv@ni.r"; pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGer9e2+Lew7vnisgBbsFNECEIkpNJgEaqQqgb9inWkQ mv@vod"; diff --git a/tv/1systems/querel/config.nix b/tv/1systems/querel/config.nix new file mode 100644 index 000000000..b564383d7 --- /dev/null +++ b/tv/1systems/querel/config.nix @@ -0,0 +1,95 @@ +with import ; +{ config, pkgs, ... }: { + + imports = [ + + + + + ]; + + krebs.build.host = config.krebs.hosts.querel; + krebs.build.user = mkForce config.krebs.users.itak; + + boot.initrd.availableKernelModules = [ "ahci" ]; + boot.initrd.luks = { + cryptoModules = [ "aes" "sha512" "xts" ]; + devices.querel-luks1 = { + allowDiscards = true; + device = "/dev/sda2"; + }; + }; + boot.kernelModules = [ "kvm-intel" ]; + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + }; + + environment.systemPackages = with pkgs; [ + firefoxWrapper + gimp + kate + libreoffice + (pkgs.pidgin-with-plugins.override { + plugins = [ pkgs.pidginotr ]; + }) + sxiv + texlive.combined.scheme-full + vim + zathura + ]; + + fileSystems = { + "/" = { + device = "/dev/mapper/querel-root"; + fsType = "ext4"; + options = [ "defaults" "discard" ]; + }; + "/home" = { + device = "/dev/mapper/querel-home"; + fsType = "ext4"; + options = [ "defaults" "discard" ]; + }; + "/boot" = { + device = "/dev/sda1"; + }; + }; + + hardware.enableRedistributableFirmware = true; + hardware.pulseaudio.enable = true; + + i18n.defaultLocale = "de_DE.UTF-8"; + + networking.networkmanager.enable = true; + + programs.ssh.startAgent = false; + + services.printing = { + enable = true; + }; + + services.xserver.enable = true; + services.xserver.layout = "de"; + services.xserver.xkbOptions = "eurosign:e"; + + services.xserver.synaptics = { + enable = true; + twoFingerScroll = true; + }; + + services.xserver.desktopManager.plasma5.enable = true; + services.xserver.displayManager.auto = { + enable = true; + user = "itak"; + }; + + users.users.itak = { + inherit (config.krebs.users.itak) home uid; + isNormalUser = true; + extraGroups = [ + "audio" + "video" + "networkmanager" + ]; + }; +} diff --git a/tv/1systems/querel/source.nix b/tv/1systems/querel/source.nix new file mode 100644 index 000000000..74eab51e4 --- /dev/null +++ b/tv/1systems/querel/source.nix @@ -0,0 +1,3 @@ +import { + name = "querel"; +} -- cgit v1.2.3 From 1345bb04719e5cb36ea999798b62507759a139db Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Nov 2017 21:13:00 +0100 Subject: tv: use pidgin-with-plugins.override --- tv/1systems/alnus/config.nix | 5 +++-- tv/1systems/mu/config.nix | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tv/1systems/alnus/config.nix b/tv/1systems/alnus/config.nix index 71302d594..001ad0bc4 100644 --- a/tv/1systems/alnus/config.nix +++ b/tv/1systems/alnus/config.nix @@ -26,8 +26,9 @@ with import ; chromium firefoxWrapper networkmanagerapplet - pidginotr - pidgin-with-plugins + (pkgs.pidgin-with-plugins.override { + plugins = [ pkgs.pidginotr ]; + }) ]; fileSystems = { diff --git a/tv/1systems/mu/config.nix b/tv/1systems/mu/config.nix index 10d7b2197..6c22971bf 100644 --- a/tv/1systems/mu/config.nix +++ b/tv/1systems/mu/config.nix @@ -57,8 +57,9 @@ with import ; gimp iptables libreoffice - pidginotr - pidgin-with-plugins + (pkgs.pidgin-with-plugins.override { + plugins = [ pkgs.pidginotr ]; + }) skype slock tinc_pre -- cgit v1.2.3 From 861e3dc215a5b15f4362902fab76ab6787ff7064 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Nov 2017 21:14:21 +0100 Subject: tv: use git-preview --- tv/2configs/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index f418b9ff0..a8ab538cc 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -142,6 +142,7 @@ with import ; environment.systemPackages = [ pkgs.get pkgs.git + pkgs.git-preview pkgs.hashPassword pkgs.htop pkgs.kpaste -- cgit v1.2.3 From ab98a1be65369ae3c06de8f6219275e882f08fa7 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Nov 2017 21:43:32 +0100 Subject: tv: RIP wvdial --- tv/5pkgs/default.nix | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix index 261871e62..82474ade5 100644 --- a/tv/5pkgs/default.nix +++ b/tv/5pkgs/default.nix @@ -33,13 +33,4 @@ foldl' mergeAttrs {} ''; gnupg = self.gnupg22; - - # https://github.com/NixOS/nixpkgs/issues/16113 - wvdial = let - nixpkgs-1509 = import (self.fetchFromGitHub { - owner = "NixOS"; repo = "nixpkgs-channels"; - rev = "91371c2bb6e20fc0df7a812332d99c38b21a2bda"; - sha256 = "1as1i0j9d2n3iap9b471y4x01561r2s3vmjc5281qinirlr4al73"; - }) {}; - in nixpkgs-1509.wvdial; } -- cgit v1.2.3 From b5c3361aefe16cdf632c87353927470c982e47e7 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 3 Nov 2017 08:28:53 +0100 Subject: ma source: add nixpkgs cherry-picked fixes --- makefu/source.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/makefu/source.nix b/makefu/source.nix index 0e5bd1a93..9efdadf09 100644 --- a/makefu/source.nix +++ b/makefu/source.nix @@ -11,8 +11,11 @@ let then "buildbot" else "makefu"; _file = + "/makefu/1systems/${name}/source.nix"; - ref = "e4d07bd"; # unstable @ 2017-11-02 - # + ruby stuff (2f0b17e4be9,55a952be5b5) + ref = "a0f7ced"; # unstable @ 2017-11-02 + # + ruby stuff: 2f0b17e4be9 55a952be5b5 + # + jsbeautifier: c60bee3 + # + mitmproxy fix: a0f7cedfae31 + # + synergy fix: 5e6c76bc1 in evalSource (toString _file) [ -- cgit v1.2.3 From 886bd92d8b7620454ab2e701e1c1c1d20cf73b6d Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 3 Nov 2017 09:11:36 +0100 Subject: ma source: add snapraid fix --- makefu/source.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/makefu/source.nix b/makefu/source.nix index 9efdadf09..992e4070b 100644 --- a/makefu/source.nix +++ b/makefu/source.nix @@ -11,11 +11,12 @@ let then "buildbot" else "makefu"; _file = + "/makefu/1systems/${name}/source.nix"; - ref = "a0f7ced"; # unstable @ 2017-11-02 + ref = "e3d14bb"; # unstable @ 2017-11-02 # + ruby stuff: 2f0b17e4be9 55a952be5b5 # + jsbeautifier: c60bee3 # + mitmproxy fix: a0f7cedfae31 # + synergy fix: 5e6c76bc1 + # + snapraid fix: e3d14bb1 in evalSource (toString _file) [ -- cgit v1.2.3 From 6cff70a8a56bba51d0c1ae718107e04c0df36fbc Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 3 Nov 2017 13:26:32 +0100 Subject: ma pkgs.u3-tool: now in upstream --- makefu/5pkgs/u3_tool/default.nix | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 makefu/5pkgs/u3_tool/default.nix diff --git a/makefu/5pkgs/u3_tool/default.nix b/makefu/5pkgs/u3_tool/default.nix deleted file mode 100644 index e8c5573a8..000000000 --- a/makefu/5pkgs/u3_tool/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ stdenv, fetchurl }: - -stdenv.mkDerivation rec { - proj = "u3-tool"; - name = "${proj}-${version}"; - version = "0.3"; - - enableParallelBuilding = true; - - src = fetchurl { - url = "mirror://sourceforge/${proj}/${name}.tar.gz"; - sha256 = "1p9c9kibd1pdbdfa0nd0i3n7bvzi3xg0chm38jg3xfl8gsn0390f"; - }; - - meta = { - description = "Tool for controlling the special features of a 'U3 smart drive' USB Flash disk."; - homepage = https://sourceforge.net/projects/u3-tool/ ; - license = stdenv.lib.licenses.gpl2; - platforms = stdenv.lib.platforms.linux; - maintainers = with stdenv.lib.maintainers; [ makefu ]; - }; -} -- cgit v1.2.3 From 8574f0f177c004031a4282d121931caab62158ad Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 3 Nov 2017 13:29:14 +0100 Subject: ma lancache-dns: add storage server names --- makefu/2configs/lanparty/lancache-dns.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/makefu/2configs/lanparty/lancache-dns.nix b/makefu/2configs/lanparty/lancache-dns.nix index 4b4ebf0a0..f03fe8773 100644 --- a/makefu/2configs/lanparty/lancache-dns.nix +++ b/makefu/2configs/lanparty/lancache-dns.nix @@ -21,6 +21,13 @@ let stateDir = "/var/lib/unbound"; user = "unbound"; upstream-server = "8.8.8.8"; + local_ip = "192.168.1.10"; + extra-config = pkgs.writeText "local.conf" '' + server: + local-data: "piratebox. A ${local-ip}" + local-data: "store. A ${local-ip}" + local-data: "share. A ${local-ip}" + ''; in { services.unbound = { enable = true; @@ -29,6 +36,7 @@ in { forwardAddresses = [ upstream-server ]; extraConfig = '' include: "${stateDir}/lancache/*.conf" + include: "${extra-config}" ''; }; services.dnscrypt-proxy.enable = lib.mkForce false; @@ -42,7 +50,8 @@ in { path = [ pkgs.gawk pkgs.iproute pkgs.gnused ]; script = '' set -xeu - current_ip=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') + # current_ip=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') + current_ip=${local_ip} old_ip=10.1.1.250 mkdir -p ${stateDir} rm -rvf ${stateDir}/lancache -- cgit v1.2.3 From a98010b11c68863feaa6ff30943ef21d39a59980 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 3 Nov 2017 14:46:31 +0100 Subject: ma lancache-dns: fix local-ip variable --- makefu/2configs/lanparty/lancache-dns.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/makefu/2configs/lanparty/lancache-dns.nix b/makefu/2configs/lanparty/lancache-dns.nix index f03fe8773..5d90d1a99 100644 --- a/makefu/2configs/lanparty/lancache-dns.nix +++ b/makefu/2configs/lanparty/lancache-dns.nix @@ -24,9 +24,9 @@ let local_ip = "192.168.1.10"; extra-config = pkgs.writeText "local.conf" '' server: - local-data: "piratebox. A ${local-ip}" - local-data: "store. A ${local-ip}" - local-data: "share. A ${local-ip}" + local-data: "piratebox. A ${local_ip}" + local-data: "store. A ${local_ip}" + local-data: "share. A ${local_ip}" ''; in { services.unbound = { -- cgit v1.2.3 From 328f9ffdac31e164ca34cadb5db3065ba0456686 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 3 Nov 2017 14:46:54 +0100 Subject: ma lanparty/samba: add new writeable share --- makefu/2configs/lanparty/samba.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/makefu/2configs/lanparty/samba.nix b/makefu/2configs/lanparty/samba.nix index de834ab16..32a656ad7 100644 --- a/makefu/2configs/lanparty/samba.nix +++ b/makefu/2configs/lanparty/samba.nix @@ -10,9 +10,16 @@ }; services.samba = { enable = true; + enableNmbd = true; shares = { - share-home = { + lanparty = { path = "/data/lanparty/"; + "read only" = "yes"; + browseable = "yes"; + "guest ok" = "yes"; + }; + share = { + path = "/data/lanparty/share"; "read only" = "no"; browseable = "yes"; "guest ok" = "yes"; -- cgit v1.2.3 From 5a25b91d1d0b2380371ead7fee04e33bfa0814af Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:47:36 +0100 Subject: ma tools: add lsof --- makefu/2configs/tools/core.nix | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/makefu/2configs/tools/core.nix b/makefu/2configs/tools/core.nix index 8a15ae2e7..eced961be 100644 --- a/makefu/2configs/tools/core.nix +++ b/makefu/2configs/tools/core.nix @@ -5,38 +5,43 @@ # # essentially `nix-env -q` of the main user { - krebs.per-user.makefu.packages = with pkgs; [ + environment.systemPackages = with pkgs; [ at_spi2_core acpi bc rsync exif file + lsof + which + # fs - ntfs3g + cifs-utils dosfstools + ntfs3g + smartmontools + + # io pv sshpass usbutils p7zip hdparm + + # net + wget + curl inetutils ncftp - mutt tcpdump sysstat - which - weechat wol - tmux iftop + mkpasswd - # storage - smartmontools - cifs-utils - # net - wget - curl + mutt + weechat + tmux # stockholm git -- cgit v1.2.3 From 9f8aa6abaedf8cbf3ce40548b1e52ac45c469c38 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:48:14 +0100 Subject: ma lancache-dns: refactor --- makefu/2configs/lanparty/lancache-dns.nix | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/makefu/2configs/lanparty/lancache-dns.nix b/makefu/2configs/lanparty/lancache-dns.nix index 5d90d1a99..498162d13 100644 --- a/makefu/2configs/lanparty/lancache-dns.nix +++ b/makefu/2configs/lanparty/lancache-dns.nix @@ -1,6 +1,17 @@ { pkgs, lib, config, ... }: with import ; let + upstream-server = "8.8.8.8"; + local_ip = "192.168.10.10"; + + extra-config = pkgs.writeText "local.conf" '' + server: + local-data: "piratebox. A ${local_ip}" + local-data: "store. A ${local_ip}" + local-data: "share. A ${local_ip}" + ''; + + # see https://github.com/zeropingheroes/lancache for full docs lancache-dns = pkgs.stdenv.mkDerivation rec { name = "lancache-dns-2017-06-28"; @@ -11,8 +22,9 @@ let rev = "420aa62"; sha256 = "0ik7by7ripdv2avyy5kk9jp1i7rz9ksc8xmg7n9iik365q9pv94m"; }; + phases = [ "unpackPhase" "installPhase" ]; - # here we can chance to edit `includes/proxy-cache-paths.conf` + # here we have the chance to edit `includes/proxy-cache-paths.conf` installPhase = '' mkdir -p $out cp -r * $out/ @@ -20,14 +32,6 @@ let }; stateDir = "/var/lib/unbound"; user = "unbound"; - upstream-server = "8.8.8.8"; - local_ip = "192.168.1.10"; - extra-config = pkgs.writeText "local.conf" '' - server: - local-data: "piratebox. A ${local_ip}" - local-data: "store. A ${local_ip}" - local-data: "share. A ${local_ip}" - ''; in { services.unbound = { enable = true; -- cgit v1.2.3 From 7184c979931af91187617d5b7d7c513e892b17a4 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:48:31 +0100 Subject: ma lancache: make statedir a variable --- makefu/2configs/lanparty/lancache.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/makefu/2configs/lanparty/lancache.nix b/makefu/2configs/lanparty/lancache.nix index 3df2e3f59..bcacf2e15 100644 --- a/makefu/2configs/lanparty/lancache.nix +++ b/makefu/2configs/lanparty/lancache.nix @@ -17,15 +17,21 @@ let installPhase = '' mkdir -p $out cp -r * $out/ + rm $out/caches-enabled/* sed -i -e 's/^\(user\).*/\1 ${cfg.user} ${cfg.group};/' \ -e '1 idaemon off;' \ + -e 's#/var/lancache#${cfg.statedir}#g' \ $out/nginx.conf + sed -i -e 's#/var/lancache#${cfg.statedir}#g' \ + $out/*/*.conf + ln -s $out/caches-available/* $out/caches-enabled/ ''; }; cfg = { + statedir = "/data/cache"; + group = "nginx-lancache"; user = "nginx-lancache"; - statedir = "/var/lancache"; package = pkgs.stdenv.lib.overrideDerivation pkgs.nginx (old:{ configureFlags = old.configureFlags ++ [ "--with-http_slice_module" @@ -43,6 +49,7 @@ in { preStart = '' mkdir -p ${cfg.statedir} && cd ${cfg.statedir} + chmod 700 ${cfg.statedir} PATH_CACHE=$PATH_BASE/cache PATH_LOGS=$PATH_BASE/logs -- cgit v1.2.3 From c8ab30951e9780a2bfd10bcb987c46e95d6b93a0 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:49:11 +0100 Subject: ma lanparty/samba: update path --- makefu/2configs/lanparty/samba.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefu/2configs/lanparty/samba.nix b/makefu/2configs/lanparty/samba.nix index 32a656ad7..4176d7b35 100644 --- a/makefu/2configs/lanparty/samba.nix +++ b/makefu/2configs/lanparty/samba.nix @@ -19,7 +19,7 @@ "guest ok" = "yes"; }; share = { - path = "/data/lanparty/share"; + path = "/data/incoming"; "read only" = "no"; browseable = "yes"; "guest ok" = "yes"; -- cgit v1.2.3 From a55be6a344f000aaa86eec32dc84be6c4ab32708 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:49:33 +0100 Subject: ma tools: use upstream u3-tool --- makefu/2configs/tools/sec.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefu/2configs/tools/sec.nix b/makefu/2configs/tools/sec.nix index 817cd9ead..3dc02937d 100644 --- a/makefu/2configs/tools/sec.nix +++ b/makefu/2configs/tools/sec.nix @@ -13,6 +13,6 @@ thc-hydra borgbackup ledger - u3_tool + u3-tool ]; } -- cgit v1.2.3 From 4fa4ee36ee5b9d3d15aa826007dd648e7cd5860e Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:49:47 +0100 Subject: ma lanparty: add mumble-server --- makefu/2configs/lanparty/mumble-server.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 makefu/2configs/lanparty/mumble-server.nix diff --git a/makefu/2configs/lanparty/mumble-server.nix b/makefu/2configs/lanparty/mumble-server.nix new file mode 100644 index 000000000..5b9631cd1 --- /dev/null +++ b/makefu/2configs/lanparty/mumble-server.nix @@ -0,0 +1,12 @@ +{ config, ... }: +{ + networking.firewall.allowedTCPPorts = [ 64738 ]; + networking.firewall.allowedUDPPorts = [ 64738 ]; + services.murmur = { + enable = true; + welcometext = "Welcome to the LANest Party mumble server"; + bonjour = true; + hostName = "0.0.0.0"; + sendVersion = true; + }; +} -- cgit v1.2.3 From 6d2bcf3929e1a01f22f11fbe93dbfb47d68f9311 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:50:42 +0100 Subject: ma darth: use for lan partying --- makefu/1systems/darth/config.nix | 41 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/makefu/1systems/darth/config.nix b/makefu/1systems/darth/config.nix index 7accb13d3..046c1574c 100644 --- a/makefu/1systems/darth/config.nix +++ b/makefu/1systems/darth/config.nix @@ -2,6 +2,8 @@ with import ; let + # all the good stuff resides in /data + byid = dev: "/dev/disk/by-id/" + dev; rootDisk = byid "ata-INTEL_SSDSC2BW480H6_CVTR53120385480EGN"; bootPart = rootDisk + "-part1"; @@ -21,44 +23,23 @@ in { - - - # SIEM - # - # {services.tinc.networks.siem = { - # name = "sdarth"; - # extraConfig = "ConnectTo = sjump"; - # }; - # } + # - # { - # makefu.forward-journal = { - # enable = true; - # src = "10.8.10.2"; - # dst = "10.8.10.6"; - # }; - # } - - ## Sharing - # - #{ - # services.samba.shares = { - # isos = { - # path = "/data/isos/"; - # "read only" = "yes"; - # browseable = "yes"; - # "guest ok" = "yes"; - # }; - # }; - #} + + # lan party + + + + + ]; #networking.firewall.enable = false; makefu.server.primary-itf = "enp0s25"; - krebs.hidden-ssh.enable = true; + # krebs.hidden-ssh.enable = true; boot.kernelModules = [ "coretemp" "f71882fg" ]; hardware.enableAllFirmware = true; nixpkgs.config.allowUnfree = true; -- cgit v1.2.3 From f45a5057aa6584177064622ba13f53e59238dae8 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:52:06 +0100 Subject: ma lanparty/lancache-dns: add documentation --- makefu/2configs/lanparty/lancache-dns.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/makefu/2configs/lanparty/lancache-dns.nix b/makefu/2configs/lanparty/lancache-dns.nix index 498162d13..c9da7c4c4 100644 --- a/makefu/2configs/lanparty/lancache-dns.nix +++ b/makefu/2configs/lanparty/lancache-dns.nix @@ -2,6 +2,8 @@ with import ; let upstream-server = "8.8.8.8"; + # make sure the router pins the ip address to the deployed host + # and set it as dns server ( dhcp option 6,192.168.10.10 ) local_ip = "192.168.10.10"; extra-config = pkgs.writeText "local.conf" '' -- cgit v1.2.3 From bf7d2f52fd36b47bad03bd85451eb12c79c3a7ae Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:54:44 +0100 Subject: ma tsp.r: is now acer aspire timeline 1810tz --- makefu/1systems/tsp/config.nix | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/makefu/1systems/tsp/config.nix b/makefu/1systems/tsp/config.nix index 75a11d3a7..7b751e514 100644 --- a/makefu/1systems/tsp/config.nix +++ b/makefu/1systems/tsp/config.nix @@ -1,20 +1,20 @@ # # # -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { imports = [ # Include the results of the hardware scan. - + + # hardware specifics are in here # imports tp-x2x0.nix - + # - - + # @@ -22,9 +22,41 @@ ]; # not working in vm krebs.build.host = config.krebs.hosts.tsp; + boot.initrd.luks.devices = [ { name = "luksroot"; device = "/dev/sda2"; allowDiscards=true; }]; + boot.loader.grub.copyKernels = true; networking.firewall.allowedTCPPorts = [ 25 ]; + # acer aspire + networking.wireless.enable = lib.mkDefault true; + + hardware.enableAllFirmware = true; + nixpkgs.config.allowUnfree = true; + + hardware.cpu.intel.updateMicrocode = true; + + zramSwap.enable = true; + zramSwap.numDevices = 2; + + services.tlp.enable = true; + services.tlp.extraConfig = '' + # BUG: http://linrunner.de/en/tlp/docs/tlp-faq.html#erratic-battery + START_CHARGE_THRESH_BAT0=67 + STOP_CHARGE_THRESH_BAT0=100 + + + CPU_SCALING_GOVERNOR_ON_AC=performance + CPU_SCALING_GOVERNOR_ON_BAT=ondemand + CPU_MIN_PERF_ON_AC=0 + CPU_MAX_PERF_ON_AC=100 + CPU_MIN_PERF_ON_BAT=0 + CPU_MAX_PERF_ON_BAT=30 + ''; + + powerManagement.resumeCommands = '' + ${pkgs.rfkill}/bin/rfkill unblock all + ''; + } -- cgit v1.2.3 From 36ad27a8ad1032afb57f765f5ef7701e7de7ab6b Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Nov 2017 10:55:09 +0100 Subject: ma backup: also backup /var/download from gum --- makefu/2configs/backup.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/makefu/2configs/backup.nix b/makefu/2configs/backup.nix index 166365ba0..a4d02af6b 100644 --- a/makefu/2configs/backup.nix +++ b/makefu/2configs/backup.nix @@ -31,6 +31,19 @@ in { krebs.backup.plans = { # wry-to-omo_root = defaultPull config.krebs.hosts.wry "/"; gum-to-omo_root = defaultPull config.krebs.hosts.gum "/"; + gum-dl-to-omo_external = (defaultPull config.krebs.hosts.gum "/var/download" )// + { + dst.path = "/media/cryptX/backup/gum/var-download"; + dst.host = defaultBackupServer; + startAt = "19:00"; + }; + gum-owncloud-to-omo_external = (defaultPull config.krebs.hosts.gum "/var/www/o.euer.krebsco.de" )// + { + dst.path = "/media/cryptX/backup/gum/var-www-o.euer.krebsco.de"; + dst.host = defaultBackupServer; + + startAt = "05:00"; + }; # wolf-to-omo_root = defaultPull config.krebs.hosts.wolf "/"; }; environment.systemPackages = [ -- cgit v1.2.3 From 378be7f0c22acc2a3fa76f504c28abe5d9df7004 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 9 Nov 2017 16:52:05 +0100 Subject: tv audit: RIP There's no need to silence audit anymore because it's disabled since nixpkgs 16b3e26da4455c6d3f876639ce27ce6cd40d6895. --- mv/1systems/stro/config.nix | 1 - tv/2configs/audit.nix | 9 --------- tv/2configs/default.nix | 1 - 3 files changed, 11 deletions(-) delete mode 100644 tv/2configs/audit.nix diff --git a/mv/1systems/stro/config.nix b/mv/1systems/stro/config.nix index 669655eec..941b3f69e 100644 --- a/mv/1systems/stro/config.nix +++ b/mv/1systems/stro/config.nix @@ -14,7 +14,6 @@ with import ; imports = [ - diff --git a/tv/2configs/audit.nix b/tv/2configs/audit.nix deleted file mode 100644 index 644741a5b..000000000 --- a/tv/2configs/audit.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - security.audit = { - rules = [ - "-a task,never" - ]; - }; -} diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index a8ab538cc..280552fe4 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -11,7 +11,6 @@ with import ; imports = [ - ./audit.nix ./backup.nix ./bash ./htop.nix -- cgit v1.2.3 From dd2a4f2094636dd6bb2e6825591d3d8b5f4b3ccf Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 9 Nov 2017 17:08:58 +0100 Subject: l audit: RIP --- lass/2configs/audit.nix | 9 --------- lass/2configs/default.nix | 1 - 2 files changed, 10 deletions(-) delete mode 100644 lass/2configs/audit.nix diff --git a/lass/2configs/audit.nix b/lass/2configs/audit.nix deleted file mode 100644 index 644741a5b..000000000 --- a/lass/2configs/audit.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - security.audit = { - rules = [ - "-a task,never" - ]; - }; -} diff --git a/lass/2configs/default.nix b/lass/2configs/default.nix index 180647a6d..f8b750093 100644 --- a/lass/2configs/default.nix +++ b/lass/2configs/default.nix @@ -2,7 +2,6 @@ with import ; { imports = [ - ../2configs/audit.nix ../2configs/binary-cache/client.nix ../2configs/gc.nix ../2configs/mc.nix -- cgit v1.2.3 From 51a520b3a584d909c12e51318e724e6a09603405 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 9 Nov 2017 17:12:35 +0100 Subject: tv bash: remove completion.sh This file was used for reference only and was accidentally committed at some point. --- tv/2configs/bash/completion.sh | 779 ----------------------------------------- 1 file changed, 779 deletions(-) delete mode 100644 tv/2configs/bash/completion.sh diff --git a/tv/2configs/bash/completion.sh b/tv/2configs/bash/completion.sh deleted file mode 100644 index 537484fb9..000000000 --- a/tv/2configs/bash/completion.sh +++ /dev/null @@ -1,779 +0,0 @@ - -# Expand variable starting with tilde (~) -# We want to expand ~foo/... to /home/foo/... to avoid problems when -# word-to-complete starting with a tilde is fed to commands and ending up -# quoted instead of expanded. -# Only the first portion of the variable from the tilde up to the first slash -# (~../) is expanded. The remainder of the variable, containing for example -# a dollar sign variable ($) or asterisk (*) is not expanded. -# Example usage: -# -# $ v="~"; __expand_tilde_by_ref v; echo "$v" -# -# Example output: -# -# v output -# -------- ---------------- -# ~ /home/user -# ~foo/bar /home/foo/bar -# ~foo/$HOME /home/foo/$HOME -# ~foo/a b /home/foo/a b -# ~foo/* /home/foo/* -# -# @param $1 Name of variable (not the value of the variable) to expand -__expand_tilde_by_ref() -{ - # Does $1 start with tilde (~)? - if [[ ${!1} == \~* ]]; then - # Does $1 contain slash (/)? - if [[ ${!1} == */* ]]; then - # Yes, $1 contains slash; - # 1: Remove * including and after first slash (/), i.e. "~a/b" - # becomes "~a". Double quotes allow eval. - # 2: Remove * before the first slash (/), i.e. "~a/b" - # becomes "b". Single quotes prevent eval. - # +-----1----+ +---2----+ - eval $1="${!1/%\/*}"/'${!1#*/}' - else - # No, $1 doesn't contain slash - eval $1="${!1}" - fi - fi -} # __expand_tilde_by_ref() - - -# Get the word to complete. -# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases -# where the user is completing in the middle of a word. -# (For example, if the line is "ls foobar", -# and the cursor is here --------> ^ -# @param $1 string Characters out of $COMP_WORDBREAKS which should NOT be -# considered word breaks. This is useful for things like scp where -# we want to return host:path and not only path, so we would pass the -# colon (:) as $1 in this case. -# @param $2 integer Index number of word to return, negatively offset to the -# current word (default is 0, previous is 1), respecting the exclusions -# given at $1. For example, `_get_cword "=:" 1' returns the word left of -# the current word, respecting the exclusions "=:". -# @deprecated Use `_get_comp_words_by_ref cur' instead -# @see _get_comp_words_by_ref() -_get_cword() -{ - local LC_CTYPE=C - local cword words - __reassemble_comp_words_by_ref "$1" words cword - - # return previous word offset by $2 - if [[ ${2//[^0-9]/} ]]; then - printf "%s" "${words[cword-$2]}" - elif [[ "${#words[cword]}" -eq 0 || "$COMP_POINT" == "${#COMP_LINE}" ]]; then - printf "%s" "${words[cword]}" - else - local i - local cur="$COMP_LINE" - local index="$COMP_POINT" - for (( i = 0; i <= cword; ++i )); do - while [[ - # Current word fits in $cur? - "${#cur}" -ge ${#words[i]} && - # $cur doesn't match cword? - "${cur:0:${#words[i]}}" != "${words[i]}" - ]]; do - # Strip first character - cur="${cur:1}" - # Decrease cursor position - ((index--)) - done - - # Does found word matches cword? - if [[ "$i" -lt "$cword" ]]; then - # No, cword lies further; - local old_size="${#cur}" - cur="${cur#${words[i]}}" - local new_size="${#cur}" - index=$(( index - old_size + new_size )) - fi - done - - if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then - # We messed up! At least return the whole word so things - # keep working - printf "%s" "${words[cword]}" - else - printf "%s" "${cur:0:$index}" - fi - fi -} # _get_cword() - - -# Get word previous to the current word. -# This is a good alternative to `prev=${COMP_WORDS[COMP_CWORD-1]}' because bash4 -# will properly return the previous word with respect to any given exclusions to -# COMP_WORDBREAKS. -# @deprecated Use `_get_comp_words_by_ref cur prev' instead -# @see _get_comp_words_by_ref() -# -_get_pword() -{ - if [[ $COMP_CWORD -ge 1 ]]; then - _get_cword "${@:-}" 1 - fi -} - - - -# Complete variables. -# @return True (0) if variables were completed, -# False (> 0) if not. -_variables() -{ - if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]; then - [[ $cur == *{* ]] && local suffix=} || local suffix= - COMPREPLY+=( $( compgen -P ${BASH_REMATCH[1]} -S "$suffix" -v -- \ - "${BASH_REMATCH[2]}" ) ) - return 0 - fi - return 1 -} - -# Assign variable one scope above the caller -# Usage: local "$1" && _upvar $1 "value(s)" -# Param: $1 Variable name to assign value to -# Param: $* Value(s) to assign. If multiple values, an array is -# assigned, otherwise a single value is assigned. -# NOTE: For assigning multiple variables, use '_upvars'. Do NOT -# use multiple '_upvar' calls, since one '_upvar' call might -# reassign a variable to be used by another '_upvar' call. -# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference -_upvar() -{ - if unset -v "$1"; then # Unset & validate varname - if (( $# == 2 )); then - eval $1=\"\$2\" # Return single value - else - eval $1=\(\"\${@:2}\"\) # Return array - fi - fi -} - -# Assign variables one scope above the caller -# Usage: local varname [varname ...] && -# _upvars [-v varname value] | [-aN varname [value ...]] ... -# Available OPTIONS: -# -aN Assign next N values to varname as array -# -v Assign single value to varname -# Return: 1 if error occurs -# See: http://fvue.nl/wiki/Bash:_Passing_variables_by_reference -_upvars() -{ - if ! (( $# )); then - echo "${FUNCNAME[0]}: usage: ${FUNCNAME[0]} [-v varname"\ - "value] | [-aN varname [value ...]] ..." 1>&2 - return 2 - fi - while (( $# )); do - case $1 in - -a*) - # Error checking - [[ ${1#-a} ]] || { echo "bash: ${FUNCNAME[0]}: \`$1': missing"\ - "number specifier" 1>&2; return 1; } - printf %d "${1#-a}" &> /dev/null || { echo "bash:"\ - "${FUNCNAME[0]}: \`$1': invalid number specifier" 1>&2 - return 1; } - # Assign array of -aN elements - [[ "$2" ]] && unset -v "$2" && eval $2=\(\"\${@:3:${1#-a}}\"\) && - shift $((${1#-a} + 2)) || { echo "bash: ${FUNCNAME[0]}:"\ - "\`$1${2+ }$2': missing argument(s)" 1>&2; return 1; } - ;; - -v) - # Assign single value - [[ "$2" ]] && unset -v "$2" && eval $2=\"\$3\" && - shift 3 || { echo "bash: ${FUNCNAME[0]}: $1: missing"\ - "argument(s)" 1>&2; return 1; } - ;; - *) - echo "bash: ${FUNCNAME[0]}: $1: invalid option" 1>&2 - return 1 ;; - esac - done -} - -# @param $1 exclude Characters out of $COMP_WORDBREAKS which should NOT be -# considered word breaks. This is useful for things like scp where -# we want to return host:path and not only path, so we would pass the -# colon (:) as $1 in this case. -# @param $2 words Name of variable to return words to -# @param $3 cword Name of variable to return cword to -# @param $4 cur Name of variable to return current word to complete to -# @see __reassemble_comp_words_by_ref() -__get_cword_at_cursor_by_ref() -{ - local cword words=() - __reassemble_comp_words_by_ref "$1" words cword - - local i cur index=$COMP_POINT lead=${COMP_LINE:0:$COMP_POINT} - # Cursor not at position 0 and not leaded by just space(s)? - if [[ $index -gt 0 && ( $lead && ${lead//[[:space:]]} ) ]]; then - cur=$COMP_LINE - for (( i = 0; i <= cword; ++i )); do - while [[ - # Current word fits in $cur? - ${#cur} -ge ${#words[i]} && - # $cur doesn't match cword? - "${cur:0:${#words[i]}}" != "${words[i]}" - ]]; do - # Strip first character - cur="${cur:1}" - # Decrease cursor position - ((index--)) - done - - # Does found word match cword? - if [[ $i -lt $cword ]]; then - # No, cword lies further; - local old_size=${#cur} - cur="${cur#"${words[i]}"}" - local new_size=${#cur} - index=$(( index - old_size + new_size )) - fi - done - # Clear $cur if just space(s) - [[ $cur && ! ${cur//[[:space:]]} ]] && cur= - # Zero $index if negative - [[ $index -lt 0 ]] && index=0 - fi - - local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 "${words[@]}" \ - -v $3 "$cword" -v $4 "${cur:0:$index}" -} - -# Reassemble command line words, excluding specified characters from the -# list of word completion separators (COMP_WORDBREAKS). -# @param $1 chars Characters out of $COMP_WORDBREAKS which should -# NOT be considered word breaks. This is useful for things like scp where -# we want to return host:path and not only path, so we would pass the -# colon (:) as $1 here. -# @param $2 words Name of variable to return words to -# @param $3 cword Name of variable to return cword to -# -__reassemble_comp_words_by_ref() -{ - local exclude i j line ref - # Exclude word separator characters? - if [[ $1 ]]; then - # Yes, exclude word separator characters; - # Exclude only those characters, which were really included - exclude="${1//[^$COMP_WORDBREAKS]}" - fi - - # Default to cword unchanged - eval $3=$COMP_CWORD - # Are characters excluded which were former included? - if [[ $exclude ]]; then - # Yes, list of word completion separators has shrunk; - line=$COMP_LINE - # Re-assemble words to complete - for (( i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do - # Is current word not word 0 (the command itself) and is word not - # empty and is word made up of just word separator characters to - # be excluded and is current word not preceded by whitespace in - # original line? - while [[ $i -gt 0 && ${COMP_WORDS[$i]} == +([$exclude]) ]]; do - # Is word separator not preceded by whitespace in original line - # and are we not going to append to word 0 (the command - # itself), then append to current word. - [[ $line != [$' \t']* ]] && (( j >= 2 )) && ((j--)) - # Append word separator to current or new word - ref="$2[$j]" - eval $2[$j]=\${!ref}\${COMP_WORDS[i]} - # Indicate new cword - [[ $i == $COMP_CWORD ]] && eval $3=$j - # Remove optional whitespace + word separator from line copy - line=${line#*"${COMP_WORDS[$i]}"} - # Start new word if word separator in original line is - # followed by whitespace. - [[ $line == [$' \t']* ]] && ((j++)) - # Indicate next word if available, else end *both* while and - # for loop - (( $i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2 - done - # Append word to current word - ref="$2[$j]" - eval $2[$j]=\${!ref}\${COMP_WORDS[i]} - # Remove optional whitespace + word from line copy - line=${line#*"${COMP_WORDS[i]}"} - # Indicate new cword - [[ $i == $COMP_CWORD ]] && eval $3=$j - done - [[ $i == $COMP_CWORD ]] && eval $3=$j - else - # No, list of word completions separators hasn't changed; - eval $2=\( \"\${COMP_WORDS[@]}\" \) - fi -} # __reassemble_comp_words_by_ref() - - -# If the word-to-complete contains a colon (:), left-trim COMPREPLY items with -# word-to-complete. -# With a colon in COMP_WORDBREAKS, words containing -# colons are always completed as entire words if the word to complete contains -# a colon. This function fixes this, by removing the colon-containing-prefix -# from COMPREPLY items. -# The preferred solution is to remove the colon (:) from COMP_WORDBREAKS in -# your .bashrc: -# -# # Remove colon (:) from list of word completion separators -# COMP_WORDBREAKS=${COMP_WORDBREAKS//:} -# -# See also: Bash FAQ - E13) Why does filename completion misbehave if a colon -# appears in the filename? - http://tiswww.case.edu/php/chet/bash/FAQ -# @param $1 current word to complete (cur) -# @modifies global array $COMPREPLY -# -__ltrim_colon_completions() -{ - if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then - # Remove colon-word prefix from COMPREPLY items - local colon_word=${1%"${1##*:}"} - local i=${#COMPREPLY[*]} - while [[ $((--i)) -ge 0 ]]; do - COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"} - done - fi -} # __ltrim_colon_completions() - - -# NOTE: Using this function as a helper function is deprecated. Use -# `_known_hosts_real' instead. -_known_hosts() -{ - local cur prev words cword - _init_completion -n : || return - - # NOTE: Using `_known_hosts' as a helper function and passing options - # to `_known_hosts' is deprecated: Use `_known_hosts_real' instead. - local options - [[ "$1" == -a || "$2" == -a ]] && options=-a - [[ "$1" == -c || "$2" == -c ]] && options+=" -c" - _known_hosts_real $options -- "$cur" -} # _known_hosts() - - -# Helper function for completing _known_hosts. -# This function performs host completion based on ssh's config and known_hosts -# files, as well as hostnames reported by avahi-browse if -# COMP_KNOWN_HOSTS_WITH_AVAHI is set to a non-empty value. Also hosts from -# HOSTFILE (compgen -A hostname) are added, unless -# COMP_KNOWN_HOSTS_WITH_HOSTFILE is set to an empty value. -# Usage: _known_hosts_real [OPTIONS] CWORD -# Options: -a Use aliases -# -c Use `:' suffix -# -F configfile Use `configfile' for configuration settings -# -p PREFIX Use PREFIX -# Return: Completions, starting with CWORD, are added to COMPREPLY[] -_known_hosts_real() -{ - local configfile flag prefix - local cur curd awkcur user suffix aliases i host - local -a kh khd config - - local OPTIND=1 - while getopts "acF:p:" flag "$@"; do - case $flag in - a) aliases='yes' ;; - c) suffix=':' ;; - F) configfile=$OPTARG ;; - p) prefix=$OPTARG ;; - esac - done - [[ $# -lt $OPTIND ]] && echo "error: $FUNCNAME: missing mandatory argument CWORD" - cur=${!OPTIND}; let "OPTIND += 1" - [[ $# -ge $OPTIND ]] && echo "error: $FUNCNAME("$@"): unprocessed arguments:"\ - $(while [[ $# -ge $OPTIND ]]; do printf '%s\n' ${!OPTIND}; shift; done) - - [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@} - kh=() - - # ssh config files - if [[ -n $configfile ]]; then - [[ -r $configfile ]] && config+=( "$configfile" ) - else - for i in /etc/ssh/ssh_config ~/.ssh/config ~/.ssh2/config; do - [[ -r $i ]] && config+=( "$i" ) - done - fi - - # Known hosts files from configs - if [[ ${#config[@]} -gt 0 ]]; then - local OIFS=$IFS IFS=$'\n' j - local -a tmpkh - # expand paths (if present) to global and user known hosts files - # TODO(?): try to make known hosts files with more than one consecutive - # spaces in their name work (watch out for ~ expansion - # breakage! Alioth#311595) - tmpkh=( $( awk 'sub("^[ \t]*([Gg][Ll][Oo][Bb][Aa][Ll]|[Uu][Ss][Ee][Rr])[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee][ \t]+", "") { print $0 }' "${config[@]}" | sort -u ) ) - IFS=$OIFS - for i in "${tmpkh[@]}"; do - # First deal with quoted entries... - while [[ $i =~ ^([^\"]*)\"([^\"]*)\"(.*)$ ]]; do - i=${BASH_REMATCH[1]}${BASH_REMATCH[3]} - j=${BASH_REMATCH[2]} - __expand_tilde_by_ref j # Eval/expand possible `~' or `~user' - [[ -r $j ]] && kh+=( "$j" ) - done - # ...and then the rest. - for j in $i; do - __expand_tilde_by_ref j # Eval/expand possible `~' or `~user' - [[ -r $j ]] && kh+=( "$j" ) - done - done - fi - - - if [[ -z $configfile ]]; then - # Global and user known_hosts files - for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \ - /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \ - ~/.ssh/known_hosts2; do - [[ -r $i ]] && kh+=( "$i" ) - done - for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do - [[ -d $i ]] && khd+=( "$i"/*pub ) - done - fi - - # If we have known_hosts files to use - if [[ ${#kh[@]} -gt 0 || ${#khd[@]} -gt 0 ]]; then - # Escape slashes and dots in paths for awk - awkcur=${cur//\//\\\/} - awkcur=${awkcur//\./\\\.} - curd=$awkcur - - if [[ "$awkcur" == [0-9]*[.:]* ]]; then - # Digits followed by a dot or a colon - just search for that - awkcur="^$awkcur[.:]*" - elif [[ "$awkcur" == [0-9]* ]]; then - # Digits followed by no dot or colon - search for digits followed - # by a dot or a colon - awkcur="^$awkcur.*[.:]" - elif [[ -z $awkcur ]]; then - # A blank - search for a dot, a colon, or an alpha character - awkcur="[a-z.:]" - else - awkcur="^$awkcur" - fi - - if [[ ${#kh[@]} -gt 0 ]]; then - # FS needs to look for a comma separated list - COMPREPLY+=( $( awk 'BEGIN {FS=","} - /^\s*[^|\#]/ { - sub("^@[^ ]+ +", ""); \ - sub(" .*$", ""); \ - for (i=1; i<=NF; ++i) { \ - sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \ - if ($i !~ /[*?]/ && $i ~ /'"$awkcur"'/) {print $i} \ - }}' "${kh[@]}" 2>/dev/null ) ) - fi - if [[ ${#khd[@]} -gt 0 ]]; then - # Needs to look for files called - # .../.ssh2/key_22_.pub - # dont fork any processes, because in a cluster environment, - # there can be hundreds of hostkeys - for i in "${khd[@]}" ; do - if [[ "$i" == *key_22_$curd*.pub && -r "$i" ]]; then - host=${i/#*key_22_/} - host=${host/%.pub/} - COMPREPLY+=( $host ) - fi - done - fi - - # apply suffix and prefix - for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do - COMPREPLY[i]=$prefix$user${COMPREPLY[i]}$suffix - done - fi - - # append any available aliases from config files - if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then - local hosts=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t '"']\{1,\}\([^#*?]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" ) - COMPREPLY+=( $( compgen -P "$prefix$user" \ - -S "$suffix" -W "$hosts" -- "$cur" ) ) - fi - - # Add hosts reported by avahi-browse, if desired and it's available. - if [[ ${COMP_KNOWN_HOSTS_WITH_AVAHI:-} ]] && \ - type avahi-browse &>/dev/null; then - # The original call to avahi-browse also had "-k", to avoid lookups - # into avahi's services DB. We don't need the name of the service, and - # if it contains ";", it may mistify the result. But on Gentoo (at - # least), -k wasn't available (even if mentioned in the manpage) some - # time ago, so... - COMPREPLY+=( $( compgen -P "$prefix$user" -S "$suffix" -W \ - "$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \ - awk -F';' '/^=/ { print $7 }' | sort -u )" -- "$cur" ) ) - fi - - # Add hosts reported by ruptime. - COMPREPLY+=( $( compgen -W \ - "$( ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }' )" \ - -- "$cur" ) ) - - # Add results of normal hostname completion, unless - # `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.