a0852ff479
Reads the to-build derivation DAG from Nix (derivation show -r + --dry-run), applies a heuristic/history build-cost model with Amdahl core-scaling, and computes critical-path / peak-concurrency / list-scheduled makespan across a node×core grid to recommend a remote-builder shape. - schedule.py: pure critical-path, peak-concurrency, p-machine list scheduler - costmodel.py: heuristic table + --history override + core re-weighting - graph.py: DAG extraction via nix - estimate.py/cli.py: sweep + knee recommendation + report - tests: scheduler validated on toy DAGs (all pass) Prior-art gap documented (Hubble, nixbuild.net) in README.
36 lines
1.1 KiB
Nix
36 lines
1.1 KiB
Nix
{
|
||
description = "nix-estimator — best builder configuration (nodes × cores) for a Nix build";
|
||
|
||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||
|
||
outputs = { self, nixpkgs }:
|
||
let
|
||
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
|
||
forAll = f: nixpkgs.lib.genAttrs systems (s: f nixpkgs.legacyPackages.${s});
|
||
in
|
||
{
|
||
packages = forAll (pkgs: {
|
||
default = pkgs.python3Packages.buildPythonApplication {
|
||
pname = "nix-estimator";
|
||
version = "0.1.0";
|
||
pyproject = true;
|
||
src = ./.;
|
||
build-system = [ pkgs.python3Packages.hatchling ];
|
||
# runtime needs `nix` on PATH to introspect derivations
|
||
makeWrapperArgs = [ "--prefix" "PATH" ":" "${pkgs.nix}/bin" ];
|
||
nativeCheckInputs = [ pkgs.python3Packages.pytest ];
|
||
checkPhase = "pytest";
|
||
};
|
||
});
|
||
|
||
devShells = forAll (pkgs: {
|
||
default = pkgs.mkShell {
|
||
packages = [
|
||
(pkgs.python3.withPackages (ps: [ ps.pytest ]))
|
||
pkgs.nix
|
||
];
|
||
};
|
||
});
|
||
};
|
||
}
|