summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/5pkgs/default.nix')
-rw-r--r--krebs/5pkgs/default.nix60
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"
+ '';
}