summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-08-31 10:47:29 +0200
committermakefu <github@syntax-fehler.de>2015-08-31 10:47:29 +0200
commit2eb8bcf9d1c293a8b28730c9a12d9a857c5a43a7 (patch)
treec8a1d55a148e59f51a400e0d5dc11780d4e4005c /krebs/5pkgs/default.nix
parent0acd7f23e1e3adf4bf1427f186a7bf5505ff910d (diff)
parent83f06535de527c7470f8ff9c8b5e3a4632cf7cb9 (diff)
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'krebs/5pkgs/default.nix')
-rw-r--r--krebs/5pkgs/default.nix56
1 files changed, 46 insertions, 10 deletions
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index 89872f1eb..500d5fe25 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -1,16 +1,52 @@
-{ 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 {};
- posix-array = callPackage ./posix-array.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 {};
+ lentil = callPackage ./lentil {};
+ much = callPackage ./much {};
+ nq = callPackage ./nq {};
+ posix-array = callPackage ./posix-array {};
+ pssh = callPackage ./pssh {};
+ 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"
+ '';
}