share the flake's pkgs in host module-eval fixtures
Each `hive` fixture imported its own nixpkgs. Pass the flake's pkgs through nixpkgs.pkgs with nixpkgs' read-only module instead. On module-eval-swarm-services-switch this drops nixpkgs instances from 52 to 23 and eval max RSS from 4.83 GiB to 3.28 GiB, with the same drvPath. Agent fixtures keep their own nixpkgs: agent-modules sets nixpkgs.config.allowUnfreePredicate, which a shared pkgs can't take.
This commit is contained in:
parent
9a3153cb08
commit
04cffe7957
1 changed files with 7 additions and 1 deletions
|
|
@ -37,11 +37,17 @@ let
|
||||||
# Stub host, same shape ./docs/default.nix already uses: enough for a
|
# Stub host, same shape ./docs/default.nix already uses: enough for a
|
||||||
# `nixosSystem` to evaluate, nothing that pulls a real disk or
|
# `nixosSystem` to evaluate, nothing that pulls a real disk or
|
||||||
# bootloader in.
|
# bootloader in.
|
||||||
|
#
|
||||||
|
# Every host fixture reuses the flake's `pkgs` rather than importing its own
|
||||||
|
# nixpkgs. `read-only.nix` makes any host module that defines top-level
|
||||||
|
# `nixpkgs.config`/`overlays`/`hostPlatform` fail the fixture's eval instead
|
||||||
|
# of being ignored.
|
||||||
hive =
|
hive =
|
||||||
extra:
|
extra:
|
||||||
(nixosSystem {
|
(nixosSystem {
|
||||||
system = pkgs.stdenv.hostPlatform.system;
|
|
||||||
modules = [
|
modules = [
|
||||||
|
(pkgs.path + "/nixos/modules/misc/nixpkgs/read-only.nix")
|
||||||
|
{ nixpkgs.pkgs = pkgs; }
|
||||||
self.nixosModules.default
|
self.nixosModules.default
|
||||||
{
|
{
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue