summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/default.nix9
-rw-r--r--krebs/5pkgs/haskell/brockman/default.nix4
-rw-r--r--krebs/5pkgs/haskell/default.nix10
-rw-r--r--krebs/5pkgs/haskell/desktop-pager.nix24
-rw-r--r--krebs/5pkgs/haskell/email-header.nix4
-rw-r--r--krebs/5pkgs/haskell/flameshot-once.nix20
-rw-r--r--krebs/5pkgs/haskell/mailaids.nix10
-rw-r--r--krebs/5pkgs/haskell/much.nix8
-rw-r--r--krebs/5pkgs/haskell/nix-serve-ng.nix30
-rw-r--r--krebs/5pkgs/haskell/pager.nix23
-rw-r--r--krebs/5pkgs/haskell/purebred-email/default.nix16
-rw-r--r--krebs/5pkgs/override/default.nix14
-rw-r--r--krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch35
-rw-r--r--krebs/5pkgs/simple/K_belwagen.nix2
-rwxr-xr-xkrebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh2
-rw-r--r--krebs/5pkgs/simple/brain/default.nix12
-rw-r--r--krebs/5pkgs/simple/cac-api/default.nix4
-rw-r--r--krebs/5pkgs/simple/certaids.nix109
-rw-r--r--krebs/5pkgs/simple/cunicu.nix22
-rw-r--r--krebs/5pkgs/simple/dic/default.nix4
-rw-r--r--krebs/5pkgs/simple/ergo/default.nix23
-rw-r--r--krebs/5pkgs/simple/flameshot-once/config.nix416
-rw-r--r--krebs/5pkgs/simple/flameshot-once/default.nix161
-rw-r--r--krebs/5pkgs/simple/flameshot-once/flameshot/default.nix16
-rw-r--r--krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch28
-rw-r--r--krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch43
-rw-r--r--krebs/5pkgs/simple/flameshot-once/profile.nix235
-rw-r--r--krebs/5pkgs/simple/fzfmenu/default.nix13
-rw-r--r--krebs/5pkgs/simple/generate-secrets/default.nix3
-rw-r--r--krebs/5pkgs/simple/git-assembler.nix24
-rw-r--r--krebs/5pkgs/simple/hashPassword/default.nix2
-rw-r--r--krebs/5pkgs/simple/htgen-cyberlocker/default.nix2
-rw-r--r--krebs/5pkgs/simple/htgen-imgur/default.nix6
-rw-r--r--krebs/5pkgs/simple/htgen-imgur/src/htgen-imgur2
-rw-r--r--krebs/5pkgs/simple/htgen-paste/default.nix27
-rw-r--r--krebs/5pkgs/simple/htgen-paste/src/htgen-paste78
-rw-r--r--krebs/5pkgs/simple/htgen/default.nix7
-rw-r--r--krebs/5pkgs/simple/irc-announce/default.nix2
-rw-r--r--krebs/5pkgs/simple/ircaids/default.nix4
-rw-r--r--krebs/5pkgs/simple/kpaste/default.nix3
-rw-r--r--krebs/5pkgs/simple/krebs-pages/fixtures/index.html21
-rw-r--r--krebs/5pkgs/simple/krebs-pages/fixtures/thesauron.html133
-rw-r--r--krebs/5pkgs/simple/krebszones/default.nix13
-rw-r--r--krebs/5pkgs/simple/netcup/default.nix2
-rw-r--r--krebs/5pkgs/simple/nix-prefetch-github.nix25
-rw-r--r--krebs/5pkgs/simple/nixos-format-error.nix107
-rw-r--r--krebs/5pkgs/simple/ovh-zone/default.nix1
-rw-r--r--krebs/5pkgs/simple/pager.nix64
-rw-r--r--krebs/5pkgs/simple/passwdqc-utils/default.nix11
-rw-r--r--krebs/5pkgs/simple/q-power_supply.nix48
-rw-r--r--krebs/5pkgs/simple/reaktor2-plugins.nix18
-rw-r--r--krebs/5pkgs/simple/realwallpaper/default.nix18
-rw-r--r--krebs/5pkgs/simple/realwallpaper/get_constellations.py29
-rw-r--r--krebs/5pkgs/simple/renew-krebs-intermediate-ca/default.nix30
-rw-r--r--krebs/5pkgs/simple/stable-generate/default.nix32
-rw-r--r--krebs/5pkgs/simple/stable-interrogate/default.nix30
-rw-r--r--krebs/5pkgs/simple/syncthing-device-id.nix5
-rw-r--r--krebs/5pkgs/simple/ukrepl.nix11
-rw-r--r--krebs/5pkgs/simple/vicuna-chat/default.nix33
-rw-r--r--krebs/5pkgs/simple/weechat-declarative/default.nix5
-rw-r--r--krebs/5pkgs/simple/withGetopt.nix4
-rw-r--r--krebs/5pkgs/simple/xwaitforwindow.nix15
62 files changed, 1395 insertions, 717 deletions
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index f9ed6439..866796a4 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -1,8 +1,11 @@
-let
- stockholm.lib = import ../../lib;
+self: super: let
+ stockholm = {
+ lib = import ../../lib/pure.nix { lib = super.lib; };
+ outPath = toString ../.;
+ };
in
with stockholm.lib;
-self: super:
+
fix (foldl' (flip extends) (self: super) (
[
(self: super: { inherit stockholm; })
diff --git a/krebs/5pkgs/haskell/brockman/default.nix b/krebs/5pkgs/haskell/brockman/default.nix
index 6a0c7f9d..a902b5fb 100644
--- a/krebs/5pkgs/haskell/brockman/default.nix
+++ b/krebs/5pkgs/haskell/brockman/default.nix
@@ -7,12 +7,12 @@
}:
mkDerivation rec {
pname = "brockman";
- version = "4.0.4";
+ version = "5.1.1";
src = fetchFromGitHub {
owner = "kmein";
repo = "brockman";
rev = version;
- sha256 = "sha256-GOEEUjehFgMMf6cNpi0AP/Rz74sTDEcpKRbLD+6YEz0=";
+ sha256 = "sha256-5/2Xjh6YqV3+kkQr8CiXay9Dd8IAnL8D4dc8afnlki4=";
};
isLibrary = false;
isExecutable = true;
diff --git a/krebs/5pkgs/haskell/default.nix b/krebs/5pkgs/haskell/default.nix
index 98cbcb3b..7e9ee752 100644
--- a/krebs/5pkgs/haskell/default.nix
+++ b/krebs/5pkgs/haskell/default.nix
@@ -8,11 +8,13 @@ in
haskell = super.haskell // {
packages = mapAttrs (name: value:
if hasAttr "override" value
- then value.override { inherit overrides; }
+ then value.override (old: {
+ overrides = composeExtensions (old.overrides or (_: _: {})) overrides;
+ })
else value
) super.haskell.packages;
};
- haskellPackages = super.haskellPackages.override {
- inherit overrides;
- };
+ haskellPackages = super.haskellPackages.override (old: {
+ overrides = composeExtensions (old.overrides or (_: _: {})) overrides;
+ });
}
diff --git a/krebs/5pkgs/haskell/desktop-pager.nix b/krebs/5pkgs/haskell/desktop-pager.nix
new file mode 100644
index 00000000..1a4f94db
--- /dev/null
+++ b/krebs/5pkgs/haskell/desktop-pager.nix
@@ -0,0 +1,24 @@
+{ mkDerivation, aeson, base, blessings, bytestring, containers
+, data-default, extra, fetchgit, hack, lib, optparse-applicative
+, probability, scanner, speculate, split, terminal-size, text, unix
+, utf8-string, X11
+}:
+mkDerivation {
+ pname = "desktop-pager";
+ version = "1.0.0";
+ src = fetchgit {
+ url = "https://cgit.krebsco.de/pager";
+ sha256 = "07wjlhnb27vfhkqq5vhi768mlrcpwl4b2yfk04v3lw047q6pmby0";
+ rev = "dfa3ff346d22d332ffbadd46963f1cc5cb2a4939";
+ fetchSubmodules = true;
+ };
+ isLibrary = true;
+ isExecutable = true;
+ libraryHaskellDepends = [ base extra utf8-string X11 ];
+ executableHaskellDepends = [
+ aeson base blessings bytestring containers data-default hack
+ optparse-applicative probability scanner speculate split
+ terminal-size text unix X11
+ ];
+ license = lib.licenses.mit;
+}
diff --git a/krebs/5pkgs/haskell/email-header.nix b/krebs/5pkgs/haskell/email-header.nix
index e1e9d423..f8ce03f3 100644
--- a/krebs/5pkgs/haskell/email-header.nix
+++ b/krebs/5pkgs/haskell/email-header.nix
@@ -18,9 +18,9 @@ let
sha256 = "11xjivpj495r2ss9aqljnpzzycb57cm4sr7yzmf939rzwsd3ib0x";
};
}.${versions.majorMinor version} or {
- version = "0.4.1-tv2";
+ version = "0.4.2-tv1";
rev = "refs/tags/v${cfg.version}";
- sha256 = "1yg4b5318lpviwgjs4kdcqg8cwfnxxfcdckcjq12r2nnj2k4ms2d";
+ sha256 = "JZfqvkbb/1t0q1iWmZHmmCN2Vr+QKTiq4LVncrG+xMU=";
};
in mkDerivation {
diff --git a/krebs/5pkgs/haskell/flameshot-once.nix b/krebs/5pkgs/haskell/flameshot-once.nix
deleted file mode 100644
index c8007ce9..00000000
--- a/krebs/5pkgs/haskell/flameshot-once.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ mkDerivation, async, base, blessings, bytestring, dbus, fetchgit
-, iso8601-time, lib, process, random, text, time, unagi-chan, unix
-}:
-mkDerivation {
- pname = "flameshot-once";
- version = "1.4.0";
- src = fetchgit {
- url = "https://cgit.krebsco.de/flameshot-once";
- sha256 = "13szgsiwn29aixm5xvs1m7128y5km5xss0ry5ii5y068rc2vysw8";
- rev = "4475893c2081b3d9db4b7a54d0ce38d0914a17bf";
- fetchSubmodules = true;
- };
- isLibrary = false;
- isExecutable = true;
- executableHaskellDepends = [
- async base blessings bytestring dbus iso8601-time process random
- text time unagi-chan unix
- ];
- license = lib.licenses.mit;
-}
diff --git a/krebs/5pkgs/haskell/mailaids.nix b/krebs/5pkgs/haskell/mailaids.nix
index f152a76f..91b4cc45 100644
--- a/krebs/5pkgs/haskell/mailaids.nix
+++ b/krebs/5pkgs/haskell/mailaids.nix
@@ -1,14 +1,14 @@
{ mkDerivation, aeson, aeson-pretty, base, bytestring
-, case-insensitive, fetchgit, lens, optparse-applicative
-, purebred-email, lib, text, vector, word8
+, case-insensitive, fetchgit, lens, lib, optparse-applicative
+, purebred-email, text, vector, word8
}:
mkDerivation {
pname = "mailaids";
- version = "1.0.0";
+ version = "1.1.0";
src = fetchgit {
url = "https://cgit.krebsco.de/mailaids";
- sha256 = "15h0k82czm89gkwhp1rwdy77jz8dmb626qdz7c2narvz9j7169v5";
- rev = "8f11927ea74d6adb332c884502ebd9c486837523";
+ sha256 = "0mkq3b0j28h7ydg6aaqlqnvajb8nhdc9g7rmil2d4vl5fxxaqspv";
+ rev = "a25fc32eceefc10a91ef77ff2763b3f1b9324aaf";
fetchSubmodules = true;
};
isLibrary = false;
diff --git a/krebs/5pkgs/haskell/much.nix b/krebs/5pkgs/haskell/much.nix
index 5045465e..865294da 100644
--- a/krebs/5pkgs/haskell/much.nix
+++ b/krebs/5pkgs/haskell/much.nix
@@ -7,13 +7,13 @@
, servant-server, split, terminal-size, text, time, transformers
, transformers-compat, unix, vector, wai, warp
}:
-mkDerivation {
+mkDerivation rec {
pname = "much";
- version = "1.3.1";
+ version = "1.3.2";
src = fetchgit {
url = "https://cgit.krebsco.de/much";
- sha256 = "0gwyhqcvg9ywna8fhb9hnx97qh5inglj3l0pcwkgwcvm27mfpcqa";
- rev = "77357335a3a88a4b93f91a46ab939a1a9b192977";
+ hash = "sha256-q65EYO1d3NYVv2NECkGWPb1TyHGdARNi/GX4pgQmljc=";
+ rev = "refs/tags/${version}";
fetchSubmodules = true;
};
isLibrary = true;
diff --git a/krebs/5pkgs/haskell/nix-serve-ng.nix b/krebs/5pkgs/haskell/nix-serve-ng.nix
new file mode 100644
index 00000000..62e02ce8
--- /dev/null
+++ b/krebs/5pkgs/haskell/nix-serve-ng.nix
@@ -0,0 +1,30 @@
+{ mkDerivation, async, base, base16, base32, bytestring, charset
+, fetchgit, http-client, http-types, lib, managed, megaparsec, mtl
+, network, nix, optparse-applicative, tasty-bench, temporary, text
+, turtle, vector, wai, wai-extra, warp, warp-tls
+, boost
+}:
+mkDerivation {
+ pname = "nix-serve-ng";
+ version = "1.0.1";
+ src = fetchgit {
+ url = "https://github.com/aristanetworks/nix-serve-ng";
+ sha256 = "sha256-PkzwtjUgYuqfWtCH1nRqVRaajihN1SqMVjWmoSG/CCY=";
+ rev = "9b546864f4090736f3f9069a01ea5d42cf7bab7c";
+ fetchSubmodules = true;
+ };
+ isLibrary = false;
+ isExecutable = true;
+ executableHaskellDepends = [
+ base base16 base32 bytestring charset http-types managed megaparsec
+ mtl network optparse-applicative vector wai wai-extra warp warp-tls
+ ];
+ executablePkgconfigDepends = [ nix ];
+ executableSystemDepends = [ boost.dev ];
+ benchmarkHaskellDepends = [
+ async base bytestring http-client tasty-bench temporary text turtle
+ vector
+ ];
+ description = "A drop-in replacement for nix-serve that's faster and more stable";
+ license = lib.licenses.bsd3;
+}
diff --git a/krebs/5pkgs/haskell/pager.nix b/krebs/5pkgs/haskell/pager.nix
deleted file mode 100644
index 2f4a71f3..00000000
--- a/krebs/5pkgs/haskell/pager.nix
+++ /dev/null
@@ -1,23 +0,0 @@
-{ mkDerivation, base, blessings, bytestring, containers
-, data-default, hack, lib, optparse-applicative, probability
-, scanner, speculate, split, terminal-size, text, unix, X11
-, fetchgit
-}:
-mkDerivation {
- pname = "pager";
- version = "1.0.0";
- src = fetchgit {
- url = "https://cgit.krebsco.de/pager";
- sha256 = "1qlkhqidaa6w02ix9ambfdsm7lfyx30ap481b9ic1ppyfkhqzfp6";
- rev = "fc6105a5e7d1e3a07bf07ea85e7902dd8e9fc849";
- fetchSubmodules = true;
- };
- isLibrary = false;
- isExecutable = true;
- executableHaskellDepends = [
- base blessings bytestring containers data-default hack
- optparse-applicative probability scanner speculate split
- terminal-size text unix X11
- ];
- license = lib.licenses.mit;
-}
diff --git a/krebs/5pkgs/haskell/purebred-email/default.nix b/krebs/5pkgs/haskell/purebred-email/default.nix
index ebf31538..62fc8218 100644
--- a/krebs/5pkgs/haskell/purebred-email/default.nix
+++ b/krebs/5pkgs/haskell/purebred-email/default.nix
@@ -1,31 +1,27 @@
{ mkDerivation, attoparsec, base, base64-bytestring, bytestring
, case-insensitive, concise, deepseq, fetchgit, hedgehog, lens, lib
-, QuickCheck, quickcheck-instances, semigroupoids, semigroups
+, QuickCheck, quickcheck-instances, random, semigroupoids
, stringsearch, tasty, tasty-golden, tasty-hedgehog, tasty-hunit
, tasty-quickcheck, text, time
}:
mkDerivation {
pname = "purebred-email";
- version = "0.4.3";
+ version = "0.5.1";
src = fetchgit {
url = "https://github.com/purebred-mua/purebred-email";
- sha256 = "06xhccavrdzfsvg65mzdnp0a7b1ilk2rqpnyvkr171ir6mqdpb19";
- rev = "769b360643f699c0a8cd6f1c3a3de36cf0479834";
+ sha256 = "0iilyy5dkbzbiazyyfjdz585c3x8b7c2piynmycm7krkc48993vw";
+ rev = "7ba346e10ad1521a923bc04a4ffeca479d8dd071";
fetchSubmodules = true;
};
- patches = [
- ./untweak-mime-version-header.patch
- ];
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
attoparsec base base64-bytestring bytestring case-insensitive
- concise deepseq lens semigroupoids semigroups stringsearch text
- time
+ concise deepseq lens random semigroupoids stringsearch text time
];
testHaskellDepends = [
attoparsec base bytestring case-insensitive hedgehog lens
- QuickCheck quickcheck-instances semigroups tasty tasty-golden
+ QuickCheck quickcheck-instances random tasty tasty-golden
tasty-hedgehog tasty-hunit tasty-quickcheck text time
];
homepage = "https://github.com/purebred-mua/purebred-email";
diff --git a/krebs/5pkgs/override/default.nix b/krebs/5pkgs/override/default.nix
index ae42bc1a..f85f3f67 100644
--- a/krebs/5pkgs/override/default.nix
+++ b/krebs/5pkgs/override/default.nix
@@ -9,20 +9,6 @@ self: super: {
};
});
- flameshot = super.flameshot.overrideAttrs (old: rec {
- name = "flameshot-${version}";
- version = "0.10.2";
- src = self.fetchFromGitHub {
- owner = "flameshot-org";
- repo = "flameshot";
- rev = "v${version}";
- sha256 = "sha256-rZUiaS32C77tFJmEkw/9MGbVTVscb6LOCyWaWO5FyR4=";
- };
- patches = old.patches or [] ++ [
- ./flameshot/flameshot_imgur_0.10.2.patch
- ];
- });
-
# https://github.com/proot-me/PRoot/issues/106
proot = self.writeDashBin "proot" ''
export PROOT_NO_SECCOMP=1
diff --git a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch b/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch
deleted file mode 100644
index c4c0bf38..00000000
--- a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- a/src/tools/imgur/imguruploader.cpp
-+++ b/src/tools/imgur/imguruploader.cpp
-@@ -31,6 +31,7 @@
- #include <QTimer>
- #include <QUrlQuery>
- #include <QVBoxLayout>
-+#include <stdlib.h>
-
- ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent)
- : QWidget(parent)
-@@ -79,8 +80,11 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
- m_imageURL.setUrl(data[QStringLiteral("link")].toString());
-
- auto deleteToken = data[QStringLiteral("deletehash")].toString();
-+ char *deleteImageURLPattern = secure_getenv("IMGUR_DELETE_URL");
-+ if (deleteImageURLPattern == NULL)
-+ deleteImageURLPattern = "https://imgur.com/delete/%1";
- m_deleteImageURL.setUrl(
-- QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken));
-+ QString::fromUtf8(deleteImageURLPattern).arg(deleteToken));
-
- // save history
- QString imageName = m_imageURL.toString();
-@@ -133,7 +137,10 @@ void ImgurUploader::upload()
- QString description = FileNameHandler().parsedPattern();
- urlQuery.addQueryItem(QStringLiteral("description"), description);
-
-- QUrl url(QStringLiteral("https://api.imgur.com/3/image"));
-+ char *createImageURLPattern = secure_getenv("IMGUR_CREATE_URL");
-+ if (createImageURLPattern == NULL)
-+ createImageURLPattern = "https://api.imgur.com/3/image";
-+ QUrl url(QString::fromUtf8(createImageURLPattern));
- url.setQuery(urlQuery);
- QNetworkRequest request(url);
- request.setHeader(QNetworkRequest::ContentTypeHeader,
diff --git a/krebs/5pkgs/simple/K_belwagen.nix b/krebs/5pkgs/simple/K_belwagen.nix
index 80d377b0..2f64bb09 100644
--- a/krebs/5pkgs/simple/K_belwagen.nix
+++ b/krebs/5pkgs/simple/K_belwagen.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
buildInputs = [
pkgs.jack1
- pkgs.pkgconfig
+ pkgs.pkg-config
];
patchPhase = ''
diff --git a/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh b/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh
index c21dc877..6978e38c 100755
--- a/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh
+++ b/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh
@@ -1,7 +1,7 @@
#! /bin/sh
set -euf
-# require flock from util-linux (pkgs.utillinux)
+# require flock from util-linux (pkgs.util-linux)
if test "${FLOCK-}" != "$state_file"; then
exec env FLOCK="$state_file" flock "$state_file" "$0" "$@"
fi
diff --git a/krebs/5pkgs/simple/brain/default.nix b/krebs/5pkgs/simple/brain/default.nix
index 9b125862..bf52da75 100644
--- a/krebs/5pkgs/simple/brain/default.nix
+++ b/krebs/5pkgs/simple/brain/default.nix
@@ -1,4 +1,4 @@
-{ pass, write, writeDash, ... }:
+{ pass, runCommand, write, writeDash, ... }:
write "brain" {
"/bin/brain".link = writeDash "brain" ''
@@ -9,4 +9,14 @@ write "brain" {
PASSWORD_STORE_DIR=$HOME/brain \
exec ${pass}/bin/passmenu $@
'';
+ "/share/bash-completion/completions/brain".link =
+ runCommand "brain-completions" {
+ } /* sh */ ''
+ sed -r '
+ s/\<_pass?(_|\>)/_brain\1/g
+ s/\<__password_store/_brain/g
+ s/\<pass\>/brain/
+ s/\$HOME\/\.password-store/$HOME\/brain/
+ ' < ${pass}/share/bash-completion/completions/pass > $out
+ '';
}
diff --git a/krebs/5pkgs/simple/cac-api/default.nix b/krebs/5pkgs/simple/cac-api/default.nix
index 5f37f668..59cd36cd 100644
--- a/krebs/5pkgs/simple/cac-api/default.nix
+++ b/krebs/5pkgs/simple/cac-api/default.nix
@@ -1,5 +1,5 @@
{ fetchgit, lib, stdenv
-, bc, cac-cert, coreutils, curl, dash, gnugrep, gnused, inotifyTools, jq, ncurses, openssh, sshpass
+, bc, cac-cert, coreutils, curl, dash, gnugrep, gnused, inotify-tools, jq, ncurses, openssh, sshpass
}:
stdenv.mkDerivation {
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
curl
gnugrep
gnused
- inotifyTools
+ inotify-tools
jq
ncurses
openssh
diff --git a/krebs/5pkgs/simple/certaids.nix b/krebs/5pkgs/simple/certaids.nix
new file mode 100644
index 00000000..34f4c3e1
--- /dev/null
+++ b/krebs/5pkgs/simple/certaids.nix
@@ -0,0 +1,109 @@
+{ pkgs }:
+
+pkgs.write "certaids" {
+ "/bin/cert2json".link = pkgs.writeDash "cert2json" ''
+ # usage: cert2json < CERT > JSON
+ set -efu
+
+ ${pkgs.openssl}/bin/openssl crl2pkcs7 -nocrl -certfile /dev/stdin |
+ ${pkgs.openssl}/bin/openssl pkcs7 -print_certs -text |
+ ${pkgs.gawk}/bin/awk -F, -f ${pkgs.writeText "cert2json.awk" ''
+ function abort(msg) {
+ print(msg) > "/dev/stderr"
+ exit 1
+ }
+
+ function toJSON(x, type, ret) {
+ type = typeof(x)
+ switch (type) {
+ case "array":
+ if (isArray(x)) return arrayToJSON(x)
+ if (isObject(x)) return objectToJSON(x)
+ abort("cannot render array to JSON", x)
+ case "number":
+ return numberToJSON(x)
+ case "string":
+ return stringToJSON(x)
+ case "strnum":
+ case "unassigned":
+ case "regexp":
+ case "untyped":
+ default:
+ abort("cannot render type: " type)
+ }
+ }
+
+ function isArray(x, i, k) {
+ i = 1
+ for (k in x) {
+ if (k != i++) return 0
+ i++
+ }
+ return 1
+ }
+
+ function isObject(x, k) {
+ for (k in x) {
+ if (typeof(k) != "string") return 0
+ }
+ return 1
+ }
+
+ function arrayToJSON(x, k, ret) {
+ ret = "["
+ for (k in x) {
+ ret=ret toJSON(x[k]) ","
+ }
+ sub(/,$/,"",ret)
+ ret=ret "]"
+ return ret
+ }
+
+ function objectToJSON(x, k,ret) {
+ ret = "{"
+ for (k in x) {
+ ret = ret toJSON(k) ":" toJSON(x[k]) ","
+ }
+ sub(/,$/, "", ret)
+ ret = ret "}"
+ return ret
+ }
+
+ function numberToJSON(x) {
+ return x
+ }
+
+ function stringToJSON(x) {
+ gsub(/\\/, "&&",x)
+ gsub(/\n/, "\\n", x)
+ return "\"" x "\""
+ }
+
+ $1 ~ /^ *(Subject|Issuer):/ {
+ sub(/^ */, "")
+ sub(/: */, ",")
+ key=tolower($1)
+ sub(/[^,]*,/, "")
+
+ # Normalize separators between relative distinguished names.
+ # [1]: RFC2253, 3. Parsing a String back to a Distinguished Name
+ # TODO support any distinguished name
+ gsub(/ *[;,] */, ",")
+
+ for(i = 0; i <= NF; i++) {
+ split($i, a, "=")
+ cache[key][a[1]] = a[2]
+ }
+ }
+
+ /BEGIN CERTIFICATE/,/END CERTIFICATE/{
+ cache["certificate"] = cache["certificate"] $0 "\n"
+ }
+
+ /END CERTIFICATE/{
+ print toJSON(cache)
+ delete cache
+ }
+ ''}
+ '';
+}
diff --git a/krebs/5pkgs/simple/cunicu.nix b/krebs/5pkgs/simple/cunicu.nix
new file mode 100644
index 00000000..4375a760
--- /dev/null
+++ b/