treewide: with stdenv.lib; in meta -> with lib;

Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
This commit is contained in:
Profpatsch
2021-01-11 10:38:22 +01:00
parent e87aef06e0
commit 4a7f99d55d
6869 changed files with 13585 additions and 13580 deletions
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform, clang, llvmPackages, rustfmt, writeScriptBin,
{ lib, stdenv, fetchFromGitHub, rustPlatform, clang, llvmPackages, rustfmt, writeScriptBin,
runtimeShell }:
rustPlatform.buildRustPackage rec {
@@ -50,7 +50,7 @@ rustPlatform.buildRustPackage rec {
patchShebangs .
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "Automatically generates Rust FFI bindings to C (and some C++) libraries";
longDescription = ''
Bindgen takes a c or c++ header file and turns them into
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform, Security }:
{ lib, stdenv, fetchFromGitHub, rustPlatform, Security }:
rustPlatform.buildRustPackage rec {
pname = "cargo-asm";
@@ -19,7 +19,7 @@ rustPlatform.buildRustPackage rec {
# LLVM/compiler versions.
doCheck = false;
meta = with stdenv.lib; {
meta = with lib; {
description = "Display the assembly or LLVM-IR generated for Rust source code";
homepage = "https://github.com/gnzlbg/cargo-asm";
license = licenses.mit;
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform, libiconv, Security }:
{ lib, stdenv, fetchFromGitHub, rustPlatform, libiconv, Security }:
rustPlatform.buildRustPackage rec {
pname = "cargo-cache";
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
checkFlagsArray = [ "offline_tests" ];
meta = with stdenv.lib; {
meta = with lib; {
description = "Manage cargo cache (\${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively";
homepage = "https://github.com/matthiaskrgr/cargo-cache";
license = with licenses; [ asl20 /* or */ mit ];
@@ -1,4 +1,4 @@
{ stdenv
{ lib, stdenv
, fetchFromGitHub
, rustPlatform
, perl
@@ -26,7 +26,7 @@ rustPlatform.buildRustPackage rec {
buildInputs = [ openssl ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security libiconv curl ];
meta = with stdenv.lib; {
meta = with lib; {
description = "A cryptographically verifiable code review system for the cargo (Rust) package manager";
homepage = "https://github.com/crev-dev/cargo-crev";
license = with licenses; [ asl20 mit mpl20 ];
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, pkg-config, rustPlatform, Security, curl, openssl, libiconv }:
{ lib, stdenv, fetchFromGitHub, pkg-config, rustPlatform, Security, curl, openssl, libiconv }:
rustPlatform.buildRustPackage rec {
pname = "cargo-fund";
@@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
buildInputs = [ openssl ] ++ stdenv.lib.optionals stdenv.isDarwin [ Security libiconv curl ];
meta = with stdenv.lib; {
meta = with lib; {
description = "Discover funding links for your project's dependencies";
homepage = "https://github.com/acfoltzer/cargo-fund";
license = with licenses; [ mit /* or */ asl20 ];
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform }:
{ lib, stdenv, fetchFromGitHub, rustPlatform }:
rustPlatform.buildRustPackage rec {
pname = "cargo-fuzz";
@@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec {
doCheck = false;
meta = with stdenv.lib; {
meta = with lib; {
description = "Command line helpers for fuzzing";
homepage = "https://github.com/rust-fuzz/cargo-fuzz";
license = with licenses; [ mit asl20 ];
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform, Security, openssl, pkgconfig, libiconv, curl }:
{ lib, stdenv, fetchFromGitHub, rustPlatform, Security, openssl, pkgconfig, libiconv, curl }:
rustPlatform.buildRustPackage rec {
pname = "cargo-generate";
@@ -24,7 +24,7 @@ rustPlatform.buildRustPackage rec {
git config --global user.email nixbld@localhost.localnet
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "cargo, make me a project";
homepage = "https://github.com/ashleygwilliams/cargo-generate";
license = licenses.asl20;
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, runCommand, fetchCrate, rustPlatform, Security, openssl, pkg-config
{ lib, stdenv, fetchurl, runCommand, fetchCrate, rustPlatform, Security, openssl, pkg-config
, SystemConfiguration
}:
@@ -24,7 +24,7 @@ rustPlatform.buildRustPackage rec {
# https://travis-ci.org/sagiegurari/cargo-make
doCheck = false;
meta = with stdenv.lib; {
meta = with lib; {
description = "A Rust task runner and build tool";
homepage = "https://github.com/sagiegurari/cargo-make";
license = licenses.asl20;
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform
{ lib, stdenv, fetchFromGitHub, rustPlatform
, pkgconfig, curl, libgit2, openssl, Security }:
rustPlatform.buildRustPackage rec {
@@ -21,7 +21,7 @@ rustPlatform.buildRustPackage rec {
doCheck = true;
meta = with stdenv.lib; {
meta = with lib; {
description = "Generate Bazel BUILD files from Cargo dependencies";
homepage = "https://github.com/google/cargo-raze";
license = licenses.asl20;
@@ -1,4 +1,4 @@
{ stdenv, rustPlatform, fetchFromGitHub }:
{ lib, stdenv, rustPlatform, fetchFromGitHub }:
rustPlatform.buildRustPackage rec {
pname = "cargo-sweep";
@@ -13,7 +13,7 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "1sxjc64g8h77a3dvzb99f1f72zrak1nh4jgfjfkw4yc4dhkpyrmz";
meta = with stdenv.lib; {
meta = with lib; {
description = "A Cargo subcommand for cleaning up unused build files generated by Cargo";
homepage = "https://github.com/holmgr/cargo-sweep";
license = licenses.mit;
@@ -1,4 +1,4 @@
{ stdenv, rustPlatform, fetchFromGitHub }:
{ lib, stdenv, rustPlatform, fetchFromGitHub }:
rustPlatform.buildRustPackage rec {
pname = "cargo-sync-readme";
@@ -13,7 +13,7 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "1x15q6wv5278hm3ns2wmw4i8602g35y1jyv1b8wa5i4dnh52dj83";
meta = with stdenv.lib; {
meta = with lib; {
description = "A cargo plugin that generates a Markdown section in your README based on your Rust documentation";
homepage = "https://github.com/phaazon/cargo-sync-readme";
license = licenses.bsd3;
@@ -1,4 +1,4 @@
{ stdenv, rustPlatform, fetchFromGitHub, pkgconfig, openssl, CoreServices, Security, libiconv }:
{ lib, stdenv, rustPlatform, fetchFromGitHub, pkgconfig, openssl, CoreServices, Security, libiconv }:
rustPlatform.buildRustPackage rec {
pname = "cargo-udeps";
@@ -21,7 +21,7 @@ rustPlatform.buildRustPackage rec {
# Requires network access
doCheck = false;
meta = with stdenv.lib; {
meta = with lib; {
description = "Find unused dependencies in Cargo.toml";
homepage = "https://github.com/est31/cargo-udeps";
license = licenses.mit;
@@ -1,4 +1,4 @@
{ stdenv
{ lib, stdenv
, rustPlatform
, fetchFromGitHub
, nix-update-script
@@ -23,7 +23,7 @@ rustPlatform.buildRustPackage rec {
};
};
meta = with stdenv.lib; {
meta = with lib; {
description = ''Cargo subcommand "wipe": recursively finds and optionally wipes all "target" or "node_modules" folders'';
homepage = "https://github.com/mihai-dinculescu/cargo-wipe";
license = with licenses; [ mit ];
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform }:
{ lib, stdenv, fetchFromGitHub, rustPlatform }:
rustPlatform.buildRustPackage rec {
pname = "cargo-xbuild";
@@ -13,7 +13,7 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "1gcixzxca1yi4rvy55s986my6j0vx7n6fm1g5r4v4w0zgzlz4d89";
meta = with stdenv.lib; {
meta = with lib; {
description = "Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc";
homepage = "https://github.com/rust-osdev/cargo-xbuild";
license = with licenses; [ mit asl20 ];
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform, Security }:
{ lib, stdenv, fetchFromGitHub, rustPlatform, Security }:
rustPlatform.buildRustPackage rec {
pname = "rust-cbindgen";
@@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
"--skip test_expand"
];
meta = with stdenv.lib; {
meta = with lib; {
description = "A project for generating C bindings from Rust code";
homepage = "https://github.com/eqrion/cbindgen";
license = licenses.mpl20;
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform, dbus, gmp, openssl, pkgconfig
{ lib, stdenv, fetchFromGitHub, rustPlatform, dbus, gmp, openssl, pkgconfig
, darwin }:
let
@@ -25,7 +25,7 @@ in rustPlatform.buildRustPackage rec {
# Requires network access, fails in sandbox.
doCheck = false;
meta = with stdenv.lib; {
meta = with lib; {
description = "Build and publish crates with pyo3 bindings as python packages";
homepage = "https://github.com/PyO3/maturin";
license = licenses.mit;
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper, substituteAll, Security }:
{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, substituteAll, Security }:
rustPlatform.buildRustPackage rec {
pname = "racer";
@@ -39,7 +39,7 @@ rustPlatform.buildRustPackage rec {
$out/bin/racer --version
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "A utility intended to provide Rust code completion for editors and IDEs";
homepage = "https://github.com/racer-rust/racer";
license = licenses.mit;
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, fetchpatch, rustPlatform, makeWrapper, Security }:
{ lib, stdenv, fetchFromGitHub, fetchpatch, rustPlatform, makeWrapper, Security }:
rustPlatform.buildRustPackage rec {
pname = "racerd";
@@ -36,7 +36,7 @@ rustPlatform.buildRustPackage rec {
wrapProgram $out/bin/racerd --set-default RUST_SRC_PATH "$RUST_SRC_PATH"
'';
meta = with stdenv.lib; {
meta = with lib; {
broken = true;
description = "JSON/HTTP Server based on racer for adding Rust support to editors and IDEs";
homepage = "https://github.com/jwilm/racerd";
@@ -41,7 +41,7 @@ rustPlatform.buildRustPackage {
runHook postInstallCheck
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "An experimental modular compiler frontend for the Rust language";
homepage = "https://github.com/rust-analyzer/rust-analyzer";
license = with licenses; [ mit asl20 ];
@@ -70,7 +70,7 @@ rustPlatform.buildRustPackage rec {
$out/bin/rustup completions zsh cargo > "$out/share/zsh/site-functions/_cargo"
'';
meta = with stdenv.lib; {
meta = with lib; {
description = "The Rust toolchain installer";
homepage = "https://www.rustup.rs/";
license = with licenses; [ asl20 /* or */ mit ];
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, rustPlatform }:
{ lib, stdenv, fetchFromGitHub, rustPlatform }:
with rustPlatform;
@@ -19,7 +19,7 @@ buildRustPackage rec {
# doc tests fail due to missing dependency
doCheck = false;
meta = with stdenv.lib; {
meta = with lib; {
description = "Generate Rust register maps (`struct`s) from SVD files";
homepage = "https://github.com/rust-embedded/svd2rust";
license = with licenses; [ mit asl20 ];