From a7e754f48da6b56b7a7f0e59911afa2b5424b06c Mon Sep 17 00:00:00 2001 From: yukkop Date: Wed, 19 Mar 2025 01:44:19 +0000 Subject: [PATCH] feat: min C writer --- flake.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/flake.nix b/flake.nix index c09406c..a243f07 100644 --- a/flake.nix +++ b/flake.nix @@ -309,9 +309,20 @@ ${prev.gcc}/bin/gcc -xc -o $out $contentPath ''; } name argsOrScript; + writeMinC = + name: includes: body: + writeC name '' + ${builtins.concatStringsSep "\n" (map (h: "#include " + h) includes)} + + int main(int argc, char *argv[]) { + ${body} + } + ''; in prev.writers // { writeCBin = name: writeC "/bin/${name}"; writeC = writeC; + writeMinCBin = name: includes: body: writeMinC "/bin/${name}" includes body; + writeMinC = writeMinC; }; postgresql_15 = prev.postgresql_15 // {pkgs = prev.postgresql_15.pkgs // { http = buildHttpExt "15";