• Stars
    star
    120
  • Rank 287,239 (Top 6 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created about 1 year 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

Health checks for your Nix flakes

Nix Flake Checker

FlakeHub

Nix Flake Checker is a tool from Determinate Systems that performs "health" checks on the flake.lock files in your flake-powered Nix projects. Its goal is to help your Nix projects stay on recent and supported versions of Nixpkgs.

To run the checker in the root of a Nix project:

nix run github:DeterminateSystems/flake-checker

# Or point to an explicit path for flake.lock
nix run github:DeterminateSystems/flake-checker /path/to/flake.lock

Nix Flake Checker looks at your flake.lock's root-level Nixpkgs inputs and checks that:

  • Any explicit Nixpkgs Git refs are in this list:
    • nixos-23.05
    • nixos-23.05-small
    • nixos-unstable
    • nixos-unstable-small
    • nixpkgs-23.05-darwin
    • nixpkgs-unstable
  • Any Nixpkgs dependencies are less than 30 days old
  • Any Nixpkgs dependencies have the NixOS org as the GitHub owner (and thus that the dependency isn't a fork or non-upstream variant)

If you're running it locally, Nix Flake Checker reports any issues via text output in your terminal. But you can also use Nix Flake Checker in CI.

The Nix Flake Checker Action

You can automate Nix Flake Checker by adding Determinate Systems' Nix Flake Checker Action to your GitHub Actions workflows:

checks:
  steps:
    - uses: actions/checkout@v3
    - name: Check Nix flake Nixpkgs inputs
      uses: DeterminateSystems/flake-checker-action@main

When run in GitHub Actions, Nix Flake Checker always exits with a status code of 0 by default—and thus never fails your workflows—and reports its findings as a Markdown summary.

Telemetry

The goal of Nix Flake Checker is to help teams stay on recent and supported versions of Nixpkgs. The flake checker collects a little bit of telemetry information to help us make that true.

Here is a table of the telemetry data we collect:

Field Use
distinct_id An opaque string that represents your project, by sha256 hashing repository and organization details.
version The version of Nix Flake Checker.
is_ci Whether the checker is being used in CI (GitHub Actions).
disallowed The number of inputs using unsupported branches of Nixpkgs.
outdated The number of inputs using outdated versions of Nixpkgs.
non_upstream The number of inputs using forks of Nixpkgs.

To disable diagnostic reporting, set the diagnostics URL to an empty string by passing --no-telemetry or setting FLAKE_CHECKER_NO_TELEMETRY=true.

You can read the full privacy policy for Determinate Systems, the creators of this tool and the Determinate Nix Installer, here.

Rust library

The Nix Flake Checker is written in Rust. This repo exposes a parse-flake-lock crate that you can use to parse flake.lock files in your own Rust projects. To add that dependency:

[dependencies]
parse-flake-lock = { git = "https://github.com/DeterminateSystems/flake-checker", branch = "main" }

Here's an example usage:

use std::path::Path;

use parse_flake_lock::{FlakeLock, FlakeLockParseError};

fn main() -> Result<(), FlakeLockParseError> {
    let flake_lock = FlakeLock::new(Path::new("flake.lock"))?;
    println!("flake.lock info:");
    println!("version: {version}", version=flake_lock.version);
    println!("root node: {root:?}", root=flake_lock.root);
    println!("all nodes: {nodes:?}", nodes=flake_lock.nodes);

    Ok(())
}

The parse-flake-lock crate doesn't yet exhaustively parse all input node types, instead using a "fallthrough" mechanism that parses input types that don't yet have explicit struct definitions to a serde_json::value::Value. If you'd like to help make the parser more exhaustive, pull requests are quite welcome.

More Repositories

1

nix-installer

Install Nix and flakes with the fast and reliable Determinate Nix Installer, with over 2 million installs.
Rust
1,389
star
2

zero-to-nix

Zero to Nix is your guide to learning Nix and flakes. Created by Determinate Systems.
MDX
781
star
3

riff

Riff automatically provides external dependencies for Rust projects, with support for other languages coming soon.
Rust
486
star
4

magic-nix-cache-action

Save 30-50%+ of CI time without any effort or cost. Use Magic Nix Cache, a totally free and zero-configuration binary cache for Nix on GitHub Actions.
TypeScript
288
star
5

update-flake-lock

Automatically refresh your Nix Flakes.
Nix
199
star
6

nix-netboot-serve

Make any NixOS system netbootable with 10s cycle times.
Rust
187
star
7

magic-nix-cache

Save 30-50%+ of CI time without any effort or cost. Use Magic Nix Cache, a totally free and zero-configuration binary cache for Nix on GitHub Actions.
Rust
170
star
8

nuenv

A Nushell environment for Nix
Nushell
166
star
9

nix-installer-action

The Github Action for the Determinate Nix Installer
TypeScript
114
star
10

bootspec-secureboot

Rust
92
star
11

fh

The official CLI for FlakeHub: search for flakes, and add new inputs to your Nix flake.
Rust
81
star
12

macos-ephemeral

Scripts and instructions for making ephemeral macOS machines with Mosyle MDM support.
Shell
73
star
13

nix-to-kubernetes

An example of deploying Nix-built Docker images to Kubernetes.Not act
Nix
63
star
14

flake-schemas

Schemas for common flake output types
Nix
56
star
15

terraform-provider-hydra

Declaratively configure your Hydra server with Terraform.
Go
41
star
16

nix-github-actions

An example project showing how to use Nix to replace third-party GitHub Actions
Nix
38
star
17

nixos-vault-service

Nix
36
star
18

flake-checker-action

A GitHub Action that performs health checks for your Nix flake.lock files
Nix
35
star
19

nix-policy

Experiments with Nix and Open Policy Agent
Nix
26
star
20

bonk

Erase macOS machines over Tailscale.
Go
25
star
21

bootspec

Implementation of RFC-0125's datatype and synthesis tooling.
Rust
21
star
22

flakehub-push

Release your Nix flake to FlakeHub.com.
Rust
20
star
23

nix-copy-deploy

An example project for the nix copy utility
Shell
12
star
24

zpool-auto-expand-partitions

Rust
12
star
25

hydra-github-jobsets-generator

Generate declarative jobsets for a project's GitHub repository.
Rust
11
star
26

nixos-example-openstack

An example of building and pushing images for Openstack.
Nix
11
star
27

dhcpv6macd

A DHCPv6 service which assigns IPv6 addresses strictly on MAC address only. Potentially violates RFCs and specs.
Nix
10
star
28

cpiotools

Tools for examining CPIOs.
Rust
8
star
29

hydra-examples

Example files for Hydra.
Nix
8
star
30

nix-cpio-generator

Rust
8
star
31

prometheus-weather-gov

An example Nix project using Python, with a NixOS Module, NixOS test, and Docker image.
Python
7
star
32

nix-wasm-example

Nix
7
star
33

hydra-nixos-org-configuration

A mirror of the project and jobset configurations on hydra.nixos.org.
HCL
6
star
34

nix-config-parser

Rust
6
star
35

asset-tagger

Print asset tags.
Shell
4
star
36

search-detsys-dev

Python
4
star
37

coldsnap.nix

Nix
3
star
38

flakehub-mirror

3
star
39

templates

Ready-made flake templates to get started with Nix
Nix
3
star
40

export

Export arbitrary bytes from Rust to various shells and interpreters.
Rust
3
star
41

hydra-runcommand-logs

Experiments logging to the journal from RunCommand.
Nix
3
star
42

elixir-nix

Nix
2
star
43

hydra-scale-equinix-metal

Scale Equinix Metal builders based on Hydra usage.
Rust
2
star
44

scanoss-nix

Packages for the ScanOSS tool set.
Nix
2
star
45

marp-nix

Nix
2
star
46

install-riff-action

A GitHub Action for installing Riff
Shell
1
star
47

homebrew-riff

A Homebrew formula for Riff
Ruby
1
star
48

karonte-nix

Python
1
star
49

github-actions-oidc-claims

Rust
1
star
50

linear-import-nix

Nix
1
star
51

nix-installer-example

Nix
1
star
52

pickup.nix

Nix
1
star
53

hydra-github-jobsets-example-project

1
star
54

hydra-test-migrate-to-s3

Test migrating a Hydra instance from a local cache to an S3-backed cache.
Nix
1
star
55

buildkite-install-nix-macos

A Buildkite workflow to install Nix on macOS
Shell
1
star
56

update-flake-lock-test-template

A template repository for testing changes to https://github.com/DeterminateSystems/update-flake-lock/
Nix
1
star
57

fh-init-example-project

Python
1
star
58

nix-upgrade

Tracks the fallback paths for Nix, to allow upgrades on our schedule.
Nix
1
star
59

.github

Determinate Systems
1
star
60

ipxe-boot-lab

Local lab for testing iPXE boot in user network namespaces.
Rust
1
star
61

mlnx-workspace

Nix
1
star