mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 22:37:18 +03:00
benchmarks: configure number of env variables via $2
This commit is contained in:
parent
01496bcc72
commit
41e2993c31
@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eou pipefail
|
||||
|
||||
export NUM_PKGS=${1:-1000}
|
||||
export NUM_PKGS=${1:-100}
|
||||
export NUM_VARS=${2:-100}
|
||||
|
||||
# measure date ini milliseconds
|
||||
echo -e "\nBenchmarking ${NUM_PKGS}x builtins.derivaton via pkg-funcs"
|
||||
|
@ -14,16 +14,25 @@
|
||||
callModule = module: (_callModule module).config.public;
|
||||
|
||||
numPkgs = lib.toInt (builtins.getEnv "NUM_PKGS");
|
||||
numVars = lib.toInt (builtins.getEnv "NUM_VARS");
|
||||
|
||||
pkg-funcs = lib.genAttrs (map toString (lib.range 0 numPkgs)) (
|
||||
num:
|
||||
derivation {
|
||||
name = "hello-${num}";
|
||||
version = "2.12.1";
|
||||
system = "x86_64-linux";
|
||||
builder = "/bin/sh";
|
||||
args = ["sh" "-c" "echo hello-${num} > $out"];
|
||||
}
|
||||
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}"
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
modules = lib.genAttrs (map toString (lib.range 0 numPkgs)) (
|
||||
@ -39,6 +48,10 @@
|
||||
builder = "/bin/sh";
|
||||
args = ["sh" "-c" "echo hello-${num} > $out"];
|
||||
};
|
||||
# generate env variables
|
||||
env = lib.genAttrs (map toString (lib.range 0 numVars)) (
|
||||
num: "value-${num}"
|
||||
);
|
||||
}
|
||||
);
|
||||
in {
|
||||
|
@ -14,18 +14,27 @@
|
||||
callModule = module: (_callModule module).config.public;
|
||||
|
||||
numPkgs = lib.toInt (builtins.getEnv "NUM_PKGS");
|
||||
numVars = lib.toInt (builtins.getEnv "NUM_VARS");
|
||||
|
||||
pkg-funcs = lib.genAttrs (map toString (lib.range 0 numPkgs)) (
|
||||
num:
|
||||
nixpkgs.stdenv.mkDerivation rec {
|
||||
pname = "hello-${num}";
|
||||
version = "2.12.1";
|
||||
src = nixpkgs.fetchurl {
|
||||
url = "mirror://gnu/hello/hello-${version}.tar.gz";
|
||||
sha256 = "sha256-jZkUKv2SV28wsM18tCqNxoCZmLxdYH2Idh9RLibH2yA=";
|
||||
};
|
||||
doCheck = false;
|
||||
}
|
||||
nixpkgs.stdenv.mkDerivation (
|
||||
rec {
|
||||
pname = "hello-${num}";
|
||||
version = "2.12.1";
|
||||
src = nixpkgs.fetchurl {
|
||||
url = "mirror://gnu/hello/hello-${version}.tar.gz";
|
||||
sha256 = "sha256-jZkUKv2SV28wsM18tCqNxoCZmLxdYH2Idh9RLibH2yA=";
|
||||
};
|
||||
doCheck = false;
|
||||
}
|
||||
# generate env variables
|
||||
// (
|
||||
lib.genAttrs (map toString (lib.range 0 numVars)) (
|
||||
num: "value-${num}"
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
modules = lib.genAttrs (map toString (lib.range 0 numPkgs)) (num:
|
||||
@ -42,6 +51,10 @@
|
||||
sha256 = "sha256-jZkUKv2SV28wsM18tCqNxoCZmLxdYH2Idh9RLibH2yA=";
|
||||
};
|
||||
};
|
||||
# generate env variables
|
||||
env = lib.genAttrs (map toString (lib.range 0 numVars)) (
|
||||
num: "value-${num}"
|
||||
);
|
||||
});
|
||||
in {
|
||||
inherit
|
||||
|
Loading…
Reference in New Issue
Block a user