SELF — the Structured Executable & Linkable Format: a program that is a SQLite database instead of an ELF file, and the machinery to actually run it on Linux/NixOS.
sqlelf (arXiv:2405.03883)
put a SQL view over ELF. This project inverts it: the rows are the format,
a binfmt_misc interpreter executes them, and nixpkgs/NixOS is the vehicle to
run a real slice of a system on it.
$ file hello
hello: SQLite 3.x database, application id 0x53454c46, user version 1
$ ./hello
Hello, world!
$ sqlite3 hello 'SELECT soname FROM ldd' # ldd, as a query
$ sqlite3 hello 'DELETE FROM sections; VACUUM' # strip, as a transaction
$ ./hello # still runs
Hello, world!converter/—elf2self,self2elf, and theselfCLI (Python + LIEF).loader/—self-exec, the binfmt interpreter, with three modes:memfd(rebuild ELF →execveat),native(map segments + hand off to ld.so),selfld(be the dynamic linker, bind via SQL). Pluslibself-audit.so, anLD_AUDITlibrary that makes stock glibc load.selfshared libraries resolved through SQL.nix/— packages, aselfifyhook, a NixOS module (programs.self), andself-vm.schema/self.sql— the format DDL (generated fromselfconv/schema.py).bench/,tests/— the evaluation harness and the M0–M3b test suite.
Read DESIGN.md; §13 tracks implementation status.
$ nix develop # dev shell (converter + loader + tools)
$ nix develop -c bash tests/all.sh # run M0..M3b end to end
$ nix develop -c bash tests/showcase.sh
$ nix run .#self-vm # a NixOS VM where ./hello.self just runs
# (login: root, empty password)