summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/default.nix14
-rw-r--r--krebs/5pkgs/haskell/blessings.nix15
-rw-r--r--krebs/5pkgs/haskell/email-header.nix7
-rw-r--r--krebs/5pkgs/haskell/flameshot-once.nix21
-rw-r--r--krebs/5pkgs/haskell/much.nix (renamed from krebs/5pkgs/simple/much/cabal.nix)9
-rw-r--r--krebs/5pkgs/haskell/reaktor2.nix27
-rw-r--r--krebs/5pkgs/haskell/xmonad-stockholm.nix3
-rw-r--r--krebs/5pkgs/simple/Reaktor/default.nix6
-rw-r--r--krebs/5pkgs/simple/Reaktor/plugins.nix68
-rwxr-xr-x[-rw-r--r--]krebs/5pkgs/simple/Reaktor/scripts/random-emoji.sh2
-rwxr-xr-x[-rw-r--r--]krebs/5pkgs/simple/Reaktor/scripts/random-issue.sh0
-rwxr-xr-x[-rw-r--r--]krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py2
-rwxr-xr-x[-rw-r--r--]krebs/5pkgs/simple/Reaktor/scripts/shack-correct.sh0
-rw-r--r--krebs/5pkgs/simple/flameshot-once/default.nix27
-rw-r--r--krebs/5pkgs/simple/flameshot-once/profile.nix138
-rw-r--r--krebs/5pkgs/simple/github-hosts-sync/default.nix39
-rwxr-xr-xkrebs/5pkgs/simple/github-hosts-sync/src/hosts-sync33
-rw-r--r--krebs/5pkgs/simple/irc-announce/default.nix2
-rw-r--r--krebs/5pkgs/simple/kpaste/default.nix5
-rw-r--r--krebs/5pkgs/simple/krebspaste/default.nix12
-rw-r--r--krebs/5pkgs/simple/much/default.nix3
-rw-r--r--krebs/5pkgs/simple/q-power_supply.nix126
-rw-r--r--krebs/5pkgs/simple/qrscan.nix27
-rw-r--r--krebs/5pkgs/simple/reaktor2-plugins.nix106
-rw-r--r--krebs/5pkgs/simple/ssh-audit.nix55
25 files changed, 641 insertions, 106 deletions
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index 84c00e82..4cdaedeb 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -13,14 +13,7 @@ foldl' mergeAttrs {}
//
{
- # https://github.com/NixOS/nixpkgs/pull/30065
- brscan4 = overrideDerivation super.brscan4 (original: rec {
- name = "brscan4-0.4.4-4";
- src = super.fetchurl {
- url = "http://download.brother.com/welcome/dlf006645/${name}.amd64.deb";
- sha256 = "0xy5px96y1saq9l80vwvfn6anr2q42qlxdhm6ci2a0diwib5q9fd";
- };
- });
+ reaktor2 = self.haskellPackages.reaktor2;
ReaktorPlugins = self.callPackage ./simple/Reaktor/plugins.nix {};
@@ -29,9 +22,4 @@ foldl' mergeAttrs {}
export PROOT_NO_SECCOMP=1
exec ${super.proot}/bin/proot "$@"
'';
-
- # XXX symlinkJoin changed arguments somewhere around nixpkgs d541e0d
- symlinkJoin = { name, paths, ... }@args: let
- x = super.symlinkJoin args;
- in if typeOf x != "lambda" then x else super.symlinkJoin name paths;
}
diff --git a/krebs/5pkgs/haskell/blessings.nix b/krebs/5pkgs/haskell/blessings.nix
index 59c5b798..7abebba5 100644
--- a/krebs/5pkgs/haskell/blessings.nix
+++ b/krebs/5pkgs/haskell/blessings.nix
@@ -1,5 +1,5 @@
with import <stockholm/lib>;
-{ mkDerivation, base, fetchgit, stdenv }: let
+{ mkDerivation, base, fetchgit, hspec, QuickCheck, stdenv, text }: let
cfg = {
"18.03" = {
@@ -7,10 +7,14 @@ with import <stockholm/lib>;
sha256 = "1k908zap3694fcxdk4bb29s54b0lhdh557y10ybjskfwnym7szn1";
};
"18.09" = {
- version = "1.2.0";
- sha256 = "03hz43ixww0h4fwxqrlrlvmj3pxswhb50ijaapwjz8457il2r300";
+ version = "2.2.0";
+ sha256 = "1pb56dgf3jj2kq3cbbppwzyg3ccgqy9xara62hkjwyxzdx20clk1";
};
- }.${versions.majorMinor nixpkgsVersion};
+ "19.03" = {
+ version = "2.2.0";
+ sha256 = "1pb56dgf3jj2kq3cbbppwzyg3ccgqy9xara62hkjwyxzdx20clk1";
+ };
+ }.${versions.majorMinor version};
in mkDerivation {
pname = "blessings";
@@ -20,7 +24,8 @@ in mkDerivation {
rev = "refs/tags/v${cfg.version}";
sha256 = cfg.sha256;
};
- libraryHaskellDepends = [ base ];
+ libraryHaskellDepends = [ base text ];
+ testHaskellDepends = [ base hspec QuickCheck ];
doHaddock = false;
# WTFPL is the true license, which is unknown to cabal.
license = stdenv.lib.licenses.wtfpl;
diff --git a/krebs/5pkgs/haskell/email-header.nix b/krebs/5pkgs/haskell/email-header.nix
index 4049168c..fe4bb839 100644
--- a/krebs/5pkgs/haskell/email-header.nix
+++ b/krebs/5pkgs/haskell/email-header.nix
@@ -15,7 +15,12 @@ with import <stockholm/lib>;
rev = "refs/tags/v${cfg.version}";
sha256 = "11xjivpj495r2ss9aqljnpzzycb57cm4sr7yzmf939rzwsd3ib0x";
};
- }.${versions.majorMinor nixpkgsVersion};
+ "19.03" = {
+ version = "0.4.1-tv1";
+ rev = "refs/tags/v${cfg.version}";
+ sha256 = "11xjivpj495r2ss9aqljnpzzycb57cm4sr7yzmf939rzwsd3ib0x";
+ };
+ }.${versions.majorMinor version};
in mkDerivation {
pname = "email-header";
diff --git a/krebs/5pkgs/haskell/flameshot-once.nix b/krebs/5pkgs/haskell/flameshot-once.nix
new file mode 100644
index 00000000..5b369362
--- /dev/null
+++ b/krebs/5pkgs/haskell/flameshot-once.nix
@@ -0,0 +1,21 @@
+{ mkDerivation, async, base, blessings, bytestring, dbus, fetchgit
+, iso8601-time, process, random, stdenv, text, time, unagi-chan
+, unix
+}:
+mkDerivation {
+ pname = "flameshot-once";
+ version = "1.2.0";
+ src = fetchgit {
+ url = "https://cgit.krebsco.de/flameshot-once";
+ sha256 = "01c11dk8ss37awfn9xqsgx668dcrf4kvzfxlq7ycnqsnpbjjvm0a";
+ rev = "cebaefa37095e74ad2253c4e2f9d9ab390f88737";
+ fetchSubmodules = true;
+ };
+ isLibrary = false;
+ isExecutable = true;
+ executableHaskellDepends = [
+ async base blessings bytestring dbus iso8601-time process random
+ text time unagi-chan unix
+ ];
+ license = stdenv.lib.licenses.mit;
+}
diff --git a/krebs/5pkgs/simple/much/cabal.nix b/krebs/5pkgs/haskell/much.nix
index 09bc7b5d..db168f8a 100644
--- a/krebs/5pkgs/simple/much/cabal.nix
+++ b/krebs/5pkgs/haskell/much.nix
@@ -8,11 +8,12 @@
}:
mkDerivation {
pname = "much";
- version = "1.1.0";
+ version = "1.2.0";
src = fetchgit {
- url = "http://cgit.ni.krebsco.de/much";
- sha256 = "1325554zymr1dd0clj8c5ygl70c791csvs0hz33jcfr6b8wysdrl";
- rev = "dfec37d848e11c00d9b7f03295af1fc7b0e83ef5";
+ url = "https://cgit.krebsco.de/much";
+ sha256 = "0gfvppi8acylz0q7xh8dkm3dj676d4sc1m1gxwp663bkn4748873";
+ rev = "8fc4fbb5bb7781626da8f63cd8df8bb0f554cfe7";
+ fetchSubmodules = true;
};
isLibrary = false;
isExecutable = true;
diff --git a/krebs/5pkgs/haskell/reaktor2.nix b/krebs/5pkgs/haskell/reaktor2.nix
new file mode 100644
index 00000000..f06e7912
--- /dev/null
+++ b/krebs/5pkgs/haskell/reaktor2.nix
@@ -0,0 +1,27 @@
+{ mkDerivation, aeson, async, attoparsec, base, blessings
+, bytestring, containers, data-default, fetchgit, filepath
+, hashable, lens, lens-aeson, network, network-simple
+, network-simple-tls, pcre-light, process, random, stdenv
+, string-conversions, stringsearch, text, time, transformers
+, unagi-chan, unix, unordered-containers, vector
+}:
+mkDerivation {
+ pname = "reaktor2";
+ version = "0.2.2";
+ src = fetchgit {
+ url = "https://cgit.krebsco.de/reaktor2";
+ sha256 = "1kyr5i5zdzvc7fcyac1i1yvi88kcxafrgp8p79c1b9l4g9sjnv78";
+ rev = "9f4e2644188f985d7cd806c13e2c0dee1688b9f0";
+ fetchSubmodules = true;
+ };
+ isLibrary = false;
+ isExecutable = true;
+ executableHaskellDepends = [
+ aeson async attoparsec base blessings bytestring containers
+ data-default filepath hashable lens lens-aeson network
+ network-simple network-simple-tls pcre-light process random
+ string-conversions stringsearch text time transformers unagi-chan
+ unix unordered-containers vector
+ ];
+ license = stdenv.lib.licenses.mit;
+}
diff --git a/krebs/5pkgs/haskell/xmonad-stockholm.nix b/krebs/5pkgs/haskell/xmonad-stockholm.nix
index 228d365a..1b197b91 100644
--- a/krebs/5pkgs/haskell/xmonad-stockholm.nix
+++ b/krebs/5pkgs/haskell/xmonad-stockholm.nix
@@ -1,5 +1,4 @@
-{ mkDerivation, base, containers, fetchgit, filepath, stdenv, unix, X11, X11-xft
-, X11-xshape, xmonad, xmonad-contrib
+{ mkDerivation, base, containers, fetchgit, filepath, stdenv, unix, X11, X11-xft , X11-xshape, xmonad, xmonad-contrib
}:
mkDerivation rec {
pname = "xmonad-stockholm";
diff --git a/krebs/5pkgs/simple/Reaktor/default.nix b/krebs/5pkgs/simple/Reaktor/default.nix
index 3ef9ffb7..1cc498a6 100644
--- a/krebs/5pkgs/simple/Reaktor/default.nix
+++ b/krebs/5pkgs/simple/Reaktor/default.nix
@@ -2,7 +2,7 @@
python3Packages.buildPythonPackage rec {
name = "Reaktor-${version}";
- version = "0.6.2";
+ version = "0.7.1";
doCheck = false;
@@ -13,8 +13,8 @@ python3Packages.buildPythonPackage rec {
src = fetchFromGitHub {
owner = "krebs";
repo = "Reaktor";
- rev = version;
- sha256 = "0h8pj0x9b5fnxddwrc0f63rxd3275v5phmjc0fv4kiwlzvbcxj6m";
+ rev = "v${version}";
+ sha256 = "0cv5a4x73ls6sk8qj2qi6gqn31rv8kvdg13dsf3jv92xdfx6brjn";
};
meta = {
homepage = http://krebsco.de/;
diff --git a/krebs/5pkgs/simple/Reaktor/plugins.nix b/krebs/5pkgs/simple/Reaktor/plugins.nix
index 6f59ad1d..1b19a117 100644
--- a/krebs/5pkgs/simple/Reaktor/plugins.nix
+++ b/krebs/5pkgs/simple/Reaktor/plugins.nix
@@ -146,58 +146,36 @@ rec {
'';
});
- taskrcFile = builtins.toFile "taskrc" ''
- confirmation=no
- '';
-
- task-add = buildSimpleReaktorPlugin "task-add" {
- pattern = "^task-add: (?P<args>.*)$$";
- script = pkgs.writeDash "task-add" ''
- ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} add "$*"
- '';
- };
-
- task-list = buildSimpleReaktorPlugin "task-list" {
- pattern = "^task-list";
- script = pkgs.writeDash "task-list" ''
- ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} export | ${pkgs.jq}/bin/jq -r '.[] | select(.id != 0) | "\(.id) \(.description)"'
- '';
- };
-
- task-delete = buildSimpleReaktorPlugin "task-delete" {
- pattern = "^task-delete: (?P<args>.*)$$";
- script = pkgs.writeDash "task-delete" ''
- ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} delete "$*"
- '';
- };
-
- task-done = buildSimpleReaktorPlugin "task-done" {
- pattern = "^task-done: (?P<args>.*)$$";
- script = pkgs.writeDash "task-done" ''
- ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} done "$*"
- '';
- };
-
- todo = name: {
- add = buildSimpleReaktorPlugin "${name}-add" {
+ task = name: let
+ rcFile = builtins.toFile "taskrc" ''
+ confirmation=no
+ '';
+ in {
+ add = buildSimpleReaktorPlugin "${name}-task-add" {
pattern = "^${name}-add: (?P<args>.*)$$";
script = pkgs.writeDash "${name}-add" ''
- echo "$*" >> ${name}-todo
- echo "added ${name} todo"
+ TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} add "$*"
'';
};
- delete = buildSimpleReaktorPlugin "${name}-delete" {
+
+ list = buildSimpleReaktorPlugin "task-list" {
+ pattern = "^${name}-list";
+ script = pkgs.writeDash "task-list" ''
+ TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} export | ${pkgs.jq}/bin/jq -r '.[] | select(.id != 0) | "\(.id) \(.description)"'
+ '';
+ };
+
+ delete = buildSimpleReaktorPlugin "task-delete" {
pattern = "^${name}-delete: (?P<args>.*)$$";
- script = pkgs.writeDash "${name}-delete" ''
- ${pkgs.gnugrep}/bin/grep -Fvxe "$*" ${name}-todo > ${name}-todo.tmp
- ${pkgs.coreutils}/bin/mv ${name}-todo.tmp ${name}-todo
- echo "removed ${name} todo: $*"
+ script = pkgs.writeDash "task-delete" ''
+ TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} delete "$*"
'';
};
- show = buildSimpleReaktorPlugin "${name}-show" {
- pattern = "^${name}-show$";
- script = pkgs.writeDash "${name}-show" ''
- ${pkgs.coreutils}/bin/cat ${name}-todo
+
+ done = buildSimpleReaktorPlugin "task-done" {
+ pattern = "^${name}-done: (?P<args>.*)$$";
+ script = pkgs.writeDash "task-done" ''
+ TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} done "$*"
'';
};
};
diff --git a/krebs/5pkgs/simple/Reaktor/scripts/random-emoji.sh b/krebs/5pkgs/simple/Reaktor/scripts/random-emoji.sh
index 386aa68b..6f3dd4a3 100644..100755
--- a/krebs/5pkgs/simple/Reaktor/scripts/random-emoji.sh
+++ b/krebs/5pkgs/simple/Reaktor/scripts/random-emoji.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-curl http://emojicons.com/random -s | \
+curl -sS http://emojicons.com/random | \
grep data-text | \
sed -n 's/.*>\(.*\)<\/textarea>/\1/p' | \
head -n 1 | \
diff --git a/krebs/5pkgs/simple/Reaktor/scripts/random-issue.sh b/krebs/5pkgs/simple/Reaktor/scripts/random-issue.sh
index 5c47c615..5c47c615 100644..100755
--- a/krebs/5pkgs/simple/Reaktor/scripts/random-issue.sh
+++ b/krebs/5pkgs/simple/Reaktor/scripts/random-issue.sh
diff --git a/krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py b/krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py
index ecb03917..4925b25b 100644..100755
--- a/krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py
+++ b/krebs/5pkgs/simple/Reaktor/scripts/sed-plugin.py
@@ -46,7 +46,7 @@ if is_regex(line):
print('to many lines, skipped')
else:
if last.strip() != ret.strip():
- print("\x1b[1m{}\x1b[0m meant: {}".format(usr, ret.strip()))
+ print("\x02{}\x02 meant: {}".format(usr, ret.strip()))
if ret:
d[usr] = ret
diff --git a/krebs/5pkgs/simple/Reaktor/scripts/shack-correct.sh b/krebs/5pkgs/simple/Reaktor/scripts/shack-correct.sh
index d500b3cb..d500b3cb 100644..100755
--- a/krebs/5pkgs/simple/Reaktor/scripts/shack-correct.sh
+++ b/krebs/5pkgs/simple/Reaktor/scripts/shack-correct.sh
diff --git a/krebs/5pkgs/simple/flameshot-once/default.nix b/krebs/5pkgs/simple/flameshot-once/default.nix
new file mode 100644
index 00000000..c442a2e9
--- /dev/null
+++ b/krebs/5pkgs/simple/flameshot-once/default.nix
@@ -0,0 +1,27 @@
+with import <stockholm/lib>;
+{ pkgs, ... }@args:
+
+let
+ # config cannot be declared in the input attribute set because that would
+ # cause callPackage to inject the wrong config. Instead, get it from ...
+ # via args.
+ config = args.config or {};
+in
+
+ pkgs.symlinkJoin {
+ name = "flameshot-once-wrapper";
+ paths = [
+ (pkgs.writeDashBin "flameshot-once" ''
+ export PATH=${makeBinPath [
+ pkgs.flameshot
+ pkgs.qt5.qtbase
+ pkgs.xclip
+ ]}
+ ${optionalString (config != null) /* sh */ ''
+ . ${import ./profile.nix { inherit config pkgs; }}
+ ''}
+ exec ${pkgs.haskellPackages.flameshot-once}/bin/flameshot-once "$@"
+ '')
+ pkgs.haskellPackages.flameshot-once
+ ];
+ }
diff --git a/krebs/5pkgs/simple/flameshot-once/profile.nix b/krebs/5pkgs/simple/flameshot-once/profile.nix
new file mode 100644
index 00000000..8ea8a850
--- /dev/null
+++ b/krebs/5pkgs/simple/flameshot-once/profile.nix
@@ -0,0 +1,138 @@
+with import <stockholm/lib>;
+{ config, pkgs }:
+let
+
+ # Refs https://github.com/lupoDharkael/flameshot/blob/master/src/widgets/capture/capturebutton.h
+ ButtonType = {
+ PENCIL = 0;
+ DRAWER = 1;
+ ARROW = 2;
+ SELECTION = 3;
+ RECTANGLE = 4;
+ CIRCLE = 5;
+ MARKER = 6;
+ SELECTIONINDICATOR = 7;
+ MOVESELECTION = 8;
+ UNDO = 9;
+ COPY = 10;
+ SAVE = 11;
+ EXIT = 12;
+ IMAGEUPLOADER = 13;
+ OPEN_APP = 14;
+ BLUR = 15;
+ REDO = 16;
+ PIN = 17;
+ TEXT = 18;
+ };
+
+ cfg = eval.config;
+
+ eval = evalModules {
+ modules = singleton {
+ _file = toString ./profile.nix;
+ imports = singleton config;
+ options = {
+ buttons = mkOption {
+ apply = map (name: ButtonType.${name});
+ default = [
+ "PENCIL"
+ "DRAWER"
+ "ARROW"
+ "SELECTION"
+ "RECTANGLE"
+ "CIRCLE"
+ "MARKER"
+ "SELECTIONINDICATOR"
+ "MOVESELECTION"
+ "UNDO"
+ "SAVE"
+ "EXIT"
+ "BLUR"
+ ];
+ type = types.listOf (types.enum (attrNames ButtonType));
+ };
+ disabledTrayIcon = mkOption {
+ default = true;
+ type = types.bool;
+ };
+ drawThickness = mkOption {
+ default = 8;
+ type = types.positive;
+ };
+ filenamePattern = mkOption {
+ default = "%FT%T%z_flameshot";
+ type =
+ # This is types.filename extended by [%:][%:+]*
+ types.addCheck types.str (test "[%:0-9A-Za-z._][%:+0-9A-Za-z._-]*");
+ };
+ savePath = mkOption {
+ default = "/tmp";
+ type = types.absolute-pathname;
+ };
+ showDesktopNotification = mkOption {
+ default = false;
+ type = types.bool;
+ };
+ showHelp = mkOption {
+ default = false;
+ type = types.bool;
+ };
+ timeout = mkOption {
+ default = 100;
+ description = ''
+ Maximum time in milliseconds allowed for the flameshot daemon to
+ react.
+ '';
+ type = types.positive;
+ };
+ };
+ };
+ };
+
+ hexchars = stringToCharacters "0123456789abcdef";
+
+ # Encode integer to C-escaped string of bytes, little endian / LSB 0
+ le = rec {
+ x1 = i: let
+ i0 = mod i 16;
+ i1 = i / 16;
+ in
+ "\\x${elemAt hexchars i1}${elemAt hexchars i0}";
+
+ x2 = i: let
+ i0 = mod i 256;
+ i1 = i / 256;
+ in
+ "${x1 i0}${x1 i1}";
+
+ x4 = i: let
+ i0 = mod i 65536;
+ i1 = i / 65536;
+ in
+ "${x2 i0}${x2 i1}";
+ };
+
+ toQList = t: xs:
+ assert t == "int";
+ "QList<${t}>${le.x4 0}${le.x4 (length xs)}${concatMapStrings le.x4 xs}";
+
+ XDG_CONFIG_HOME = pkgs.write "flameshot-config" {
+ "/Dharkael/flameshot.ini".text = ''
+ [General]
+ buttons=@Variant(\0\0\0\x7f\0\0\0\v${toQList "int" cfg.buttons})
+ disabledTrayIcon=${toJSON cfg.disabledTrayIcon}
+ drawThickness=${toJSON cfg.drawThickness}
+ filenamePattern=${toJSON cfg.filenamePattern}
+ savePath=${toJSON cfg.savePath}
+ showDesktopNotification=${toJSON cfg.showDesktopNotification}
+ showHelp=${toJSON cfg.showHelp}
+ '';
+ };
+
+in
+
+ pkgs.writeDash "flameshot.profile" ''
+ export FLAMESHOT_CAPTURE_PATH=${cfg.savePath}
+ export FLAMESHOT_ONCE_TIMEOUT=${toString cfg.timeout}
+ export XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
+ ''
diff --git a/krebs/5pkgs/simple/github-hosts-sync/default.nix b/krebs/5pkgs/simple/github-hosts-sync/default.nix
index cdfed468..fbc48fa3 100644
--- a/krebs/5pkgs/simple/github-hosts-sync/default.nix
+++ b/krebs/5pkgs/simple/github-hosts-sync/default.nix
@@ -1,37 +1,32 @@
{ pkgs, stdenv, ... }:
-stdenv.mkDerivation {
- name = "github-hosts-sync";
+stdenv.mkDerivation rec {
+ name = "github-hosts-sync-${version}";
+ version = "2.0.0";
- src = pkgs.painload;
+ src = ./src;
phases = [
"unpackPhase"
"installPhase"
];
- installPhase =
- let
- ca-bundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
- path = stdenv.lib.makeBinPath (with pkgs; [
- coreutils
- findutils
- git
- gnugrep
- gnused
- nettools
- openssh
- socat
- ]);
- in
+ installPhase = let
+ ca-bundle = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
+ path = stdenv.lib.makeBinPath [
+ pkgs.git
+ pkgs.nettools
+ pkgs.openssh
+ pkgs.rsync
+ ];
+ in
''
mkdir -p $out/bin
- sed \
- 's,^main() {$,&\n export PATH=${path} GIT_SSL_CAINFO=${ca-bundle},' \
- < ./retiolum/scripts/github_hosts_sync/hosts-sync \
- > $out/bin/github-hosts-sync
+ cp hosts-sync $out/bin/github-hosts-sync
- chmod +x $out/bin/github-hosts-sync
+ sed -i \
+ '1s,$,\nPATH=${path}''${PATH+:$PATH} GIT_SSL_CAINFO=${ca-bundle},' \
+ $out/bin/github-hosts-sync
'';
}
diff --git a/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync
new file mode 100755
index 00000000..a8973e72
--- /dev/null
+++ b/krebs/5pkgs/simple/github-hosts-sync/src/hosts-sync
@@ -0,0 +1,33 @@
+#! /bin/sh
+set -efu
+exec >&2
+
+hosts_srcdir=$GITHUB_HOST_SYNC_SRCDIR
+hosts_worktree=${GITHUB_HOST_SYNC_WORKTREE-/tmp/hosts}
+hosts_url=${GITHUB_HOST_SYNC_URL-git@github.com:krebs/hosts.git}
+user_mail=${GITHUB_HOST_SYNC_USER_MAIL-$LOGNAME@$(hostname)}
+user_name=${GITHUB_HOST_SYNC_USER_NAME-$LOGNAME}
+
+test -d "$hosts_worktree" || git clone "$hosts_url" "$hosts_worktree"
+
+cd "$hosts_worktree"
+
+git pull
+
+rsync \
+ --chmod D755,F644 \
+ --delete-excluded \
+ --filter 'protect .git' \
+ --recursive \
+ --verbose \
+ "$hosts_srcdir/" \
+ .
+
+git add .
+
+if test -n "$(git status --porcelain)"; then
+ git config user.email "$user_mail"
+ git config user.name "$user_name"
+ git commit -m bump
+ git push
+fi
diff --git a/krebs/5pkgs/simple/irc-announce/default.nix b/krebs/5pkgs/simple/irc-announce/default.nix
index e1f4919d..b22e6753 100644
--- a/krebs/5pkgs/simple/irc-announce/default.nix
+++ b/krebs/5pkgs/simple/irc-announce/default.nix
@@ -15,7 +15,7 @@ pkgs.writeDashBin "irc-announce" ''
IRC_SERVER=$1
IRC_PORT=$2
- IRC_NICK=$3$$
+ IRC_NICK=$3_$$
IRC_CHANNEL=$4
message=$5
diff --git a/krebs/5pkgs/simple/kpaste/default.nix b/krebs/5pkgs/simple/kpaste/default.nix
index d6823d58..217cb8a4 100644
--- a/krebs/5pkgs/simple/kpaste/default.nix
+++ b/krebs/5pkgs/simple/kpaste/default.nix
@@ -1,5 +1,6 @@
-{ curl, writeDashBin }:
+{ curl, gnused, writeDashBin }:
writeDashBin "kpaste" ''
- exec ${curl}/bin/curl -sS http://p.r --data-binary @-
+ ${curl}/bin/curl -sS http://p.r --data-binary @- |
+ ${gnused}/bin/sed '$ {p;s/\<r\>/krebsco.de/}'
''
diff --git a/krebs/5pkgs/simple/krebspaste/default.nix b/krebs/5pkgs/simple/krebspaste/default.nix
index a11c8c90..d97b6a05 100644
--- a/krebs/5pkgs/simple/krebspaste/default.nix
+++ b/krebs/5pkgs/simple/krebspaste/default.nix
@@ -1,6 +1,12 @@
-{ writeDashBin, bepasty-client-cli }:
+{ bepasty-client-cli, gnused, writeDashBin }:
-# TODO use `pkgs.exec` instead?
writeDashBin "krebspaste" ''
- exec ${bepasty-client-cli}/bin/bepasty-cli -L 1m --url http://paste.r "$@" | sed '$ s/$/\/+inline/g'
+ ${bepasty-client-cli}/bin/bepasty-cli -L 1m --url http://paste.r "$@" |
+ ${gnused}/bin/sed '
+ $ {
+ s/$/\/+inline/
+ p
+ s/\<r\>/krebsco.de/
+ }
+ '
''
diff --git a/krebs/5pkgs/simple/much/default.nix b/krebs/5pkgs/simple/much/default.nix
deleted file mode 100644
index cf55eb53..00000000
--- a/krebs/5pkgs/simple/much/default.nix
+++ /dev/null
@@ -1,3 +0,0 @@
-{ haskellPackages, ... }:
-
-haskellPackages.callPackage ./cabal.nix {}
diff --git a/krebs/5pkgs/simple/q-power_supply.nix b/krebs/5pkgs/simple/q-power_supply.nix
new file mode 100644
index 00000000..87f90019
--- /dev/null
+++ b/krebs/5pkgs/simple/q-power_supply.nix
@@ -0,0 +1,126 @@
+{ gawk, gnused, writeDashBin }:
+
+writeDashBin "q-power_supply" ''
+ power_supply() {(
+ set -efu
+ uevent=$1
+ eval "$(${gnused}/bin/sed -n '
+ s/^\([A-Z_]\+=[0-9A-Za-z_-]*\)$/export \1/p
+ ' $uevent)"
+ case $POWER_SUPPLY_NAME in
+ AC)
+ exit # not battery
+ ;;
+ esac
+ exec </dev/null
+ exec ${gawk}/bin/awk '
+ function die(s) {
+ printf "%s: %s\n", name, s
+ exit 1
+ }
+
+ function print_hm(h, m) {
+ m = (h - int(h)) * 60
+ return sprintf("%dh%dm", h, m)
+ }
+
+ function print_bar(n, r, t1, t2, t_col) {
+ t1 = int(r * n)
+ t2 = n - t1
+ if (r >= .42) t_col = "1;32"
+ else if (r >= 23) t_col = "1;33"
+ else if (r >= 11) t_col = "1;31"
+ else t_col = "5;1;31"
+ return sgr(t_col) strdup("■", t1) sgr(";30") strdup("■", t2) sgr()
+ }
+
+ function sgr(p) {
+ return "\x1b[" p "m"
+ }
+
+ function strdup(s,n,t) {
+ t = sprintf("%"n"s","")
+ gsub(/ /,s,t)
+ return t
+ }
+
+ END {
+ name = ENVIRON["POWER_SUPPLY_NAME"]
+
+ charge_unit = "Ah"
+ charge_now = ENVIRON["POWER_SUPPLY_CHARGE_NOW"] / 10^6
+ charge_full = ENVIRON["POWER_SUPPLY_CHARGE_FULL"] / 10^6
+
+ current_unit = "A"
+ current_now = ENVIRON["POWER_SUPPLY_CURRENT_NOW"] / 10^6
+
+ energy_unit = "Wh"
+ energy_now = ENVIRON["POWER_SUPPLY_ENERGY_NOW"] / 10^6
+ energy_full = ENVIRON["POWER_SUPPLY_ENERGY_FULL"] / 10^6
+
+ power_unit = "W"
+ power_now = ENVIRON["POWER_SUPPLY_POWER_NOW"] / 10^6
+
+ voltage_unit = "V"
+ voltage_now = ENVIRON["POWER_SUPPLY_VOLTAGE_NOW"] / 10^6
+ voltage_min_design = ENVIRON["POWER_SUPPLY_VOLTAGE_MIN_DESIGN"] / 10^6
+
+ #printf "charge_now: %s\n", charge_now
+ #printf "charge_full: %s\n", charge_full
+ #printf "current_now: %s\n", current_now
+ #printf "energy_now: %s\n", energy_now
+ #printf "energy_full: %s\n", energy_full
+ #printf "energy_full: %s\n", ENVIRON["POWER_SUPPLY_ENERGY_FULL"]
+ #printf "energy_full: %s\n", ENVIRON["POWER_SUPPLY_ENERGY_FULL"] / 10^6
+ #printf "power_now: %s\n", power_now
+ #printf "voltage_now: %s\n", voltage_now
+
+ if (current_now == 0 && voltage_now != 0) {
+ current_now = power_now / voltage_now
+ }
+ if (power_now == 0) {
+ power_now = current_now * voltage_now
+ }
+ if (charge_now == 0 && voltage_min_design != 0) {
+ charge_now = energy_now / voltage_min_design
+ }
+ if (energy_now == 0) {
+ energy_now = charge_now * voltage_min_design
+ }
+ if (charge_full == 0 && voltage_min_design != 0) {
+ charge_full = energy_full / voltage_min_design
+ }
+ if (energy_full == 0) {
+ energy_full = charge_full * voltage_min_design
+ }
+
+ if (charge_now == 0 || charge_full == 0) {
+ die("unknown charge")
+ }
+
+ charge_ratio = charge_now / charge_full
+
+ out = out name
+ out = out sprintf(" %s", print_bar(10, charge_ratio))
+ out = out sprintf(" %d%", charge_ratio * 100)
+ out = out sprintf(" %.2f%s", charge_now, charge_unit)
+ if (current_now != 0) {
+ out = out sprintf("/%.1f%s", current_now, current_unit)
+ }
+ out = out sprintf(" %d%s", energy_full, energy_unit)
+ if (power_now != 0) {
+ out = out sprintf("/%.1f%s", power_now, power_unit)
+ }
+ if (current_now != 0) {
+ out = out sprintf(" %s", print_hm(charge_now / current_now))
+ }
+
+ print out
+ }
+ '
+ )}
+
+ for uevent in /sys/class/power_supply/*/uevent; do
+ power_supply "$uevent" || :
+ done
+''
diff --git a/krebs/5pkgs/simple/qrscan.nix b/krebs/5pkgs/simple/qrscan.nix
new file mode 100644
index 00000000..7d99dcee
--- /dev/null
+++ b/krebs/5pkgs/simple/qrscan.nix
@@ -0,0 +1,27 @@
+{ coreutils, gnused, writeDashBin, zbar }:
+
+writeDashBin "qrscan" ''
+ set -efu
+
+ tmpdir=$(${coreutils}/bin/mktemp --tmpdir -d qrscan.XXXXXXXX)
+ codefile=$tmpdir/code
+
+ cleanup() {
+ ${coreutils}/bin/rm "$codefile"
+ ${coreutils}/bin/rmdir "$tmpdir"
+ }
+
+ ${coreutils}/bin/mkfifo "$codefile"
+
+ ${zbar}/bin/zbarcam > "$codefile" &
+ zbarcampid=$!
+
+ exec < "$codefile"
+ while read -r code; do
+ code=$(printf %s "$code" | ${gnused}/bin/sed -n 's/^QR-Code://p')
+ if test -n "$code"; then
+ ${coreutils}/bin/kill "$zbarcampid"
+ echo "$code"
+ fi
+ done
+''
diff --git a/krebs/5pkgs/simple/reaktor2-plugins.nix b/krebs/5pkgs/simple/reaktor2-plugins.nix
new file mode 100644
index 00000000..48464c0b
--- /dev/null
+++ b/krebs/5pkgs/simple/reaktor2-plugins.nix
@@ -0,0 +1,106 @@
+with import <stockholm/lib>;
+{ lib, pkgs, ... }:
+
+rec {
+ generators = {
+ command_hook = commands: {
+ pattern =
+ "^\\s*([0-9A-Za-z._][0-9A-Z