From 6cd157f0133bcd074ff947f3e5397f0e8cdc2830 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sun, 8 Dec 2019 15:06:59 +0100 Subject: machines/profpatsch,pkgs/profpatsch: rm `execlineb-with-builtins` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has been upstreamed to nixpkgs proper, as a C wrapper script, in https://github.com/NixOS/nixpkgs/pull/71357 So we don’t even need bash to run execline anymore :P --- machines/profpatsch/pkgs.nix | 11 --------- machines/profpatsch/shiki.nix | 2 +- pkgs/profpatsch/default.nix | 35 ++++------------------------- pkgs/profpatsch/execline/write-execline.nix | 4 ++-- 4 files changed, 7 insertions(+), 45 deletions(-) diff --git a/machines/profpatsch/pkgs.nix b/machines/profpatsch/pkgs.nix index 80e73829..df60fb62 100644 --- a/machines/profpatsch/pkgs.nix +++ b/machines/profpatsch/pkgs.nix @@ -102,16 +102,6 @@ let --replace 'notify-send' '${notify-send}' ''; - # 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}/importas oldpath PATH - env PATH=${eldir}:''${oldpath} ${eldir}/execlineb $@ - ''; - dhall-flycheck = pkgs.vuizvui.profpatsch.haskellPackages.callPackage (import "${pkgs.fetchFromGitHub { owner = "Profpatsch"; @@ -133,7 +123,6 @@ in saneGhci /*searx*/ pyrnotify - execlineb-with-builtins dhall-flycheck ; } diff --git a/machines/profpatsch/shiki.nix b/machines/profpatsch/shiki.nix index c51bab2c..9a80001f 100644 --- a/machines/profpatsch/shiki.nix +++ b/machines/profpatsch/shiki.nix @@ -176,7 +176,7 @@ in { # pkgs.vuizvui.profpatsch.nix-gen # generate nix expressions pkgs.vuizvui.profpatsch.watch-server # restart server on code change pkgs.vuizvui.profpatsch.until # restart until cmd succeeds - myPkgs.execlineb-with-builtins + execline dhall myPkgs.dhall-flycheck ]; diff --git a/pkgs/profpatsch/default.nix b/pkgs/profpatsch/default.nix index d973b63e..f484c2ad 100644 --- a/pkgs/profpatsch/default.nix +++ b/pkgs/profpatsch/default.nix @@ -3,32 +3,6 @@ let inherit (pkgs) callPackage; - # wrapper for execlineb that doesn’t need the execline commands - # in PATH to work (making them appear like “builtins”) - # TODO: upstream into nixpkgs - # TODO: the grep could be nicer - execlineb-with-builtins = - let eldir = "${pkgs.execline}/bin"; - in pkgs.writeScriptBin "execlineb" '' - #!${eldir}/execlineb -s0 - # appends the execlineb bin dir to PATH if not yet in PATH - ${eldir}/define eldir ${eldir} - ''${eldir}/ifelse - { - # since this is nix, we can grep for the execline drv hash in PATH - # to see whether it’s already in there - ''${eldir}/pipeline - { ${pkgs.coreutils}/bin/printenv PATH } - ${pkgs.gnugrep}/bin/grep --quiet "${eldir}" - } - # it’s there already - { ''${eldir}/execlineb $@ } - # not there yet, add it - ''${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 @@ -65,8 +39,7 @@ let # todo: factor out calling tests let it = import ./execline/run-execline.nix { - bin = (getBins execlineb-with-builtins [ "execlineb" ]) - // (getBins pkgs.execline [ "redirfd" "importas" "exec" ]); + bin = getBins pkgs.execline [ "execlineb" "redirfd" "importas" "exec" ]; inherit stdenv lib; }; itLocal = name: args: execline: @@ -85,8 +58,8 @@ let inherit (testing) drvSeqL; inherit (pkgs) coreutils; inherit stdenv; - bin = (getBins execlineb-with-builtins [ "execlineb" ]) - // (getBins pkgs.execline [ + bin = (getBins pkgs.execline [ + "execlineb" { use = "if"; as = "execlineIf"; } "redirfd" "importas" ]) @@ -100,7 +73,7 @@ let }; writeExeclineFns = import ./execline/write-execline.nix { - inherit pkgs execlineb-with-builtins; + inherit pkgs; }; diff --git a/pkgs/profpatsch/execline/write-execline.nix b/pkgs/profpatsch/execline/write-execline.nix index c2128ea3..f83aa2ed 100644 --- a/pkgs/profpatsch/execline/write-execline.nix +++ b/pkgs/profpatsch/execline/write-execline.nix @@ -1,4 +1,4 @@ -{ pkgs, execlineb-with-builtins }: +{ pkgs }: let escape = import ./escape.nix { inherit (pkgs) lib; }; @@ -6,7 +6,7 @@ let # Everything is escaped correctly. # TODO upstream into nixpkgs writeExeclineCommon = writer: name: { readNArgs ? 0 }: argList: writer name '' - #!${execlineb-with-builtins}/bin/execlineb -Ws${toString readNArgs} + #!${pkgs.execline}/bin/execlineb -Ws${toString readNArgs} ${escape.escapeExecline argList} ''; writeExecline = writeExeclineCommon pkgs.writeScript; -- cgit 1.4.1