summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/bling/default.nix
diff options
context:
space:
mode:
authorlassulus <lass@lassul.us>2017-06-20 16:05:27 +0200
committerlassulus <lass@lassul.us>2017-06-20 16:05:27 +0200
commitf0bcc6e1f147726cbbf8c3d8a9da503886d2321d (patch)
treebf8e0eabe03a8dcf9201c580ab1f4ecc4660b8b4 /krebs/5pkgs/simple/bling/default.nix
parentbda14221cf46003ecf76756a5db7422c70737c85 (diff)
parent57c6b890f9088bb333eeab215ecfeca9d09ce3ef (diff)
Merge remote-tracking branch 'ni/master' into HEAD
Diffstat (limited to 'krebs/5pkgs/simple/bling/default.nix')
-rw-r--r--krebs/5pkgs/simple/bling/default.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/bling/default.nix b/krebs/5pkgs/simple/bling/default.nix
new file mode 100644
index 000000000..8d6207f65
--- /dev/null
+++ b/krebs/5pkgs/simple/bling/default.nix
@@ -0,0 +1,56 @@
+{ imagemagick, runCommand, ... }:
+
+with import <stockholm/lib>;
+
+let
+ krebs-v2 = [
+ " "
+ " "
+ " x x x x"
+ "xx x xx xx xx x"
+ "xx x xx xx xx x"
+ " xxx x x xxx"
+ " xxx xxxxx xxx"
+ " x xxxxxxx x "
+ " xxxxxxxxxxxxx "
+ " xxxxxxx "
+ " xxxxxxxxxxx "
+ " x xxx x "
+ " x x x x x x "
+ " x x x x x x "
+ " x xx x x xx x "
+ " "
+ ];
+
+ chars-per-pixel = 1;
+ colors = 2;
+ columns = foldl' max 0 (map stringLength krebs-v2);
+ rows = length krebs-v2;
+
+ png-geometry = "1692x1692";
+
+ txt = concatMapStrings (s: "${s}\n") krebs-v2;
+
+ xpm = ''
+ static char *krebs_v2[] = {
+ ${toC (toString [columns rows colors chars-per-pixel])},
+ " c None",
+ "x c #E4002B",
+ ${concatMapStringsSep ",\n " toC krebs-v2}
+ };
+ '';
+in
+
+runCommand "bling"
+ {
+ inherit xpm;
+ passAsFile = ["xpm"];
+ }
+ ''
+ mkdir -p $out
+ cd $out
+
+ cp $xpmPath krebs-v2.xpm
+ ${imagemagick}/bin/convert krebs-v2.xpm krebs-v2.ico
+ ${imagemagick}/bin/convert krebs-v2.xpm -scale ${png-geometry} krebs-v2.png
+ ''