Tvix is a new implementation of the Nix language and package manager.
In this benchmark we test it's performance when instantiating the hello package from nix.
Note that at the time tvix does not have its own store implementation yet and it has to
execute nix-store whenever it needs to copy files to the store.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import http.client | |
| import json | |
| import os | |
| import time | |
| import urllib.parse | |
| import urllib.request | |
| from pathlib import Path | |
| from typing import Any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env nix-shell | |
| #!nix-shell -i bash -p sqlite -p bash | |
| SQL=$(cat <<EOF | |
| select * from DerivationOutputs do | |
| inner join ValidPaths vp on vp.id = do.drv | |
| inner join Refs r1 on r1.referrer = vp.id | |
| inner join ValidPaths vp2 on r1.reference = vp2.id | |
| where do.path GLOB '/nix/store/$1-*' | |
| EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Batch size: 1000 | |
| ## Query all packages | |
| elapsed: 24.68 s, heap size: 2610.18 MiB | |
| ## Evaluating packages in batches | |
| elapsed: 15.04 s, heap size: 1217.18 MiB | |
| elapsed: 18.31 s, heap size: 1377.18 MiB | |
| elapsed: 9.13 s, heap size: 673.18 MiB | |
| elapsed: 11.24 s, heap size: 769.18 MiB | |
| elapsed: 16.69 s, heap size: 1169.18 MiB | |
| elapsed: 3.50 s, heap size: 384.31 MiB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| if ! command -v nix >/dev/null; then | |
| echo "Installing Nix..." | |
| if command -v curl; then | |
| curl -L https://nixos.org/nix/install > /tmp/install | |
| elif command -v wget; then | |
| wget -O /tmp/install https://nixos.org/nix/install | |
| else | |
| echo "Please install curl or wget" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env nix-shell | |
| #!nix-shell -i bash -p bash -p qemu_kvm -p iproute2 | |
| set -x -eu -o pipefail | |
| VM_IMAGE="" | |
| CPUS="${CPUS:-$(nproc)}" | |
| MEMORY="${MEMORY:-4096}" | |
| SSH_PORT="${SSH_PORT:-2222}" | |
| IMAGE_SIZE="${IMAGE_SIZE:-10G}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| . 242.3 GiB [##########################] /harshanavkis | |
| . 137.1 GiB [############## ] /paul | |
| 98.9 GiB [########## ] /julian | |
| . 84.8 GiB [######### ] /dimitrios | |
| . 61.5 GiB [###### ] /maurice | |
| 33.0 GiB [### ] /martin | |
| 12.1 GiB [# ] /masa | |
| 7.8 GiB [ ] /joerg | |
| 5.3 MiB [ ] /okelmann |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -exuo pipefail | |
| PROGRAM_NAME="$0" | |
| inst() { | |
| local system="" host="" action="install" from="auto" mount="" | |
| local -a nixCopyArgs | |
| while [[ "$#" -gt 0 ]] ; do | |
| case "$1" in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { lib | |
| , buildGoPackage | |
| , fetchurl | |
| , makeWrapper | |
| , git | |
| , bash | |
| , gzip | |
| , openssh | |
| , pam | |
| , sqliteSupport ? true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| boot.initrd.availableKernelModules = [ | |
| "xhci_pci" | |
| "ahci" | |
| "nvme" | |
| ]; | |
| disko.devices = import ./raid-config.nix { | |
| raidLevel = 1; | |
| }; |