diff options
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/4lib/default.nix | 6 | ||||
-rw-r--r-- | krebs/5pkgs/default.nix | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index 8b587dfb2..ca7219c7e 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -16,4 +16,10 @@ builtins // lib // rec { listset = import ./listset.nix { inherit lib; }; shell = import ./shell.nix { inherit lib; }; tree = import ./tree.nix { inherit lib; }; + + toC = x: { + list = "{ ${concatStringsSep ", " (map toC x)} }"; + null = "NULL"; + string = toJSON x; # close enough + }.${typeOf x}; } diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix index 2149b6f10..c8fb1d2d7 100644 --- a/krebs/5pkgs/default.nix +++ b/krebs/5pkgs/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: let inherit (pkgs) callPackage; @@ -14,4 +14,15 @@ pkgs // hashPassword = callPackage ./hashPassword.nix {}; nq = callPackage ./nq.nix {}; posix-array = callPackage ./posix-array.nix {}; + + writeC = name: {}: src: pkgs.runCommand name {} '' + PATH=${lib.makeSearchPath "bin" (with pkgs; [ + binutils + coreutils + gcc + ])} + in=${pkgs.writeText "${name}.c" src} + gcc -O -Wall -o $out $in + strip --strip-unneeded $out + ''; } |