about summary refs log tree commit diff
path: root/pkgs/profpatsch/default.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2018-09-21 22:03:41 +0200
committerProfpatsch <mail@profpatsch.de>2018-09-21 22:05:44 +0200
commit21762297a4072b5a25f2d528d5839633fa396133 (patch)
tree11e21fea8cd63bc84aef3d2053cbde0f1826950d /pkgs/profpatsch/default.nix
parentf8af37905d4202bc5b5e312fa30ae5b49bf057c7 (diff)
More execline experiments & testing
Improves the “execline experience” and adds some basic tests.
The idea is that the final result doesn’t use coreutils and provides a
feasible alternative to bash-based tooling.
Diffstat (limited to 'pkgs/profpatsch/default.nix')
-rw-r--r--pkgs/profpatsch/default.nix59
1 files changed, 44 insertions, 15 deletions
diff --git a/pkgs/profpatsch/default.nix b/pkgs/profpatsch/default.nix
index f14eb61c..5477b83a 100644
--- a/pkgs/profpatsch/default.nix
+++ b/pkgs/profpatsch/default.nix
@@ -3,6 +3,31 @@
 let
   inherit (pkgs) callPackage;
 
+  # wrapper for execlineb that doesn’t need the execline commands
+  # in PATH to work (making them appear like “builtins”)
+  execlineb-with-builtins =
+    let eldir = "${pkgs.execline}/bin";
+    in pkgs.writeScriptBin "execlineb" ''
+      #!${eldir}/execlineb -s0
+      ${eldir}/define eldir ${eldir}
+      ''${eldir}/importas oldpath PATH
+      ''${eldir}/export PATH "''${eldir}:''${oldpath}"
+      ''${eldir}/execlineb $@
+    '';
+
+  # TODO: use imports!
+  execlinebCommand = "${execlineb-with-builtins}/bin/execlineb";
+  redirfdCommand = "${pkgs.execline}/bin/redirfd";
+  importasCommand = "${pkgs.execline}/bin/importas";
+  s6TouchCommand = "${pkgs.s6-portable-utils}/bin/s6-touch";
+  s6EchoCommand = "${pkgs.s6-portable-utils}/bin/s6-echo";
+  ifCommand = "${pkgs.execline}/bin/if";
+  s6GrepCommand = "${pkgs.s6-portable-utils}/bin/s6-grep";
+  s6CatCommand = "${pkgs.s6-portable-utils}/bin/s6-cat";
+  s6TestCommand = "${pkgs.s6-portable-utils}/bin/s6-test";
+  s6ChmodCommand = "${pkgs.s6-portable-utils}/bin/s6-chmod";
+  execCommand = "${pkgs.execline}/bin/exec";
+
 in rec {
   backlight = callPackage ./backlight { inherit (pkgs.xorg) xbacklight; };
   display-infos = callPackage ./display-infos {};
@@ -33,22 +58,26 @@ in rec {
     ];
   });
 
-  # wrapper for execlineb that doesn’t need the execline commands
-  # in PATH to work (making them appear like “builtins”)
-  execlineb-with-builtins =
-    let eldir = "${pkgs.execline}/bin";
-    in pkgs.writeScriptBin "execlineb" ''
-      #!${eldir}/execlineb -s0
-      ${eldir}/define eldir ${eldir}
-      ''${eldir}/importas oldpath PATH
-      ''${eldir}/export PATH "''${eldir}:''${oldpath}"
-      ''${eldir}/execlineb $@
-    '';
+  runExecline =
+    # todo: factor out calling tests
+    let
+      it = import ./execline/run-execline.nix {
+        inherit stdenv execlinebCommand redirfdCommand
+          importasCommand execCommand;
+      };
+      tests = import ./execline/run-execline-tests.nix {
+        runExecline = it;
+        inherit (testing) drvSeqL;
+        inherit (pkgs) coreutils;
+        inherit stdenv ifCommand redirfdCommand s6CatCommand
+          s6GrepCommand importasCommand s6TouchCommand
+          s6TestCommand execlinebCommand s6ChmodCommand;
+       };
+    in tests;
+
 
-  runExecline = import ./execline/run-execline.nix {
-    inherit stdenv;
-    execlinebCommand = "${execlineb-with-builtins}/bin/execlineb";
-    importasCommand = "${pkgs.execline}/bin/importas";
+  testing = pkgs.callPackage ./testing {
+    inherit runExecline s6TouchCommand s6EchoCommand;
   };
 
   symlink = pkgs.callPackage ./execline/symlink.nix {