diff options
author | lassulus <lass@aidsballs.de> | 2015-09-05 12:17:59 +0200 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2015-09-05 12:17:59 +0200 |
commit | f54a0a9ea7fd5a9902a5b38786da42f06d615b5a (patch) | |
tree | d7c475b212d8acc35a5dc7d20ec1f2228c664010 /krebs/5pkgs/default.nix | |
parent | f3c1727659c59ff638b1adead8e30ee2f79f39de (diff) | |
parent | d6d9956abc60548c755d30e6a5bd13c10abbb181 (diff) |
Merge branch 'makefu'
Diffstat (limited to 'krebs/5pkgs/default.nix')
-rw-r--r-- | krebs/5pkgs/default.nix | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix index 2454c19c8..39d3d69ce 100644 --- a/krebs/5pkgs/default.nix +++ b/krebs/5pkgs/default.nix @@ -1,18 +1,54 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: + +with import ../4lib { inherit lib; }; let inherit (pkgs) callPackage; in -pkgs // -{ - cac = callPackage ./cac.nix {}; - dic = callPackage ./dic.nix {}; - genid = callPackage ./genid.nix {}; - github-hosts-sync = callPackage ./github-hosts-sync.nix {}; - github-known_hosts = callPackage ./github-known_hosts.nix {}; - hashPassword = callPackage ./hashPassword.nix {}; - nq = callPackage ./nq.nix {}; - posix-array = callPackage ./posix-array.nix {}; - youtube-tools = callPackage ./youtube-tools.nix {}; +rec { + cac = callPackage ./cac {}; + charybdis = callPackage ./charybdis {}; + dic = callPackage ./dic {}; + genid = callPackage ./genid {}; + github-hosts-sync = callPackage ./github-hosts-sync {}; + github-known_hosts = callPackage ./github-known_hosts {}; + hashPassword = callPackage ./hashPassword {}; + krebszones = callPackage ./krebszones {}; + lentil = callPackage ./lentil {}; + much = callPackage ./much {}; + nq = callPackage ./nq {}; + posix-array = callPackage ./posix-array {}; + pssh = callPackage ./pssh {}; + Reaktor = callPackage ./Reaktor {}; + youtube-tools = callPackage ./youtube-tools {}; + + execve = name: { filename, argv, envp ? {}, destination ? "" }: + writeC name { inherit destination; } '' + #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; + } + ''; + + execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; }); + + writeC = name: { destination ? "" }: src: pkgs.runCommand name {} '' + PATH=${lib.makeSearchPath "bin" (with pkgs; [ + binutils + coreutils + gcc + ])} + src=${pkgs.writeText "${name}.c" src} + exe=$out${destination} + mkdir -p "$(dirname "$exe")" + gcc -O -Wall -o "$exe" $src + strip --strip-unneeded "$exe" + ''; } |