stockholm/krebs/5pkgs/default.nix
tv 22a171f3e0 krebs pkgs += charybdis lentil much
While there, put everything into subdirectories.
2015-08-29 00:36:50 +02:00

52 lines
1.4 KiB
Nix

{ lib, pkgs, ... }:
with import ../4lib { inherit lib; };
let
inherit (pkgs) callPackage;
in
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 {};
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"
'';
}