Skip to content

Instantly share code, notes, and snippets.

@thufschmitt
Created February 24, 2022 11:27
Show Gist options
  • Save thufschmitt/e2f664af98124cf67e6c7acae1c38e0c to your computer and use it in GitHub Desktop.
Save thufschmitt/e2f664af98124cf67e6c7acae1c38e0c to your computer and use it in GitHub Desktop.
Nix eval cache benchmark
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1641528457,
"narHash": "sha256-FyU9E63n1W7Ql4pMnhW2/rO9OftWZ37pLppn/c1aisY=",
"path": "/nix/store/pwz0d92vl5hjrvhiri3qzazxjnf1r8wy-source",
"rev": "ff377a78794d412a35245e05428c8f95fef3951f",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "A basic flake with a shell";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell {
nativeBuildInputs = [ pkgs.bashInteractive pkgs.hyperfine ];
buildInputs = [ ];
};
});
}
#!/usr/bin/env bash
set -euo pipefail
rm -rf .direnv
mkdir -p .direnv
hyperfine --warmup 1 \
"nix print-dev-env --option eval-cache false --profile .direnv/flake-profile-native" \
"nix print-dev-env --profile .direnv/flake-profile-native" \
"echo "" >> shell.nix && direnv export zsh" \
"direnv export zsh" \
"SHELL=true lorri shell" \
"SHELL=true lorri shell --cached" \
--export-markdown bench.md
git checkout flake.nix
(builtins.getFlake (builtins.toPath ./.)).outputs.devShell.${builtins.currentSystem}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment