From 097307c46fc5a7bda63a5916cfd1ee3ad661a0a6 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Wed, 25 Jul 2018 03:11:41 +0200 Subject: pkgs/profpatsch: WIP execline experiments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * runExecline: like runCommand, but a lot more lightweight * symlink: symlink a given list of links together * importer: a small DSL to “import” “modules” into a build context Some highlights: * runExecline does not use any stdenv (apart from the `execline` build) * symlink uses netstrings to pass correct fields into the derivation * no use of bash, everything uses execline. --- pkgs/profpatsch/default.nix | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'pkgs/profpatsch/default.nix') diff --git a/pkgs/profpatsch/default.nix b/pkgs/profpatsch/default.nix index 2fcd7c40..f14eb61c 100644 --- a/pkgs/profpatsch/default.nix +++ b/pkgs/profpatsch/default.nix @@ -1,21 +1,24 @@ -{ pkgs, callPackage, haskellPackages, droopy, fetchFromGitHub }: +{ stdenv, pkgs }: -{ +let + inherit (pkgs) callPackage; + +in rec { backlight = callPackage ./backlight { inherit (pkgs.xorg) xbacklight; }; display-infos = callPackage ./display-infos {}; nix-http-serve = callPackage ./nix-http-serve {}; nman = callPackage ./nman {}; show-qr-code = callPackage ./show-qr-code {}; warpspeed = callPackage ./warpspeed { - inherit (haskellPackages) ghcWithPackages; + inherit (pkgs.haskellPackages) ghcWithPackages; }; inherit (callPackage ./utils-hs {}) nix-gen until watch-server; # patched version of droopy, with javascript user-enhancement - droopy = droopy.overrideDerivation (old: { - src = fetchFromGitHub { + droopy = pkgs.droopy.overrideDerivation (old: { + src = pkgs.fetchFromGitHub { owner = "Profpatsch"; repo = "Droopy"; rev = "55c60c612b913f9fbce9fceebbcb3a332152f1a4"; @@ -28,6 +31,32 @@ makeWrapperArgs = old.makeWrapperArgs or [] ++ [ "--set DROOPY_STATIC \"$out/share/droopy/static\"" ]; - }); + + # 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 = import ./execline/run-execline.nix { + inherit stdenv; + execlinebCommand = "${execlineb-with-builtins}/bin/execlineb"; + importasCommand = "${pkgs.execline}/bin/importas"; + }; + + symlink = pkgs.callPackage ./execline/symlink.nix { + inherit runExecline; + }; + + importer = pkgs.callPackage ./execline/importer.nix { + inherit symlink; + }; + } -- cgit 1.4.1