summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--krebs/5pkgs/default.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index c8fb1d2d7..406bd15eb 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -1,11 +1,13 @@
{ lib, pkgs, ... }:
+with import ../4lib { inherit lib; };
+
let
inherit (pkgs) callPackage;
in
pkgs //
-{
+rec {
cac = callPackage ./cac.nix {};
dic = callPackage ./dic.nix {};
genid = callPackage ./genid.nix {};
@@ -15,6 +17,20 @@ pkgs //
nq = callPackage ./nq.nix {};
posix-array = callPackage ./posix-array.nix {};
+ execve = name: { filename, argv, envp }:
+ writeC name {} ''
+ #include <unistd.h>
+ int main () {
+ const char *filename = ${toC filename};
+ char *const argv[] = ${toC (argv ++ [null])};
+ char *const envp[] = ${toC (
+ mapAttrsToList (k: v: "${k}=${v}") envp ++ [null]
+ )};
+ execve(filename, argv, envp);
+ return -1;
+ }
+ '';
+
writeC = name: {}: src: pkgs.runCommand name {} ''
PATH=${lib.makeSearchPath "bin" (with pkgs; [
binutils