• Stars
    star
    237
  • Rank 169,854 (Top 4 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 7 years ago
  • Updated 3 months ago

Reviews

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

Repository Details

@ofborg tooling automation https://monitoring.ofborg.org/dashboard/db/ofborg

ofborg

Guidelines

  1. Review the code of all PRs before triggering the bot on them.
  2. Be gentle; try not to run mass rebuilds or massive builds (like Chromium) on it.

Automatic Building

All users will have their PRs automatically trigger builds if their commits follow the well-defined format of Nixpkgs. Specifically: prefixing the commit title with the package attribute. This includes package bumps as well as other changes.

Example commit titles and the builds they will start:

Message Automatic Build
vim: 1.0.0 -> 2.0.0 vim
vagrant: Fix dependencies for version 2.0.2 vagrant
python36Packages.requests,python27Packages.requests: 1.0.0 -> 2.0.0 python36Packages.requests, python27Packages.requests
python{2,3}Packages.requests: 1.0.0 -> 2.0.0 nothing

When opening a PR with multiple commits, ofborg creates a single build job for all detected packages. If multiple commits get pushed to a PR one-by-one, each detected package will get a separate build job.

If the title of a PR begins with WIP:, contains [WIP] anywhere, or has the 2.status: work-in-progress label, its packages are not built automatically. Note: Marking a PR as a draft does not prevent automatic builds.

Commands

The comment parser is line-based, so commentary can be interwoven with instructions for ofborg.

  1. To trigger the bot, the line must start with @ofborg (case insensitive).
    • Note: GitHub will not suggest @ofborg to you, but it will work all the same. When in doubt, preview your comment and verify that @ofborg links to https://github.com/ofborg/.
  2. To use multiple commands, separate them with whitespace. For examples, see the "Multiple Commands" section.

test

@ofborg test list of tests

This will run nix-build ./default.nix -A nixosTests.list -A nixosTests.of -A nixosTests.tests from the root of the Nixpkgs checkout.

Tests will run on all allowed machines. For more information, see the "Trusted Users" section.

eval

@ofborg eval

See "How does ofborg call nix-instantiate?" for what command(s) this will run.

Note: Every PR automatically evaluates both upon creation and when the commits change. There is no reason to run eval on a PR unless the evaluation failed for weird reasons or master was previously broken.

build

@ofborg build list of attrs

This will run nix-build ./default.nix -A list -A of -A attrs from the root of the Nixpkgs checkout (see also "How does ofborg call nix-build?").

Builds will run on all allowed machines. For more information, see the "Trusted Users" section.

Multiple Commands

You can use multiple commands in a variety ways. Here are some valid combinations:

  • @ofborg build list of attrs
    @ofborg eval
    
  • @ofborg build list of attrs @ofborg eval
    
  • looks good to me!
    @ofborg eval
    @ofborg build list of attrs
    
  • @ofborg eval
    @ofborg build list of attrs
    looks good to me!
    
  • @ofborg build list of attrs
    @ofborg test list of attrs
    
  • This will build list, of, attrs, looks, good, to, and me! (which is probably not what you want):

    @ofborg build list of attrs looks good to me!
    

Trusted Users (Currently Disabled)

NOTE: The Trusted Users functionality is currently disabled, as the current darwin builder is reset very frequently. This means that all users will have their PRs build on the darwin machine.

Trusted users have their builds and tests executed on all available platforms, including those without good sandboxing. Because this exposes the host to a higher risk of security issues, the trusted users list consists of only well-known, trusted members of the community.

At the time of writing, trusted users have their builds and tests run on these platforms:

  • x86_64-linux
  • aarch64-linux
  • x86_64-darwin
  • aarch64-darwin

See config.public.json for a list of all trusted users.

How does ofborg call nix-build?

ofborg runs builds with a command similar to the following:

$ HOME=/homeless-shelter NIX_PATH=ofborg-nixpkgs-pr=$(pwd) nix-build ./default.nix \
    -A hello \
    --no-out-link \
    --keep-going \
    --option restrict-eval true \ 
    --option build-timeout 1800 \ 
    --argstr system thesystem \
    --show-trace

How does ofborg call nix-instantiate?

ofborg runs NixOS evals with a command similar to the following:

$ HOME=/homeless-shelter NIX_PATH=ofborg-nixpkgs-pr=$(pwd) nix-instantiate ./nixos/release.nix \
    -A manual \
    --option restrict-eval true \
    --option build-timeout 1800 \
    --argstr system thesystem \
    --show-trace

ofborg runs Nixpkgs evals with a command similar to the following:

$ HOME=/homeless-shelter NIX_PATH=ofborg-nixpkgs-pr=$(pwd) nix-instantiate ./pkgs/top-level/release.nix \
    -A manual \
    --option restrict-eval true \
    --option build-timeout 1800 \
    --argstr system thesystem \
    --show-trace

Running meta checks locally

To run the meta checks, you will need the outpaths.nix file. You can acquire this file and run the checks themselves like so:

$ curl -o outpaths.nix https://raw.githubusercontent.com/NixOS/ofborg/released/ofborg/src/outpaths.nix
$ GC_INITIAL_HEAP_SIZE=4g nix-env -f ./outpaths.nix -qaP --no-name --out-path --arg checkMeta true > out-paths

Hacking

$ git clone https://github.com/NixOS/ofborg/
$ cd ofborg
$ nix-shell ./shell.nix
$ cd ofborg # enter the subdirectory with Rust code
# make your changes
$ cargo build
$ cargo check
$ cargo test

To test whether or not Continuous Integration will pass with your changes, you can run the following commands from the root of your checkout:

$ nix-shell --pure --run checkPhase # checks rustfmt, clippy & runs the test suite
$ nix-build -A ofborg.rs # build ofborg

Currently there is no easy way to set up a test instance of ofborg. If cargo check and cargo test both succeed, feel free to Pull Request your changes. Make sure to format your code with cargo fmt and check for additional warnings with cargo clippy. If you added, removed, or updated the dependencies, also be sure to update Cargo.nix by running ./nix/update-crates.sh.

To disable warnings as errors, run your command with an empty RUSTFLAGS. For example:

$ RUSTFLAGS= cargo clippy

This will override the default of -D warnings set in shell.nix, which tells Rust to error if it detects any warnings.

Running a builder

If you want to run a builder of your own, check out the wiki page on operating a builder.

More Repositories

1

nixpkgs

Nix Packages collection & NixOS
Nix
13,126
star
2

nix

Nix, the purely functional package manager
C++
9,002
star
3

patchelf

A small utility to modify the dynamic linker and RPATH of ELF executables
C
2,931
star
4

nixos-hardware

A collection of NixOS modules covering hardware quirks.
Nix
1,864
star
5

nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
Python
1,464
star
6

nix.dev

Official documentation for getting things done with Nix.
Python
1,458
star
7

hydra

Hydra, the Nix-based continuous build system
Perl
1,128
star
8

nixfmt

The official (but not yet stable) formatter for Nix code
Nix
882
star
9

templates

Flake templates
Nix
464
star
10

nixos-search

Search NixOS packages and options
Elm
410
star
11

rfcs

The Nix community RFCs
396
star
12

cabal2nix

Generate Nix build instructions from a Cabal file
Haskell
336
star
13

nixos-homepage

Sources for nixos.org
Astro
299
star
14

nix-mode

An Emacs major mode for editing Nix expressions.
Emacs Lisp
294
star
15

nix-pills

Nix
278
star
16

nixos-weekly

NixOS Weekly Newsletter
HTML
210
star
17

nixos-artwork

Nix related artwork
Nix
194
star
18

nix-book

Nix documentation – centralized community online learning resource for Nix
183
star
19

nix-idea

Nix plugin for the IntelliJ IDEA IDE
Java
176
star
20

nixos-org-configurations

NixOS configurations for nixos.org and its servers
Nix
173
star
21

nixos

OBSOLETE (go to NixOS/nixpkgs) - NixOS, a Linux distribution based on the Nix package manager - OBSOLETE (go to NixOS/nixpkgs)
Shell
169
star
22

nixpkgs-channels

DEPRECATED! Use NixOS/nixpkgs repository instead.
Nix
168
star
23

docker

DEPRECATED! Dockerfiles to package Nix in a minimal docker container
Dockerfile
148
star
24

bundlers

Nix
98
star
25

flake-registry

Global registry of Nix flakes
Shell
76
star
26

aarch64-build-box

Config for the Community aarch64 NixOS box [maintainer=@grahamc]
Nix
62
star
27

npm2nix

Generate nix expressions to build npm packages
CoffeeScript
57
star
28

nixops-aws

Python
52
star
29

nixops-hetzner

Python
49
star
30

amis

Home for NixOS AMI automation
Python
45
star
31

nixpkgs-merge-bot

Allows package maintainers to merge in nixpkgs
Python
44
star
32

nixos-wiki-infra

This project contains the setup of https://wiki.nixos.org
Nix
43
star
33

equinix-metal-builders

iPXE image for Nix builders on Equinix Metal's Spot market.
Nix
39
star
34

nixpart

NixOS storage manager/partitioner
Python
38
star
35

foundation

This is the home of the NixOS Foundation
33
star
36

nixos-channel-scripts

Perl
32
star
37

mvn2nix-maven-plugin

Generate project-info.json for use with nix's Maven repository generation functions
Java
31
star
38

security

Rust
30
star
39

language-nix

Data types and useful functions to represent and manipulate the Nix language. | Source has moved to https://github.com/nixos/cabal2nix
Haskell
30
star
40

hydra-provisioner

On-demand provisioning tool for Hydra
Python
29
star
41

nixpkgs-vet

Tool to vet (check) Nixpkgs, including its pkgs/by-name directory
Rust
23
star
42

release-wiki

19
star
43

distribution-nixpkgs

Haskell types and functions to represent, query, and manipulate the Nixpkgs distribution. | Source has moved to https://github.com/nixos/cabal2nix
Haskell
17
star
44

darwin-stubs

Text API (TAPI) files to support a pure build environment on macOS in nixpkgs.
Shell
15
star
45

mobile-nixos-website

Nix
14
star
46

reproducible.nixos.org

HTML
14
star
47

snapd-nix-base

The Nix base snap for distributing Nix-built software via the Snap store.
Nix
13
star
48

calamares-nixos-extensions

NixOS calamares [maintainer=@vlinkz]
Python
13
star
49

hackage-db

provide access to the Hackage database via Data.Map | Source has moved to https://github.com/nixos/cabal2nix
Haskell
13
star
50

rfc-steering-committee

Workflows and notes from Nix steering committee
Python
12
star
51

nixos-metrics

Rust
12
star
52

nix-eclipse

Nix Eclipse plugin
Java
12
star
53

nixos-common-styles

Common styles for NixOS related web sites.
Less
11
star
54

moderation

The home of the moderation team
11
star
55

jailbreak-cabal

Strip version restrictions from build dependencies in Cabal files.
Haskell
10
star
56

nixops-dashboard

NixOps Dashboard
9
star
57

nixos-summer

HTML
8
star
58

nixos-status

The website showing an overview status of NixOS infra and CI.
JavaScript
8
star
59

nixos-planet

XSLT
7
star
60

ofborg-viewer

Nix
6
star
61

org

Organisational documentation
Shell
6
star
62

20th-nix

20 years of Nix
HTML
5
star
63

whats-new-in-nix

Shell
5
star
64

.github

org-level github configuration
4
star
65

hydra-ant-logger

Java
4
star
66

package-list

Deprecated, use upload-nixos-package-list-to-hackage.sh instead. Generate the list of available Haskell packages for Hackage.
Haskell
3
star
67

rfc39

Implementation of NixOS RFC #39.
Nix
3
star
68

flake-regressions

Nix flake evaluation regression testing
Nix
3
star
69

rfc39-record

2
star
70

teams-collaboration

1
star
71

nix-constitutional-assembly

1
star