Skip to content
프로젝트

jtojnar/nixpkgs-hammering

GitHub에서 보기

소개

Nix 패키지 표현식을 깔끔하게 다듬기

기타 프로젝트

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
+1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

nixpkgs-hammering

There are many idioms in nixpkgs which beginner packagers might not be aware of. This is a set of nit-picky rules that aim to point out and explain common mistakes in nixpkgs package pull requests.

This repository contains a bunch of overlays that add extra checks to stdenv.mkDerivation and other similar nixpkgs tools. The nixpkgs-hammer command will try to evaluate the specified attributes with the overlays, making sure the warnings only touch the attributes you care about, not their dependencies.

Note that while these rules almost always apply, there are some exceptions. Please read the explanations before taking an action.

How do I use this?

Run the following command in your nixpkgs directory when you use classic Nix:

nix-shell https://github.com/jtojnar/nixpkgs-hammering/archive/main.tar.gz -A nixpkgs-hammering --run 'nixpkgs-hammer <attr-path>...'

or with Flakes-enabled Nix:

nix run github:jtojnar/nixpkgs-hammering <attr-path>...

or when you use unstable Nix but do not have Flakes enabled:

nix shell -f https://github.com/jtojnar/nixpkgs-hammering/archive/main.tar.gz -c nixpkgs-hammer <attr-path>...

How does this work?

There are two kinds of checks.

The first kind can be expressed directly in Nix and they are implemented as Nixpkgs overlays that replace stdenv.mkDerivation and other similar functions and attach an attribute containing a report to the resulting derivation’s attribute set. The tool then evaluates the attribute.

The second are more involved and the tool will execute them individually, passing each of them the attribute paths to check, the corresponding file paths, and (if available) build logs. They are implemented in Rust so they can perform arbitrary validation tasks – for example, parse the code into AST, read build logs, inspect the build output or even access network.

How do I develop this?

Run tests:

cargo test

Note The overlays of new checks must be added to the Git index in order for nixpkgs-hammering to discover them.

License

The code is licensed under MIT, the explanations are licensed under CC BY 4.0.

관련 프로젝트 살펴보기

불러오는 중…