• Stars
    star
    210
  • Rank 187,585 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 1 year ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Combine the power of nix-eval-jobs with nix-output-monitor to speed-up your evaluation and building process.

nix-fast-build πŸš€ (previously known as nix-ci-build)

Combine the power of nix-eval-jobs with nix-output-monitor to speed-up your evaluation and building process. nix-fast-build an also integrates with remote machines by uploading the current flake, performing the evaluation/build remotely, and then transferring the resultant store paths back to you.

Why nix-fast-build?

Problem: Evaluating and building big flakes i.e. with numerous NixOS machines can be painfully slow. For instance, rebuilding the already-compiled disko integration test suite demands 1:50 minutes on an AMD Ryzen 9 7950X3D. But, it only takes a 10 seconds with nix-fast-build.

Solution: nix-fast-build makes builds faster by evaluating and building your nix packages concurrently, reducing the overall time.

How Does It Work?

Under the hood:

  1. It leverages the output from nix-eval-jobs to evaluate flake attributes in parallel.
  2. As soon as attributes complete evaluation, nix-fast-build initiates their build, even if the overall evaluation is ongoing.
  3. Lastly, nix-output-monitor to show the build progress nicely.
  4. (Optional) Once a build finishes, nix-fast-build can initiate its upload to a designated remote binary cache.

Usage

To get started, run:

$ nix-fast-build

or:

$ nix run github:Mic92/nix-fast-build

This command will concurrently evaluate all systems in .#checks and build the attributes in .#checks.$currentSystem.


Enjoy faster and more efficient NixOS builds with nix-fast-build!

Remote building

When leveraging the remote-builder protocol, uploading pre-built paths or sources from the local machine can often turn into a bottleneck. nix-fast-build does not use the remote-builder protocol. Instead it uploads only the flake and executes all evaluation/build operations on the remote end. At the end nix-fast-build will download the finished builds to the local machine while not having to download all build dependencies in between.

Here is how to use it:

nix run github:Mic92/nix-fast-build -- --remote youruser@yoursshhostname

Replace youruser@yoursshhostname with your SSH login credentials for the target machine. Please note that as of now, you must be recognized as a trusted user on the remote endpoint to access this feature.

CI-Friendly Output

By default, Nix-output-monitor (abbreviated as nom) updates its output every 0.5 seconds. In standard terminal environments, this frequent update is unnoticeable, as nom erases the previous output before displaying the new one. However, in Continuous Integration (CI) systems, each update appears as a separate line of output.

To make output more concise for CI environments, use the --no-nom flag. This replaces nom with a streamlined status reporter, which updates only when there's a change in the number of pending builds, uploads, or downloads.

Avoiding Redundant Package Downloads

By default, nix build will download pre-built packages, leading to needless downloads even when there are no changes to any package. This can be especially burdensome for CI environments without a persistent Nix store, such as GitHub Actions.

To optimize this, use the --skip-cached flag with nix-fast-build. This ensures that only those packages missing from the binary caches will be built.

Specifying Build Systems

By default, nix-fast-build evaluates all architectures but only initiates builds for the current system. You can modify this behavior with the --systems flag. For instance, using --systems "aarch64-linux x86_64-linux" will prompt builds for both aarch64-linux and x86_64-linux architectures. Ensure that your system is capable of building for the specified architectures, either locally or through the remote builder protocol.

Building different flake attributes

nix-fast-build by default builds .#checks.$currentSystem, which refers to all checks for the current flake. You can modify this default behavior by using the --flake flag to specify a different attribute path.

Example:

$ nix run github:Mic92/nix-fast-build -- --flake github:NixOS/nixpkgs#legacyPackages.x86_64-linux.hello

Note: Always provide the complete flake path. Unlike nix build, nix-fast-build does not iterate over different attributes; the full path must be explicitly stated.

Only evaluate the current system

By default nix-fast-build will evaluate all systems in .#checks, you can limit it to the current system by using this command:

$ nix run github:Mic92/nix-fast-build -- --skip-cached --no-nom --flake ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"

Reference

usage: nix-fast-build [-h] [-f FLAKE] [-j MAX_JOBS] [--option name value] [--remote-ssh-option name value] [--no-nom]
                      [--systems SYSTEMS] [--retries RETRIES] [--no-link] [--out-link OUT_LINK] [--remote REMOTE]
                      [--always-upload-source] [--no-download] [--skip-cached] [--copy-to COPY_TO] [--debug]
                      [--eval-max-memory-size EVAL_MAX_MEMORY_SIZE] [--eval-workers EVAL_WORKERS]

options:
  -h, --help            show this help message and exit
  -f FLAKE, --flake FLAKE
                        Flake url to evaluate/build (default: .#checks
  -j MAX_JOBS, --max-jobs MAX_JOBS
                        Maximum number of build jobs to run in parallel (0 for unlimited)
  --option name value   Nix option to set
  --remote-ssh-option name value
                        ssh option when accessing remote
  --no-nom              Don't use nix-output-monitor to print build output (default: false)
  --systems SYSTEMS     Space-separated list of systems to build for (default: current system)
  --retries RETRIES     Number of times to retry failed builds
  --no-link             Do not create an out-link for builds (default: false)
  --out-link OUT_LINK   Name of the out-link for builds (default: result)
  --remote REMOTE       Remote machine to build on
  --always-upload-source
                        Always upload sources to remote machine. This is needed if the remote machine cannot access all sources
                        (default: false)
  --no-download         Do not download build results from remote machine
  --skip-cached         Skip builds that are already present in the binary cache (default: false)
  --copy-to COPY_TO     Copy build results to the given path (passed to nix copy, i.e. file:///tmp/cache?compression=none)
  --debug               debug logging output
  --eval-max-memory-size EVAL_MAX_MEMORY_SIZE
                        Maximum memory size for nix-eval-jobs (in MiB) per worker. After the limit is reached, the worker is restarted.
  --eval-workers EVAL_WORKERS
                        Number of evaluation threads spawned

More Repositories

1

sops-nix

Atomic secret provisioning for NixOS based on sops
Nix
1,439
star
2

cntr

A container debugging tool based on FUSE
Rust
542
star
3

nix-update

Swiss-knife for updating nix packages.
Python
459
star
4

nixos-shell

Spawns lightweight nixos vms in a shell
Nix
423
star
5

nix-ld

Run unpatched dynamic binaries on NixOS
C
422
star
6

nixpkgs-review

Review pull-requests on https://github.com/NixOS/nixpkgs
Python
383
star
7

python-mpd2

Python library which provides a client interface for the Music Player Daemon.
Python
353
star
8

dotfiles

My NixOS dotfiles
Nix
299
star
9

envfs

Fuse filesystem that returns symlinks to executables based on the PATH of the requesting process.
Rust
133
star
10

vmsh

Shell into a virtualized linux, with your own tools
Rust
132
star
11

mina-sidekiq

Tasks to deploy Sidekiq with mina.
Ruby
91
star
12

nix-build-uncached

A CI friendly wrapper around nix-build.
Go
72
star
13

zig.ko

Linux kernel module written in Zig
Makefile
70
star
14

nixos-aarch64-images

Build NixOS images for various ARM single computer boards
Python
49
star
15

x86_64-linux-cheatsheats

Plain files for syscalls, errnos, signals, registers and x86_64 instructions
Python
49
star
16

pry.py

pry.py - an interactive drop in shell for python, similar to binding.pry in ruby
Python
49
star
17

ssh-to-age

Convert SSH Ed25519 keys to age keys. This is useful for usage in sops-nix and sops
Go
47
star
18

hue-ble-ctl

Control your Phillips Hue light bulb over bluetooth
Python
33
star
19

pythonix

Eval nix code from python
C++
32
star
20

awesome-dotfiles

Configuration files of the window manager awesome
Lua
28
star
21

fast-flake-update

Update flake.lock with the latest commit of a local checkout
Python
27
star
22

nur-packages

My personal NUR repository
Nix
23
star
23

flake-linter

Find duplicate dependencies in flakes
Python
18
star
24

ansible-lxc

Ansible Connection Plugin for lxc containers (https://linuxcontainers.org/)
Python
17
star
25

iana-etc

Build /etc/protocols and /etc/services files from IANA's Assigned Internet Protocol Numbers
Python
17
star
26

lognotify

log watcher for awesome wm
Lua
14
star
27

nix-sysdig

Wrapper to debug sysdig builds
Python
13
star
28

github-tags

sinatra app to generate rss feeds with the latest git tags of a project on github
Ruby
12
star
29

nixican-standoff

Benchmark between nix, lix and tvix
Python
12
star
30

whois42d

Whois server for the dn42 registry
Go
11
star
31

ssh-to-pgp

Convert SSH RSA keys to GPG keys
Go
11
star
32

utils

A set of lua modules I use in awesome wm.
Lua
9
star
33

stockholm

Mirror of https://git.thalheim.io/Mic92/stockholm/
Nix
9
star
34

bing-gpt-server

HTML
8
star
35

flake-templates

Personal templates i like to use.
Nix
7
star
36

valauncher

A fast dmenu-like gtk3 application launcher
CMake
7
star
37

dlopen-resolver

Python
7
star
38

openvpn-ddns

Maintain dns records for connecting openvpn clients
Ruby
7
star
39

dream2nix-home-assistant

Packaging experiments with dream2nix to package home-assistant with all dependencies.
Nix
5
star
40

kvm-pirate

Attach to kvm-based VMs
Python
5
star
41

mechanical-keyboards

Configuration of my collections of keyboards
Nix
4
star
42

systemd-ta

http://c3d2.de/news/ta-systemd.html
JavaScript
4
star
43

nix-build-shell

Rust
4
star
44

robolab

Simulator for the course Robolab at TU Dresden
4
star
45

nixos-test-example

Nix
4
star
46

retiolum

Mirror of https://git.thalheim.io/Mic92/retiolum
Nix
4
star
47

server-bookings

Rust
3
star
48

Algebra-I

Das inoffizielle Skript zur Vorlesung bei Prof. Schmidt
Ruby
3
star
49

nix-fmt

abandoned in favor of https://github.com/orivej/go-nix and https://gitlab.com/jD91mZM2/rnix
OCaml
3
star
50

imap-notify

IMAP notifier using IMAP's NOTIFY SET
Python
3
star
51

docker-pid

Resolve container id/name to container's process id
Go
3
star
52

nftables

Mirror of netfilter/nftables
C
3
star
53

nixos-configuration

The content of this repo has been integrated into https://github.com/Mic92/dotfiles/
3
star
54

mpdtools

Usefull tools for MPD: mpdadd - Link and play files outside of the MPD directory to MPD. mpdmark - bookmark songs
Ruby
3
star
55

nsattach

attach to linux namespaces
C
3
star
56

bors-gen-config

Generate bors.toml for github repositories
Python
2
star
57

int3

Better debugger breakpoints
Python
2
star
58

vtune-nix

Vtune nix package
Nix
2
star
59

live-net-info

My adventures using the bubbletea framework.
Go
2
star
60

blog

Source of my blog
Shell
2
star
61

themenabend-nixos

Folien und Code zum Themenabend ΓΌber Nix/Nixos
JavaScript
2
star
62

lxc-machined-start

Integrate lxc container into machined
M4
2
star
63

company-tmux

emacs auto complete with content of tmux panes
Emacs Lisp
2
star
64

pgp-verify

Verify pgp signatures of files.
Go
2
star
65

build-system-koans

C
2
star
66

SWT_And_Programming

Programs/Stubs created during exercises at university.
Java
2
star
67

mpdstated

Auto restore recent position for each podcast in mpd.
Vala
2
star
68

bme680-mqtt

Publish BME680 sensor data to home-assistant via MQTT
Python
2
star
69

container-pid

Rust crate to resolve a container names/ids to PID
Rust
2
star
70

nixcon2023-nixos-anywhere

Presentation slides for NixCon 2023 presentation on nixos-anywhere
JavaScript
2
star
71

systemd-user-units

2
star
72

nixos-wiki-redirector

JavaScript
2
star
73

disko-yubikey-demo

Nix
2
star
74

scripts

All my tiny scripts and stubs
Shell
1
star
75

lualdap

fork of https://git.zx2c4.com/lualdap/ with lua5.3 support
C
1
star
76

pcap-preload

Rust
1
star
77

nixpkgs-committers

Repository for nominating maintainers for Nixpkgs commit access
1
star
78

mic92.github.com

1
star
79

phd-website

HTML
1
star
80

ports

my freebsd ports
Makefile
1
star
81

drone-convert-nix

Go
1
star
82

webscraping-workshop

Folien und Code zum Webscraping workshop auf den Datenspuren 2015
JavaScript
1
star
83

qtile-config

Python
1
star
84

semeion

A DynDNS Server interface in Haskell and Yesod
Haskell
1
star
85

hadoop-exercise

MapReduce Assignment 2015 at System Engineering II (TU Dresden)
Java
1
star
86

xfstests-cntr

Fork of xfstests with support for cntr
Shell
1
star
87

fuidshift

Move Filesystem ownership into other subordinated uid ranges
Go
1
star
88

android-notifier

Automatically exported from code.google.com/p/android-notifier
Java
1
star
89

fft

FFT Implementation for Tensilica DSP Processors
C
1
star
90

userborn-with-impermanence

Nix
1
star
91

drone-nix-scheduler

Schedule nix jobsets in drone ci
Python
1
star
92

arch-package-feed

bottle.py based project to provide a more advanced arch package feed.
Python
1
star
93

PKGBUILDs

My PKGBUILDs of Packages I maintain in Archlinux AUR
Shell
1
star
94

tracedump

System service to dump Intel processor trace + memory after a crash.
Python
1
star
95

Japanese-sum-solver

A solver for the logic game Japsum
JavaScript
1
star
96

clusterssh

wrapper arround go-ssh to execute commands in a cluster
Go
1
star