2015-10-20 22:08:18 +00:00
|
|
|
{ lib, pkgs, ... }:
|
2015-08-28 19:43:16 +00:00
|
|
|
|
2015-10-20 22:08:18 +00:00
|
|
|
with lib;
|
2015-10-14 23:59:40 +00:00
|
|
|
let
|
|
|
|
subdirs = mapAttrs (_: flip pkgs.callPackage {}) (subdirsOf ./.);
|
|
|
|
pkgs' = pkgs // subdirs;
|
|
|
|
in
|
|
|
|
|
|
|
|
subdirs // rec {
|
2015-08-28 19:31:59 +00:00
|
|
|
|
2015-10-17 03:50:58 +00:00
|
|
|
haskellPackages = pkgs.haskellPackages.override {
|
|
|
|
overrides = self: super:
|
|
|
|
mapAttrs (name: path: self.callPackage path {})
|
|
|
|
(mapAttrs'
|
|
|
|
(name: type:
|
|
|
|
if hasSuffix ".nix" name
|
|
|
|
then {
|
|
|
|
name = removeSuffix ".nix" name;
|
|
|
|
value = ./haskell-overrides + "/${name}";
|
|
|
|
}
|
|
|
|
else null)
|
|
|
|
(builtins.readDir ./haskell-overrides));
|
|
|
|
};
|
|
|
|
|
2015-10-15 00:00:32 +00:00
|
|
|
push = pkgs'.callPackage ./push {
|
|
|
|
inherit (subdirs) get jq;
|
|
|
|
};
|
|
|
|
|
2015-12-24 23:04:52 +00:00
|
|
|
ReaktorPlugins = pkgs.callPackage ./Reaktor/plugins.nix {};
|
|
|
|
|
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-12-23 10:18:00 +00:00
|
|
|
test = {
|
|
|
|
infest-cac-centos7 = pkgs.callPackage ./test/infest-cac-centos7 {};
|
|
|
|
};
|
|
|
|
|
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-10-17 04:17:42 +00:00
|
|
|
PATH=${makeSearchPath "bin" (with pkgs; [
|
2015-08-28 19:31:59 +00:00
|
|
|
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-10-25 01:32:19 +00:00
|
|
|
|
2016-02-07 04:32:03 +00:00
|
|
|
writeDash = name: text: pkgs.writeScript name ''
|
|
|
|
#! ${pkgs.dash}/bin/dash
|
|
|
|
${text}
|
|
|
|
'';
|
|
|
|
|
|
|
|
writeDashBin = name: text: pkgs.writeTextFile {
|
|
|
|
executable = true;
|
|
|
|
destination = "/bin/${name}";
|
|
|
|
name = name;
|
|
|
|
text = ''
|
|
|
|
#! ${pkgs.dash}/bin/dash
|
|
|
|
${text}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2015-10-25 01:32:19 +00:00
|
|
|
writeNixFromCabal = name: path: pkgs.runCommand name {} ''
|
|
|
|
${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
|
|
|
|
'';
|
2015-07-24 10:03:51 +00:00
|
|
|
}
|