Fil-C on Nix

Filnix wiki

mbrock/filnix

ports/determinate-nix.nix

Determinate Systems' Nix fork (github.com/DeterminateSystems/nix-src), built with Fil-C. Nixpkgs has no package for it, so this instantiates the fork's own component scope (packaging/components.nix, the same structure Nixpkgs vendors for upstream Nix) on top of Nixpkgs' nixDependencies, then applies the Fil-C overrides shared with the upstream Nix port. See docs/determinate-nix.md.

λpkgs, final, nixFilcOverrides
let
13inherit pkgs
lib
14version=
"3.22.5"
used by src
15src=
builtins.fetchTarball
16name=
"determinate-nix-src-${version}"
17url=
"https://github.com/DeterminateSystems/nix-src/archive/v${version}.tar.gz"
18sha256=
"sha256-5rX9rK1y8NpOaYyL+cn1P2O5re+ON2Wpo39J8/LLCXI="
uses version used by scope
20scope=
lib.makeScopefinal.nixDependencies.newScope
import"${src}/packaging/components.nix"
22inherit
lib src
23pkgs=
24officialRelease=
true
25maintainers=
[ ]
uses lib src
in
lib.composeExtensionsnixFilcOverrides
λnfinal nprev

Unity builds compile each library as one translation unit, which serializes the (slow) Fil-C compile.

41withUnityBuild=
false

The fork's libgit2 (a 2.0 pre-release with in-memory config backends, which libfetchers needs), on top of the libgit2 port.

44inherit import"${src}/packaging/dependencies.nix" inputs = { }; pkgs = final; inherit final stdenv; nfinal
libgit2

Wasm support needs wasmtime (Rust with Cranelift's JIT), and crash reporting sentry-native with crashpad; both are off.

54wasmtime=
null

nix-cli enables Sentry unconditionally; its flags are dropped below.

56sentry-native=
final.emptyDirectory
57nix-expr=
nprev.nix-expr.override
58enableGC=
false
59enableWasm=
false
61nix-store=
nprev.nix-store.overrideenableWasm = false;
62nix-cli=
nprev.nix-cli.overridewithMimalloc = false;.overrideAttrs

Fil-C has its own allocator and GC; mimalloc replacing malloc would bypass it.

λold
69buildInputs=
lib.removefinal.emptyDirectory old.buildInputs
70mesonFlags=
mapflag: if flag ≡ "-Dsentry=enabled" then "-Dsentry=disabled" else flag lib.filterflag: ¬lib.hasPrefix"-Dcrashpad-handler=" flag old.mesonFlags

This scope is not spliced, so the enosys wrapper (a seccomp filter, which Fil-C cannot install) would be the Fil-C build.

76nix-util-tests=
nprev.nix-util-tests.overrideutil-linux = final.buildPackages.util-linux;
79nix-functional-tests=
nprev.nix-functional-tests.overrideutil-linux = final.buildPackages.util-linux;.overrideAttrs
λold
84postPatch=
old.postPatch or ""
+
# nixFilcOverrides turns off the sandbox tests. Unlike
# upstream, the fork refuses to build in a diverted store
# without the sandbox instead of silently disabling it, so
# tests that only check for unprivileged user namespaces, or
# nothing at all, need turning off too.
substituteInPlace common/functions.sh --replace-fail \
'unprivilegedUserNamespacesSupported() {' \
'unprivilegedUserNamespacesSupported() { return 1;'
# shell.sh ends by building in a diverted store, unguarded.
sed -i '/^path=\$(nix eval --raw -f shell-hello.nix hello)$/,$d' shell.sh
if grep -q 'store "$TEST_ROOT/store0"' shell.sh; then exit 1; fi

The functional tests again, with every evaluation multi-threaded (and builtins.parallel available). Not part of nix-everything.

100nix-functional-tests-parallel=
nfinal.nix-functional-tests.overrideAttrs
λold
103pname=
"nix-functional-tests-parallel"

Expected differences with eval-cores > 1: the depth at which the evaluator reports stack overflow moves by one frame, and the debugger warns that it turns multi-threading off.

107postPatch=
old.postPatch
+
rm lang/eval-fail-derivation-structuredAttrs-stack-overflow.* \
lang/eval-fail-toJSON-stack-overflow.*
rm repl/debugger-*.in
112_NIX_TEST_EXTRA_CONFIG=
${old._NIX_TEST_EXTRA_CONFIG or ""}
eval-cores = 8
extra-experimental-features = parallel-eval

And with lazy trees, as the fork's CI runs them.

119nix-functional-tests-lazy-trees=
nfinal.nix-functional-tests.override
120pname=
"nix-functional-tests-lazy-trees"
121lazyTrees=
true

Boehm GC is only referenced to collect its debug output.

124nix-everything=
nprev.nix-everything.overrideboehmgc = final.emptyDirectory;