Fil-C on Nix

Filnix wiki

mbrock/filnix

build-filc.nix

Build the complete Fil-C compiler with all dependencies

λpkgs, filc0, sources?
pkgs
filc0
sourcesdefault import./lib/sources.nix inherit pkgs;
let

Build yolo-glibc (no compiler needed)

10yolo=
import./runtime/yolo-glibc.nix inherit pkgs sources;

Build compiler-rt (CRT files and builtins, uses host compiler)

13compiler-rt=
import./runtime/compiler-rt.nix inherit pkgs sources;.compiler-rt

Build yolounwind (stub unwind library, uses host compiler)

17yolounwind=
import./runtime/yolounwind.nix inherit pkgs sources;.yolounwind

Base filc compiler (overridable)

21filc=
pkgs.lib.makeOverridableimport./compiler/filc.nix inherit pkgs sources filc0 yolo compiler-rt yolounwind;

LLVM JIT shim, for pins that have the JIT

33llvmjit=
sources.llvmjit-src ≢ null
→
36inherit
pkgs filc0
37src=
sources.llvmjit-src
else
null

Build libpizlo

43libpizlo=
import./runtime/libpizlo.nix inherit pkgs sources filc compiler-rt llvmjit;.libpizlo

Build filc-glibc

55filc-glibc=
import./runtime/filc-glibc.nix inherit pkgs sources libpizlo; filc = filc.overrideinherit libpizlo;;.filc-glibc

Build libcxx

62filc-libcxx=
import./compiler/libcxx.nix inherit pkgs sources filc-glibc; filc = filc.overrideinherit libpizlo; filc-libc = filc-glibc;;.filc-libcxx

Final compiler with everything

72filc-complete=
filc.override
73inherit
libpizlo filc-libcxx
74filc-libc=
in
filc-complete.overrideAttrs

Use passthru to expose metadata without making them build dependencies

λold
80passthru=
old.passthru or { }
//
81inherit
sources

Expose build components as attributes (metadata only!)

83inherit yolo
yolo-glibc yolo-glibc-impl
84inherit
libpizlo filc-libcxx filc0 llvmjit
90inherit
compiler-rt yolounwind

Expose libc with generic name

93filc-libc=

Also expose with specific name for direct access

96inherit
filc-glibc

Fil-C headers

99filc-stdfil-headers=
"${libpizlo}/include"