diff options
Diffstat (limited to 'pkgs/profpatsch/default.nix')
-rw-r--r-- | pkgs/profpatsch/default.nix | 71 |
1 files changed, 55 insertions, 16 deletions
diff --git a/pkgs/profpatsch/default.nix b/pkgs/profpatsch/default.nix index f14eb61c..692820e6 100644 --- a/pkgs/profpatsch/default.nix +++ b/pkgs/profpatsch/default.nix @@ -1,8 +1,35 @@ -{ stdenv, pkgs }: +{ stdenv, lib, pkgs }: 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 $@ + ''; + + # Takes a derivation and a list of binary names + # and returns an attribute set of `name -> path`. + # The list can also contain renames in the form of + # { use, as }, which goes `as -> usePath`. + bins = drv: xs: + let f = x: + # TODO: typecheck + let x' = if builtins.isString x then { use = x; as = x; } else x; + in { + name = x'.as; + value = "${lib.getBin drv}/bin/${x'.use}"; + }; + in builtins.listToAttrs (builtins.map f xs); + + in rec { backlight = callPackage ./backlight { inherit (pkgs.xorg) xbacklight; }; display-infos = callPackage ./display-infos {}; @@ -33,22 +60,34 @@ 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 { + bin = (bins execlineb-with-builtins [ "execlineb" ]) + // (bins pkgs.execline [ "redirfd" "importas" "exec" ]); + inherit stdenv; + }; + tests = import ./execline/run-execline-tests.nix { + runExecline = it; + inherit (testing) drvSeqL; + inherit (pkgs) coreutils; + inherit stdenv; + bin = (bins execlineb-with-builtins [ "execlineb" ]) + // (bins pkgs.execline [ + { use = "if"; as = "execlineIf"; } + "redirfd" "importas" + ]) + // (bins pkgs.s6PortableUtils + [ "s6-cat" "s6-grep" "s6-touch" "s6-test" "s6-chmod" ]); + }; + in tests; + - runExecline = import ./execline/run-execline.nix { - inherit stdenv; - execlinebCommand = "${execlineb-with-builtins}/bin/execlineb"; - importasCommand = "${pkgs.execline}/bin/importas"; + testing = import ./testing { + inherit stdenv lib runExecline; + inherit (pkgs) runCommand; + bin = bins pkgs.s6PortableUtils [ "s6-touch" "s6-echo" ]; }; symlink = pkgs.callPackage ./execline/symlink.nix { |