stockholm/krebs/5pkgs/default.nix

56 lines
1.6 KiB
Nix
Raw Normal View History

2015-08-28 19:31:59 +00:00
{ lib, pkgs, ... }:
2015-07-24 10:03:51 +00:00
2015-08-28 19:43:16 +00:00
with import ../4lib { inherit lib; };
2015-07-24 10:03:51 +00:00
let
inherit (pkgs) callPackage;
in
2015-08-28 19:43:16 +00:00
rec {
cac = callPackage ./cac {};
charybdis = callPackage ./charybdis {};
dic = callPackage ./dic {};
genid = callPackage ./genid {};
2015-09-25 20:56:28 +00:00
get = callPackage ./get {};
github-hosts-sync = callPackage ./github-hosts-sync {};
github-known_hosts = callPackage ./github-known_hosts {};
hashPassword = callPackage ./hashPassword {};
2015-09-01 10:53:32 +00:00
krebszones = callPackage ./krebszones {};
lentil = callPackage ./lentil {};
much = callPackage ./much {};
nq = callPackage ./nq {};
posix-array = callPackage ./posix-array {};
2015-08-29 06:29:35 +00:00
pssh = callPackage ./pssh {};
2015-08-31 12:22:21 +00:00
Reaktor = callPackage ./Reaktor {};
youtube-tools = callPackage ./youtube-tools {};
2015-08-28 19:31:59 +00:00
2015-08-28 20:13:17 +00:00
execve = name: { filename, argv, envp ? {}, destination ? "" }:
writeC name { inherit destination; } ''
2015-08-28 19:43:16 +00:00
#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;
}
'';
2015-08-28 20:13:17 +00:00
execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; });
writeC = name: { destination ? "" }: src: pkgs.runCommand name {} ''
2015-08-28 19:31:59 +00:00
PATH=${lib.makeSearchPath "bin" (with pkgs; [
binutils
coreutils
gcc
])}
2015-08-28 20:13:17 +00:00
src=${pkgs.writeText "${name}.c" src}
exe=$out${destination}
mkdir -p "$(dirname "$exe")"
gcc -O -Wall -o "$exe" $src
strip --strip-unneeded "$exe"
2015-08-28 19:31:59 +00:00
'';
2015-07-24 10:03:51 +00:00
}