ports/default.nix
Fil-C Ports DSL and Overlay Infrastructure
This file provides:
1. The DSL for defining ports (pin, patch, configure, etc.)
2. The overlay-making machinery that converts port lists to overlays
The state we transform through the pipeline
Compose two attribute transformers
State transformers
Core primitives
Pin a specific version and hash
Automatically substitutes version in the existing URL
Usage: pin "2.1.12" "sha256-..."
Get the original URL and replace old version with new version This handles most common URL patterns automatically
Replace old version with new version in URL
Try multiple patterns: x.y.z, x.y, x_y_z, etc.
Full source override (for when pin doesn't work)
Usage: src "2.1.12" "sha256-..." (v: "https://.../${v}.tar.gz")
Extract pname from package
Build a port with automatic pname extraction
Usage: for pkgs.coreutils [skipCheck]
for "flask" [skipCheck] (for Python/sub-overlays)
For explicit names: { bash = for pkgs.bash [...]; }
Common helpers reason parameter is for documentation only - doesn't affect the build
Mark as broken for Fil-C with a reason
Only sets broken/badPlatforms when actually cross-compiling to Fil-C
Mark packages as memory-safe when built with Fil-C
Removes knownVulnerabilities since memory safety eliminates whole classes of bugs
AST-based code rewriting using ast-grep
Usage: astRewrite "file.c" "c" "pattern with $VAR" "replacement with $VAR" Patterns use ast-grep syntax: $VAR for single node, $$$VAR for multiple nodes
URL helpers
DSL functions to export
Create an overlay from a list of port specs
Each item in portList is either:
- A port spec: { pname, attrs, overrideArgs, ... }
- An attrset with explicit names: { foo = <port-spec>; bar = <port-spec>; }Convert list to flat attrset keyed by pname
Handles both direct specs and attrset-wrapped specs
Apply each spec to the corresponding package in prev
Emacs package sets using our ported emacs30
Python aliases - python312 is explicitly named, provides both python3 and python312
Perl package set using our ported perl
Nixpkgs' default moved to Ruby 3.4 (YJIT needs a Rust target); keep the ported 3.3, as the default was before.
Nixpkgs only defines glibc locales for isGnu hosts, so for Fil-C glibcLocales was null and packages that export LC_ALL=en_US.UTF-8 got no LOCALE_ARCHIVE (typeguard's sphinx-build died in setlocale). The archive is data: the native build works for both the build tools and Fil-C's glibc, which reads it via LOCALE_ARCHIVE too.
pkg-config alias
Re-call defaultGemConfig with final packages so gems get Fil-C dependencies This ensures ffi gem gets final.libffi (Fil-C version), not pkgs.libffi