2023-08-07 14:50:27 +03:00
|
|
|
{dream2nixSource ? ../..}: let
|
|
|
|
dream2nix = import dream2nixSource;
|
|
|
|
nixpkgs = import dream2nix.inputs.nixpkgs {};
|
|
|
|
lib = nixpkgs.lib;
|
|
|
|
|
|
|
|
_callModule = module:
|
|
|
|
nixpkgs.lib.evalModules {
|
|
|
|
specialArgs.dream2nix = dream2nix;
|
|
|
|
specialArgs.packageSets.nixpkgs = nixpkgs;
|
2023-08-31 16:03:07 +03:00
|
|
|
modules = [module dream2nix.modules.dream2nix.core];
|
2023-08-07 14:50:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
# like callPackage for modules
|
|
|
|
callModule = module: (_callModule module).config.public;
|
|
|
|
|
|
|
|
numPkgs = lib.toInt (builtins.getEnv "NUM_PKGS");
|
2023-08-09 01:44:34 +03:00
|
|
|
numVars = lib.toInt (builtins.getEnv "NUM_VARS");
|
2023-08-07 14:50:27 +03:00
|
|
|
|
|
|
|
pkg-funcs = lib.genAttrs (map toString (lib.range 0 numPkgs)) (
|
|
|
|
num:
|
2023-08-09 01:44:34 +03:00
|
|
|
derivation (
|
|
|
|
{
|
|
|
|
name = "hello-${num}";
|
|
|
|
version = "2.12.1";
|
|
|
|
system = "x86_64-linux";
|
|
|
|
builder = "/bin/sh";
|
|
|
|
args = ["sh" "-c" "echo hello-${num} > $out"];
|
|
|
|
}
|
|
|
|
# generate env variables
|
|
|
|
// (
|
|
|
|
lib.genAttrs (map toString (lib.range 0 numVars)) (
|
|
|
|
num: "value-${num}"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2023-08-07 14:50:27 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
modules = lib.genAttrs (map toString (lib.range 0 numPkgs)) (
|
|
|
|
num:
|
|
|
|
callModule {
|
|
|
|
imports = [
|
2023-08-31 16:03:07 +03:00
|
|
|
dream2nix.modules.dream2nix.builtins-derivation
|
2023-08-07 14:50:27 +03:00
|
|
|
];
|
|
|
|
name = "hello-${num}";
|
|
|
|
version = "2.12.1";
|
|
|
|
builtins-derivation = {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
builder = "/bin/sh";
|
|
|
|
args = ["sh" "-c" "echo hello-${num} > $out"];
|
|
|
|
};
|
2023-08-09 01:44:34 +03:00
|
|
|
# generate env variables
|
|
|
|
env = lib.genAttrs (map toString (lib.range 0 numVars)) (
|
|
|
|
num: "value-${num}"
|
|
|
|
);
|
2023-08-07 14:50:27 +03:00
|
|
|
}
|
|
|
|
);
|
|
|
|
in {
|
|
|
|
inherit
|
|
|
|
pkg-funcs
|
|
|
|
modules
|
|
|
|
;
|
|
|
|
}
|