!UUYziobKGGxpovWyAN:nixos.org

Robotnix

241 Members
Build Android (AOSP) using Nix | https://github.com/nix-community/robotnix76 Servers

Load older messages


SenderMessageTime
11 Apr 2026
@atemu12:matrix.orgAtemuAnd sandbox creation isn't something you can optimise that much further AFAIK10:12:17
@atemu12:matrix.orgAtemu(Ah, referring to per-file drvs here.)10:13:05
@magic_rb:matrix.redalder.orgmagic_rbIf we could reuse the sandbox, as in cleaning out the build directory ought to be quick, we wouldnt have to set up a new sandbox from scratch10:16:34
@magic_rb:matrix.redalder.orgmagic_rbBut idk10:16:38
@jaen:matrix.orgjaenYeah, what I was currently "doing" (or rather forcing Claude to do it for me - not going to say sorry for it, the only way I could reliably progress the PoCs between executive dysfunction and $DAY_JOB) and while it works well enough at the scale of Nix, at scale of Chromium and AOSP it buckles under itself in two different ways and the fixes seem to be in opposition to each other - having bigger chunks (so you rebuild more if something changes) vs. nesting more (so you pay more overhead, because you have more derivations). Now that I will hopefully be paid to do this full time, maybe I'll just find something the LLM was too dumb to chance upon.10:41:57
@jaen:matrix.orgjaenNaively this goes with "bigger chunks" so you need to rebuild more on cache miss, I think. At least I couldn't side-step that so far. Alternatively, bazel seems to have a concept of persistent worker processes (https://bazel.build/remote/persistent), at worst maybe Nix could get something like that?10:43:57
@magic_rb:matrix.redalder.orgmagic_rbi mean not neccessarily10:44:15
@magic_rb:matrix.redalder.orgmagic_rbyou can clean the sandbox, but not throw it away10:44:21
@magic_rb:matrix.redalder.orgmagic_rbif you kno youll be building 500 derivations you setup one sandbox and build everything in that sandbox with separate build directories. If i were to guess what takes the most time, its setting up the filesystem tree, but you can do that once with the union of all the closures.10:45:13
@magic_rb:matrix.redalder.orgmagic_rbEven if you end up having to setup separate pidnss or netnss it shouldnt be that slow10:50:26
@atemu12:matrix.orgAtemuYou also have to mount store paths and I'm sure there are lots of relatively expensive steps necessary to ensure hermecity10:55:33
@jaen:matrix.orgjaenI mean sure, but not with Nix as-is. I would assume those Bazel persistent workers are more less what you're talking about10:55:49
@atemu12:matrix.orgAtemuAs I said, I tested this with a real nix-daemon a while ago and it did not scale10:56:12
@atemu12:matrix.orgAtemuI'm sure there are things you can do to make sandbox setups more efficient but not by that large of a perf gap10:57:02
@atemu12:matrix.orgAtemuBut feel free to reproduce the experiment10:57:24
@jaen:matrix.orgjaenI guess we'll see. Even if it's slower, then having to build less on cache just would be a win10:57:30
@jaen:matrix.orgjaen * 10:57:40
@atemu12:matrix.orgAtemuIIRC it was slow enough where even that was not a given10:58:19
@atemu12:matrix.orgAtemuI could see whether I still have the snippet to generate the stub drvs10:58:47
@magic_rb:matrix.redalder.orgmagic_rbRight exactly what i meant, as jaen said what im describing are probably bazel persistent workers. If we could skip the store path setup because we do it once for all of the robotnix derivations, that would make things faster10:58:49
@atemu12:matrix.orgAtemuI also think that module-level granularity is honestly good enough10:59:46
@jaen:matrix.orgjaenWould appreciate, I do have something already, but comparing notes would be helpful, maybe I missed something obvious when I was paying it only part of my mind10:59:54
@atemu12:matrix.orgAtemuMost modules are stuff like basic OSS libs that do not change at all11:00:27
@jaen:matrix.orgjaen For sure, granularity can just be one of the tuning knobs to use to find what is the most efficient 11:01:45
@atemu12:matrix.orgAtemuI don't know how many inter-dependencies there are between android-specific components. Somethin, in me makes me think it might not even be that much.11:02:13
@magic_rb:matrix.redalder.orgmagic_rbI do want to point out, how robotnix is the most accessible way to build android tbh. Like, building it manually is something ive never managed, not that i tried that much11:04:39
@atemu12:matrix.orgAtemu
{
  total ? 200000,
  random ? "foo",
  sleep ? 0,
  pkgs ? import <nixpkgs> { },
  lib ? pkgs.lib,
}:
let
  drvs = builtins.genList (
    n: pkgs.runCommand "${random}-${toString n}" { } "sleep ${toString sleep} ; echo ${toString n} > $out"
  ) total;
  list = lib.concatLines drvs;
in

pkgs.writeText "${toString total}" list
11:07:18
@atemu12:matrix.orgAtemu
{
  total ? 200000,
  random ? "foo",
  sleep ? 0,
  pkgs ? import <nixpkgs> { },
  lib ? pkgs.lib,
}:
let
  drvs = builtins.genList (
    n: pkgs.runCommand "${random}-${toString n}" { } "sleep ${toString sleep} ; echo ${toString n} > $out"
  ) total;
  list = lib.concatLines drvs;
in

pkgs.writeText "${toString total}" list
11:07:25
@atemu12:matrix.orgAtemuCurrently running with 10000 and it's still going..11:07:50
@atemu12:matrix.orgAtemu Yeah, so running sleep 10000 times took 8min and I doubt that scales <linearly. At that point, it'd be faster to just build; especially given that real compiler invocations take quite a bit longer than sleep 0 11:58:30

There are no newer messages yet.


Back to Room ListRoom Version: 6