Merge pull request #110628 from prusnak/stdenv-lib

treewide: stdenv.lib -> lib

Sandro 77f32f2f 84408a6a

Changed files
+134 -133
.github
nixos
tests
pkgs
applications
graphics
hdr-plus
misc
rescuetime
radio
science
biology
migrate
build-support
common-updater
games
shattered-pixel-dungeon
os-specific
linux
statifier
servers
fiche
foundationdb
http
envoy
test
cc-wrapper
install-shell-files
ld-library-path
patch-shebangs
stdenv-inputs
tools
graphics
metapixel
networking
lxi-tools
text
source-highlight
+1 -1
.github/CONTRIBUTING.md
···
* Not start with the package name.
* Not have a period at the end.
* `meta.license` must be set and fit the upstream license.
-
* If there is no upstream license, `meta.license` should default to `stdenv.lib.licenses.unfree`.
+
* If there is no upstream license, `meta.license` should default to `lib.licenses.unfree`.
* `meta.maintainers` must be set.
See the nixpkgs manual for more details on [standard meta-attributes](https://nixos.org/nixpkgs/manual/#sec-standard-meta-attributes) and on how to [submit changes to nixpkgs](https://nixos.org/nixpkgs/manual/#chap-submitting-changes).
+1 -1
nixos/tests/usbguard.nix
···
import ./make-test-python.nix ({ pkgs, ... }: {
name = "usbguard";
-
meta = with pkgs.stdenv.lib.maintainers; {
+
meta = with pkgs.lib.maintainers; {
maintainers = [ tnias ];
};
+2 -2
pkgs/applications/graphics/hdr-plus/default.nix
···
-
{ stdenv, fetchFromGitHub, fetchpatch
+
{ lib, stdenv, fetchFromGitHub, fetchpatch
, cmake, halide
, libpng, libjpeg, libtiff, libraw
}:
···
done
'';
-
meta = with stdenv.lib; {
+
meta = with lib; {
description = "Burst photography pipeline based on Google's HDR+";
homepage = "https://www.timothybrooks.com/tech/hdr-plus/";
license = licenses.mit;
+2 -2
pkgs/applications/misc/rescuetime/default.nix
···
passthru.updateScript = writeScript "${pname}-updater" ''
#!${stdenv.shell}
set -eu -o pipefail
-
PATH=${stdenv.lib.makeBinPath [curl pup common-updater-scripts]}:$PATH
+
PATH=${lib.makeBinPath [curl pup common-updater-scripts]}:$PATH
latestVersion="$(curl -sS https://www.rescuetime.com/release-notes/linux | pup '.release:first-of-type h2 strong text{}' | tr -d '\n')"
-
for platform in ${stdenv.lib.concatStringsSep " " meta.platforms}; do
+
for platform in ${lib.concatStringsSep " " meta.platforms}; do
# The script will not perform an update when the version attribute is up to date from previous platform run
# We need to clear it before each run
update-source-version ${pname} 0 $(yes 0 | head -64 | tr -d "\n") --system=$platform
+2 -2
pkgs/applications/radio/klog/default.nix
···
-
{ stdenv, fetchurl, hamlib, pkg-config, qt5, qtbase, qttools, qtserialport, qtcharts, qmake, wrapQtAppsHook }:
+
{ lib, stdenv, fetchurl, hamlib, pkg-config, qt5, qtbase, qttools, qtserialport, qtcharts, qmake, wrapQtAppsHook }:
stdenv.mkDerivation rec {
pname = "klog";
···
qmakeFlags = [ "KLog.pro" ];
-
meta = with stdenv.lib; {
+
meta = with lib; {
description = "A multiplatform free hamradio logger";
longDescription = ''
KLog provides QSO management, useful QSL management DX-Cluster client, DXCC management,
+2 -2
pkgs/applications/science/biology/migrate/default.nix
···
-
{ gccStdenv, fetchurl, zlib, mpi }:
+
{ lib, gccStdenv, fetchurl, zlib, mpi }:
gccStdenv.mkDerivation rec {
version = "3.7.2";
···
buildFlags = [ "thread" "mpis" ];
preInstall = "mkdir -p $out/man/man1";
-
meta = with gccStdenv.lib; {
+
meta = with lib; {
description = "Estimates population size, migration, population splitting parameters using genetic/genomic data";
homepage = "https://peterbeerli.com/migrate-html5/index.html";
license = licenses.mit;
+1 -1
pkgs/build-support/alternatives/blas/default.nix
···
Cflags: -I$dev/include
Libs: -L$out/lib -lcblas
EOF
-
'' + stdenv.lib.optionalString (blasImplementation == "mkl") ''
+
'' + lib.optionalString (blasImplementation == "mkl") ''
mkdir -p $out/nix-support
echo 'export MKL_INTERFACE_LAYER=${lib.optionalString isILP64 "I"}LP64,GNU' > $out/nix-support/setup-hook
ln -s $out/lib/libblas${canonicalExtension} $out/lib/libmkl_rt${stdenv.hostPlatform.extensions.sharedLibrary}
+1 -1
pkgs/build-support/alternatives/lapack/default.nix
···
Cflags: -I$dev/include
Libs: -L$out/lib -llapacke
EOF
-
'' + stdenv.lib.optionalString (lapackImplementation == "mkl") ''
+
'' + lib.optionalString (lapackImplementation == "mkl") ''
mkdir -p $out/nix-support
echo 'export MKL_INTERFACE_LAYER=${lib.optionalString isILP64 "I"}LP64,GNU' > $out/nix-support/setup-hook
ln -s $out/lib/liblapack${canonicalExtension} $out/lib/libmkl_rt${stdenv.hostPlatform.extensions.sharedLibrary}
+3 -2
pkgs/build-support/appimage/default.nix
···
-
{ stdenv
+
{ lib
+
, stdenv
, bash
, binutils-unwrapped
, coreutils
···
src = ./appimage-exec.sh;
isExecutable = true;
dir = "bin";
-
path = with pkgs; stdenv.lib.makeBinPath [
+
path = lib.makeBinPath [
bash
binutils-unwrapped
coreutils
+1 -1
pkgs/build-support/docker/default.nix
···
inherit imageDigest;
imageName = finalImageName;
imageTag = finalImageTag;
-
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
+
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
outputHashMode = "flat";
outputHashAlgo = "sha256";
outputHash = sha256;
+3 -5
pkgs/build-support/docker/nix-prefetch-docker.nix
···
-
{ stdenv, makeWrapper, nix, skopeo, jq }:
-
-
with stdenv.lib;
+
{ lib, stdenv, makeWrapper, nix, skopeo, jq }:
stdenv.mkDerivation {
name = "nix-prefetch-docker";
···
installPhase = ''
install -vD ${./nix-prefetch-docker} $out/bin/$name;
wrapProgram $out/bin/$name \
-
--prefix PATH : ${makeBinPath [ nix skopeo jq ]} \
+
--prefix PATH : ${lib.makeBinPath [ nix skopeo jq ]} \
--set HOME /homeless-shelter
'';
preferLocalBuild = true;
-
meta = {
+
meta = with lib; {
description = "Script used to obtain source hashes for dockerTools.pullImage";
maintainers = with maintainers; [ offline ];
platforms = platforms.unix;
+2 -2
pkgs/build-support/dotnetenv/build-solution.nix
···
-
{stdenv, dotnetfx}:
+
{ lib, stdenv, dotnetfx }:
{ name
, src
, baseDir ? "."
···
'';
preBuild = ''
-
${stdenv.lib.optionalString modifyPublicMain ''
+
${lib.optionalString modifyPublicMain ''
sed -i -e "s|static void Main|public static void Main|" ${mainClassFile}
''}
${preBuild}
+2 -2
pkgs/build-support/dotnetenv/default.nix
···
-
{stdenv, dotnetfx}:
+
{ lib, stdenv, dotnetfx }:
let dotnetenv =
{
buildSolution = import ./build-solution.nix {
-
inherit stdenv;
+
inherit lib stdenv;
dotnetfx = dotnetfx.pkg;
};
+8 -9
pkgs/build-support/fetchmavenartifact/default.nix
···
# Adaptation of the MIT-licensed work on `sbt2nix` done by Charles O'Farrell
-
{ fetchurl, stdenv }:
+
{ lib, fetchurl, stdenv }:
let
defaultRepos = [
"https://repo1.maven.org/maven2"
···
# if repos is empty, then url or urls must be specified.
assert (repos != []) || (url != "") || (urls != []);
-
let
name_ =
-
with stdenv.lib; concatStrings [
-
(replaceChars ["."] ["_"] groupId) "_"
-
(replaceChars ["."] ["_"] artifactId) "-"
+
lib.concatStrings [
+
(lib.replaceChars ["."] ["_"] groupId) "_"
+
(lib.replaceChars ["."] ["_"] artifactId) "-"
version
];
mkJarUrl = repoUrl:
-
with stdenv.lib; concatStringsSep "/" [
-
(removeSuffix "/" repoUrl)
-
(replaceChars ["."] ["/"] groupId)
+
lib.concatStringsSep "/" [
+
(lib.removeSuffix "/" repoUrl)
+
(lib.replaceChars ["."] ["/"] groupId)
artifactId
version
-
"${artifactId}-${version}${optionalString (!isNull classifier) "-${classifier}"}.jar"
+
"${artifactId}-${version}${lib.optionalString (!isNull classifier) "-${classifier}"}.jar"
];
urls_ =
if url != "" then [url]
+4 -4
pkgs/build-support/icon-conv-tools/default.nix
···
-
{ stdenv, icoutils }:
+
{ lib, stdenv, icoutils }:
stdenv.mkDerivation {
name = "icon-conv-tools-0.0.0";
···
dontPatchELF = true;
dontStrip = true;
-
meta = {
+
meta = with lib; {
description = "Tools for icon conversion specific to nix package manager";
-
maintainers = with stdenv.lib.maintainers; [ jraygauthier ];
-
platforms = with stdenv.lib.platforms; linux;
+
maintainers = with maintainers; [ jraygauthier ];
+
platforms = platforms.linux;
};
}
+2 -2
pkgs/build-support/libredirect/default.nix
···
)
'';
-
meta = {
-
platforms = stdenv.lib.platforms.unix;
+
meta = with lib; {
+
platforms = platforms.unix;
description = "An LD_PRELOAD library to intercept and rewrite the paths in glibc calls";
longDescription = ''
libredirect is an LD_PRELOAD library to intercept and rewrite the paths in
+2 -2
pkgs/build-support/ocaml/default.nix
···
-
{ stdenv, writeText, ocaml, findlib, ocamlbuild, camlp4 }:
+
{ lib, stdenv, writeText, ocaml, findlib, ocamlbuild, camlp4 }:
{ name, version, buildInputs ? [],
createFindlibDestdir ? true,
···
};
in
assert minimumSupportedOcamlVersion != null ->
-
stdenv.lib.versionOlder minimumSupportedOcamlVersion ocaml.version;
+
lib.versionOlder minimumSupportedOcamlVersion ocaml.version;
stdenv.mkDerivation (args // {
name = "ocaml-${name}-${version}";
+2 -2
pkgs/build-support/ocaml/dune.nix
···
-
{ stdenv, ocaml, findlib, dune, dune_2 }:
+
{ lib, stdenv, ocaml, findlib, dune, dune_2 }:
{ pname, version, buildInputs ? [], enableParallelBuilding ? true, ... }@args:
let Dune = if args.useDune2 or false then dune_2 else dune; in
if args ? minimumOCamlVersion &&
-
! stdenv.lib.versionAtLeast ocaml.version args.minimumOCamlVersion
+
! lib.versionAtLeast ocaml.version args.minimumOCamlVersion
then throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
else
+2 -2
pkgs/build-support/ocaml/oasis.nix
···
-
{ stdenv, ocaml_oasis, ocaml, findlib, ocamlbuild }:
+
{ lib, stdenv, ocaml_oasis, ocaml, findlib, ocamlbuild }:
{ pname, version, buildInputs ? [], meta ? { platforms = ocaml.meta.platforms or []; },
minimumOCamlVersion ? null,
···
}@args:
if args ? minimumOCamlVersion &&
-
! stdenv.lib.versionAtLeast ocaml.version args.minimumOCamlVersion
+
! lib.versionAtLeast ocaml.version args.minimumOCamlVersion
then throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
else
+3 -2
pkgs/build-support/pkg-config-wrapper/default.nix
···
# PKG_CONFIG_PATH_FOR_BUILD work properly.
{ stdenvNoCC
+
, lib
, buildPackages
, pkg-config
, baseBinName ? "pkg-config"
···
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
-
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
+
targetPrefix = lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
# See description in cc-wrapper.
···
let pkg-config_ = if pkg-config != null then pkg-config else {}; in
(if pkg-config_ ? meta then removeAttrs pkg-config.meta ["priority"] else {}) //
{ description =
-
stdenv.lib.attrByPath ["meta" "description"] "pkg-config" pkg-config_
+
lib.attrByPath ["meta" "description"] "pkg-config" pkg-config_
+ " (wrapper script)";
priority = 10;
};
+2 -2
pkgs/build-support/plugins.nix
···
-
{ stdenv }:
+
{ lib, stdenv }:
# helper functions for packaging programs with plugin systems
{
···
diffPlugins = expectedPlugins: foundPluginsFilePath: ''
# sort both lists first
plugins_expected=$(mktemp)
-
(${stdenv.lib.concatMapStrings (s: "echo \"${s}\";") expectedPlugins}) \
+
(${lib.concatMapStrings (s: "echo \"${s}\";") expectedPlugins}) \
| sort -u > "$plugins_expected"
plugins_found=$(mktemp)
sort -u "${foundPluginsFilePath}" > "$plugins_found"
+3 -4
pkgs/build-support/release/debian-build.nix
···
# that contains a Debian-like (i.e. dpkg-based) OS.
{ name ? "debian-build"
+
, lib
, diskImage
, src, stdenv, vmTools, checkinstall
, fsTranslation ? false
···
, # Features required by this package.
debRequires ? []
, ... } @ args:
-
-
with stdenv.lib;
vmTools.runInLinuxImage (stdenv.mkDerivation (
···
export PAGER=cat
${checkinstall}/sbin/checkinstall --nodoc -y -D \
--fstrans=${if fsTranslation then "yes" else "no"} \
-
--requires="${concatStringsSep "," debRequires}" \
-
--provides="${concatStringsSep "," debProvides}" \
+
--requires="${lib.concatStringsSep "," debRequires}" \
+
--provides="${lib.concatStringsSep "," debProvides}" \
${if (src ? version) then "--pkgversion=$(echo ${src.version} | tr _ -)"
else "--pkgversion=0.0.0"} \
''${debMaintainer:+--maintainer="'$debMaintainer'"} \
+4 -4
pkgs/build-support/release/default.nix
···
-
{ pkgs }:
+
{ lib, pkgs }:
with pkgs;
···
} // args);
nixBuild = args: import ./nix-build.nix (
-
{ inherit stdenv;
+
{ inherit lib stdenv;
} // args);
coverageAnalysis = args: nixBuild (
···
} // args);
debBuild = args: import ./debian-build.nix (
-
{ inherit stdenv vmTools checkinstall;
+
{ inherit lib stdenv vmTools checkinstall;
} // args);
aggregate =
···
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
-
patchPhase = stdenv.lib.optionalString isNixOS ''
+
patchPhase = lib.optionalString isNixOS ''
touch .update-on-nixos-rebuild
'';
+6 -6
pkgs/build-support/release/nix-build.nix
···
, doCoverityAnalysis ? false
, lcovFilter ? []
, lcovExtraTraceFiles ? []
-
, src, stdenv
+
, src, lib, stdenv
, name ? if doCoverageAnalysis then "nix-coverage" else "nix-build"
, failureHook ? null
, prePhases ? []
···
fi
'';
-
failureHook = (stdenv.lib.optionalString (failureHook != null) failureHook) +
+
failureHook = (lib.optionalString (failureHook != null) failureHook) +
''
if test -n "$succeedOnFailure"; then
if test -n "$keepBuildDirectory"; then
···
buildInputs =
buildInputs ++
-
(stdenv.lib.optional doCoverageAnalysis args.makeGCOVReport) ++
-
(stdenv.lib.optional doClangAnalysis args.clang-analyzer) ++
-
(stdenv.lib.optional doCoverityAnalysis args.cov-build) ++
-
(stdenv.lib.optional doCoverityAnalysis args.xz);
+
(lib.optional doCoverageAnalysis args.makeGCOVReport) ++
+
(lib.optional doClangAnalysis args.clang-analyzer) ++
+
(lib.optional doCoverityAnalysis args.cov-build) ++
+
(lib.optional doCoverityAnalysis args.xz);
lcovFilter = ["/nix/store/*"] ++ lcovFilter;
+3 -3
pkgs/build-support/rust/default-crate-overrides.nix
···
-
{ stdenv, pkg-config, curl, darwin, libiconv, libgit2, libssh2,
+
{ lib, stdenv, pkg-config, curl, darwin, libiconv, libgit2, libssh2,
openssl, sqlite, zlib, dbus, dbus-glib, gdk-pixbuf, cairo, python3,
libsodium, postgresql, gmp, foundationdb, capnproto, nettle, clang,
llvmPackages, ... }:
···
cargo = attrs: {
buildInputs = [ openssl zlib curl ]
-
++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Security libiconv ];
+
++ lib.optionals stdenv.isDarwin [ CoreFoundation Security libiconv ];
};
libz-sys = attrs: {
···
};
serde_derive = attrs: {
-
buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
+
buildInputs = lib.optional stdenv.isDarwin Security;
};
thrussh-libsodium = attrs: {
+14 -13
pkgs/build-support/rust/default.nix
···
{ stdenv
+
, lib
, buildPackages
, cacert
, cargo
···
cargoDepsCopy="$sourceRoot/${cargoVendorDir}"
'';
-
targetIsJSON = stdenv.lib.hasSuffix ".json" target;
+
targetIsJSON = lib.hasSuffix ".json" target;
useSysroot = targetIsJSON && !__internal_dontAddSysroot;
# see https://github.com/rust-lang/cargo/blob/964a16a28e234a3d397b2a7031d4ab4a428b1391/src/cargo/core/compiler/compile_kind.rs#L151-L168
# the "${}" is needed to transform the path into a /nix/store path before baseNameOf
shortTarget = if targetIsJSON then
-
(stdenv.lib.removeSuffix ".json" (builtins.baseNameOf "${target}"))
+
(lib.removeSuffix ".json" (builtins.baseNameOf "${target}"))
else target;
sysroot = (callPackage ./sysroot {}) {
···
# See https://os.phil-opp.com/testing/ for more information.
assert useSysroot -> !(args.doCheck or true);
-
stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // stdenv.lib.optionalAttrs useSysroot {
+
stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs useSysroot {
RUSTFLAGS = "--sysroot ${sysroot} " + (args.RUSTFLAGS or "");
} // {
inherit cargoDeps;
···
patchRegistryDeps = ./patch-registry-deps;
nativeBuildInputs = nativeBuildInputs ++ [ cacert git cargo rustc ];
-
buildInputs = buildInputs ++ stdenv.lib.optional stdenv.hostPlatform.isMinGW windows.pthreads;
+
buildInputs = buildInputs ++ lib.optional stdenv.hostPlatform.isMinGW windows.pthreads;
patches = cargoPatches ++ patches;
···
cat >> .cargo/config <<'EOF'
[target."${rust.toRustTarget stdenv.buildPlatform}"]
"linker" = "${ccForBuild}"
-
${stdenv.lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) ''
+
${lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) ''
[target."${shortTarget}"]
"linker" = "${ccForHost}"
${# https://github.com/rust-lang/rust/issues/46651#issuecomment-433611633
-
stdenv.lib.optionalString (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isAarch64) ''
+
lib.optionalString (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isAarch64) ''
"rustflags" = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ]
''}
''}
···
# After unpacking and applying patches, check that the Cargo.lock matches our
# src package. Note that we do this after the patchPhase, because the
# patchPhase may create the Cargo.lock if upstream has not shipped one.
-
postPatch = (args.postPatch or "") + stdenv.lib.optionalString validateCargoDeps ''
+
postPatch = (args.postPatch or "") + lib.optionalString validateCargoDeps ''
cargoDepsLockfile=$NIX_BUILD_TOP/$cargoDepsCopy/Cargo.lock
srcLockfile=$NIX_BUILD_TOP/$sourceRoot/Cargo.lock
···
'';
buildPhase = with builtins; args.buildPhase or ''
-
${stdenv.lib.optionalString (buildAndTestSubdir != null) "pushd ${buildAndTestSubdir}"}
+
${lib.optionalString (buildAndTestSubdir != null) "pushd ${buildAndTestSubdir}"}
runHook preBuild
(
···
"CC_${rust.toRustTarget stdenv.hostPlatform}"="${ccForHost}" \
"CXX_${rust.toRustTarget stdenv.hostPlatform}"="${cxxForHost}" \
cargo build -j $NIX_BUILD_CORES \
-
${stdenv.lib.optionalString (buildType == "release") "--release"} \
+
${lib.optionalString (buildType == "release") "--release"} \
--target ${target} \
--frozen ${concatStringsSep " " cargoBuildFlags}
)
runHook postBuild
-
${stdenv.lib.optionalString (buildAndTestSubdir != null) "popd"}
+
${lib.optionalString (buildAndTestSubdir != null) "popd"}
# This needs to be done after postBuild: packages like `cargo` do a pushd/popd in
# the pre/postBuild-hooks that need to be taken into account before gathering
···
'';
checkPhase = args.checkPhase or (let
-
argstr = "${stdenv.lib.optionalString (checkType == "release") "--release"} --target ${target} --frozen";
+
argstr = "${lib.optionalString (checkType == "release") "--release"} --target ${target} --frozen";
threads = if cargoParallelTestThreads then "$NIX_BUILD_CORES" else "1";
in ''
-
${stdenv.lib.optionalString (buildAndTestSubdir != null) "pushd ${buildAndTestSubdir}"}
+
${lib.optionalString (buildAndTestSubdir != null) "pushd ${buildAndTestSubdir}"}
runHook preCheck
echo "Running cargo test ${argstr} -- ''${checkFlags} ''${checkFlagsArray+''${checkFlagsArray[@]}}"
cargo test -j $NIX_BUILD_CORES ${argstr} -- --test-threads=${threads} ''${checkFlags} ''${checkFlagsArray+"''${checkFlagsArray[@]}"}
runHook postCheck
-
${stdenv.lib.optionalString (buildAndTestSubdir != null) "popd"}
+
${lib.optionalString (buildAndTestSubdir != null) "popd"}
'');
doCheck = args.doCheck or true;
+2 -2
pkgs/build-support/rust/fetchCargoTarball.nix
···
-
{ stdenv, cacert, git, cargo, python3 }:
+
{ lib, stdenv, cacert, git, cargo, python3 }:
let cargo-vendor-normalise = stdenv.mkDerivation {
name = "cargo-vendor-normalise";
src = ./cargo-vendor-normalise.py;
···
inherit (hash_) outputHashAlgo outputHash;
-
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
+
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
} // (builtins.removeAttrs args [
"name" "sha256" "cargoUpdateHook"
]))
+2 -1
pkgs/build-support/singularity-tools/default.nix
···
{ runCommand
+
, lib
, stdenv
, storeDir ? builtins.storeDir
, writeScript
···
mkdir proc sys dev
# Run root script
-
${stdenv.lib.optionalString (runAsRoot != null) ''
+
${lib.optionalString (runAsRoot != null) ''
mkdir -p ./${storeDir}
mount --rbind ${storeDir} ./${storeDir}
unshare -imnpuf --mount-proc chroot ./ ${runAsRootFile}
+3 -4
pkgs/build-support/skaware/build-skaware-package.nix
···
-
{ stdenv, cleanPackaging, fetchurl }:
-
let lib = stdenv.lib;
-
in {
+
{ lib, stdenv, cleanPackaging, fetchurl }:
+
{
# : string
pname
# : string
···
meta = {
homepage = "https://skarnet.org/software/${pname}/";
inherit description platforms;
-
license = stdenv.lib.licenses.isc;
+
license = lib.licenses.isc;
maintainers = with lib.maintainers;
[ pmahoney Profpatsch ] ++ maintainers;
};
+2 -2
pkgs/build-support/skaware/clean-packaging.nix
···
# files were either discarded or moved to outputs.
# This ensures nothing is forgotten and new files
# are correctly handled on update.
-
{ stdenv, file, writeScript }:
+
{ lib, stdenv, file, writeScript }:
let
-
globWith = stdenv.lib.concatMapStringsSep "\n";
+
globWith = lib.concatMapStringsSep "\n";
rmNoise = noiseGlobs: globWith (f:
''rm -rf ${f}'') noiseGlobs;
mvDoc = docGlobs: globWith
+3 -3
pkgs/build-support/substitute-files/substitute-all-files.nix
···
-
{ stdenv }:
+
{ lib, stdenv }:
args:
stdenv.mkDerivation ({
name = if args ? name then args.name else baseNameOf (toString args.src);
-
builder = with stdenv.lib; builtins.toFile "builder.sh" ''
+
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
set -o pipefail
···
args=
pushd "$src"
-
echo -ne "${concatStringsSep "\\0" args.files}" | xargs -0 -n1 -I {} -- find {} -type f -print0 | while read -d "" line; do
+
echo -ne "${lib.concatStringsSep "\\0" args.files}" | xargs -0 -n1 -I {} -- find {} -type f -print0 | while read -d "" line; do
mkdir -p "$out/$(dirname "$line")"
substituteAll "$line" "$out/$line"
done
+1 -1
pkgs/build-support/templaterpm/default.nix
···
meta = with lib; {
description = "Create templates of nix expressions from RPM .spec files";
maintainers = with maintainers; [ tstrobel ];
-
platforms = with stdenv.lib.platforms; unix;
+
platforms = platforms.unix;
hydraPlatforms = [];
};
}
+3 -2
pkgs/build-support/vm/default.nix
···
-
{ pkgs
+
{ lib
+
, pkgs
, kernel ? pkgs.linux
, img ? pkgs.stdenv.hostPlatform.linux-kernel.target
, storeDir ? builtins.storeDir
···
buildCommand = ''
${createRootFS}
-
PATH=$PATH:${stdenv.lib.makeBinPath [ dpkg dpkg glibc lzma ]}
+
PATH=$PATH:${lib.makeBinPath [ dpkg dpkg glibc lzma ]}
# Unpack the .debs. We do this to prevent pre-install scripts
# (which have lots of circular dependencies) from barfing.
+1 -1
pkgs/build-support/writers/test.nix
···
in runCommand "test-writers" {
passthru = { inherit writeTest bin simple; };
-
meta.platforms = stdenv.lib.platforms.all;
+
meta.platforms = lib.platforms.all;
} ''
${lib.concatMapStringsSep "\n" (test: writeTest "success" "${test}/bin/test_writers") (lib.attrValues bin)}
${lib.concatMapStringsSep "\n" (test: writeTest "success" test) (lib.attrValues simple)}
+2 -2
pkgs/common-updater/scripts.nix
···
-
{ stdenv, makeWrapper, coreutils, gnused, gnugrep, diffutils, nix, git, jq }:
+
{ lib, stdenv, makeWrapper, coreutils, gnused, gnugrep, diffutils, nix, git, jq }:
stdenv.mkDerivation {
name = "common-updater-scripts";
···
cp ${./scripts}/* $out/bin
for f in $out/bin/*; do
-
wrapProgram $f --prefix PATH : ${stdenv.lib.makeBinPath [ coreutils gnused gnugrep nix diffutils git jq ]}
+
wrapProgram $f --prefix PATH : ${lib.makeBinPath [ coreutils gnused gnugrep nix diffutils git jq ]}
done
'';
}
+2 -2
pkgs/games/shattered-pixel-dungeon/default.nix
···
buildPhase = ''
export GRADLE_USER_HOME=$(mktemp -d)
# https://github.com/gradle/gradle/issues/4426
-
${stdenv.lib.optionalString stdenv.isDarwin "export TERM=dumb"}
+
${lib.optionalString stdenv.isDarwin "export TERM=dumb"}
gradle --no-daemon desktop:release
'';
# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
···
buildPhase = ''
export GRADLE_USER_HOME=$(mktemp -d)
# https://github.com/gradle/gradle/issues/4426
-
${stdenv.lib.optionalString stdenv.isDarwin "export TERM=dumb"}
+
${lib.optionalString stdenv.isDarwin "export TERM=dumb"}
# point to offline repo
sed -ie "s#repositories {#repositories { maven { url '${deps}' };#g" build.gradle
gradle --offline --no-daemon desktop:release
+2 -2
pkgs/os-specific/linux/statifier/default.nix
···
-
{ multiStdenv, fetchurl }:
+
{ lib, multiStdenv, fetchurl }:
let version = "1.7.4"; in
multiStdenv.mkDerivation {
···
sed -e s@/bin/bash@"${multiStdenv.shell}"@g -i src/*.sh
'';
-
meta = with multiStdenv.lib; {
+
meta = with lib; {
description = "Tool for creating static Linux binaries";
platforms = platforms.linux;
license = licenses.gpl2;
+2 -2
pkgs/servers/fiche/default.nix
···
-
{ stdenv, fetchFromGitHub }:
+
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "fiche";
···
doCheck = true;
-
meta = with stdenv.lib; {
+
meta = with lib; {
description = "Command line pastebin for sharing terminal output";
longDescription = ''
Fiche is a command line pastebin server for sharing terminal output.
+1 -1
pkgs/servers/foundationdb/vsmake.nix
···
outputs = [ "out" "lib" "dev" "pythonsrc" ];
-
meta = with gcc6Stdenv.lib; {
+
meta = with lib; {
description = "Open source, distributed, transactional key-value store";
homepage = "https://www.foundationdb.org";
license = licenses.asl20;
+3 -2
pkgs/servers/http/envoy/default.nix
···
-
{ buildBazelPackage
+
{ lib
+
, buildBazelPackage
, fetchFromGitHub
, stdenv
, cmake
···
"--cxxopt=-Wno-uninitialized"
];
-
meta = with stdenv.lib; {
+
meta = with lib; {
homepage = "https://envoyproxy.io";
description = "Cloud-native edge and service proxy";
license = licenses.asl20;
+10 -10
pkgs/test/cc-wrapper/default.nix
···
-
{ stdenv, glibc }:
-
with stdenv.lib;
+
{ lib, stdenv, glibc }:
+
let
# Sanitizers are not supported on Darwin.
# Sanitizer headers aren't available in older libc++ stdenvs due to a bug
sanitizersWorking = !stdenv.hostPlatform.isMusl && (
-
(stdenv.cc.isClang && versionAtLeast (getVersion stdenv.cc.name) "5.0.0")
+
(stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion stdenv.cc.name) "5.0.0")
|| (stdenv.cc.isGNU && stdenv.isLinux)
);
-
staticLibc = optionalString (stdenv.hostPlatform.libc == "glibc") "-L ${glibc.static}/lib";
+
staticLibc = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "-L ${glibc.static}/lib";
in stdenv.mkDerivation {
name = "cc-wrapper-test";
···
$CXX -o cxx-check ${./cxx-main.cc}
./cxx-check
-
${optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
+
${lib.optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
printf "checking whether compiler can build with CoreFoundation.framework... " >&2
mkdir -p foo/lib
$CC -framework CoreFoundation -o core-foundation-check ${./core-foundation-main.c}
···
''}
-
${optionalString (!stdenv.isDarwin) ''
+
${lib.optionalString (!stdenv.isDarwin) ''
printf "checking whether compiler builds valid static C binaries... " >&2
$CC ${staticLibc} -static -o cc-static ${./cc-main.c}
./cc-static
# our glibc does not have pie enabled yet.
-
${optionalString (stdenv.hostPlatform.isMusl && stdenv.cc.isGNU) ''
+
${lib.optionalString (stdenv.hostPlatform.isMusl && stdenv.cc.isGNU) ''
printf "checking whether compiler builds valid static pie C binaries... " >&2
$CC ${staticLibc} -static-pie -o cc-static-pie ${./cc-main.c}
./cc-static-pie
···
printf "checking whether compiler uses NIX_LDFLAGS... " >&2
mkdir -p foo/lib
$CC -shared \
-
${optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
+
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
-DVALUE=42 \
-o foo/lib/libfoo${stdenv.hostPlatform.extensions.sharedLibrary} \
${./foo.c}
···
$CXX -I std-include -nostdinc++ -o nostdinc-main++ ${./nostdinc-main.c}
./nostdinc-main++
-
${optionalString sanitizersWorking ''
+
${lib.optionalString sanitizersWorking ''
printf "checking whether sanitizers are fully functional... ">&2
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
./sanitizers
···
touch $out
'';
-
meta.platforms = platforms.all;
+
meta.platforms = lib.platforms.all;
}
+2 -2
pkgs/test/cc-wrapper/multilib.nix
···
-
{ stdenv }:
+
{ lib, stdenv }:
stdenv.mkDerivation {
name = "cc-multilib-test";
···
touch $out
'';
-
meta.platforms = stdenv.lib.platforms.x86_64;
+
meta.platforms = lib.platforms.x86_64;
}
+2 -2
pkgs/test/install-shell-files/default.nix
···
-
{ stdenv, runCommandLocal, recurseIntoAttrs, installShellFiles }:
+
{ lib, stdenv, runCommandLocal, recurseIntoAttrs, installShellFiles }:
let
runTest = name: env: buildCommand:
runCommandLocal "install-shell-files--${name}" ({
nativeBuildInputs = [ installShellFiles ];
-
meta.platforms = stdenv.lib.platforms.all;
+
meta.platforms = lib.platforms.all;
} // env) buildCommand;
in
+2 -2
pkgs/test/ld-library-path/default.nix
···
-
{ stdenv }:
+
{ lib, stdenv }:
# This tests that libraries listed in LD_LIBRARY_PATH take precedence over those listed in RPATH.
···
touch $out
'';
-
meta.platforms = stdenv.lib.platforms.linux;
+
meta.platforms = lib.platforms.linux;
}
+2 -2
pkgs/test/patch-shebangs/default.nix
···
-
{ stdenv, runCommand }:
+
{ lib, stdenv, runCommand }:
let
bad-shebang = stdenv.mkDerivation {
···
};
in runCommand "patch-shebangs-test" {
passthru = { inherit bad-shebang; };
-
meta.platforms = stdenv.lib.platforms.all;
+
meta.platforms = lib.platforms.all;
} ''
printf "checking whether patchShebangs works properly... ">&2
if ! grep -q '^#!/bin/sh' ${bad-shebang}/bin/test; then
+4 -4
pkgs/test/stdenv-inputs/default.nix
···
-
{ stdenv }:
+
{ lib, stdenv }:
let
foo = stdenv.mkDerivation {
···
chmod +x $out/bin/foo
cp ${./foo.c} $out/include/foo.h
$CC -shared \
-
${stdenv.lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/libfoo.dylib"} \
+
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$out/lib/libfoo.dylib"} \
-o $out/lib/libfoo${stdenv.hostPlatform.extensions.sharedLibrary} \
${./foo.c}
'';
···
chmod +x $out/bin/bar
cp ${./bar.c} $dev/include/bar.h
$CC -shared \
-
${stdenv.lib.optionalString stdenv.isDarwin "-Wl,-install_name,$dev/lib/libbar.dylib"} \
+
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,$dev/lib/libbar.dylib"} \
-o $dev/lib/libbar${stdenv.hostPlatform.extensions.sharedLibrary} \
${./bar.c}
'';
···
touch $out
'';
-
meta.platforms = stdenv.lib.platforms.all;
+
meta.platforms = lib.platforms.all;
}
+2 -2
pkgs/tools/graphics/metapixel/default.nix
···
-
{ stdenv, fetchFromGitHub, libpng, libjpeg, giflib, perl, pkg-config }:
+
{ lib, stdenv, fetchFromGitHub, libpng, libjpeg, giflib, perl, pkg-config }:
stdenv.mkDerivation rec {
pname = "metapixel";
···
cp metapixel-sizesort $out/bin/metapixel-sizesort
'';
-
meta = with stdenv.lib; {
+
meta = with lib; {
homepage = "https://github.com/schani/metapixel";
description = "Tool for generating photomosaics";
license = licenses.gpl2Only;
+2 -2
pkgs/tools/networking/lxi-tools/default.nix
···
-
{ stdenv, fetchFromGitHub
+
{ lib, stdenv, fetchFromGitHub
, autoreconfHook, pkg-config
, liblxi, readline, lua
}:
···
buildInputs = [ liblxi readline lua ];
-
meta = with stdenv.lib; {
+
meta = with lib; {
description = "Tool for communicating with LXI compatible instruments";
longDescription = ''
lxi-tools is a collection of open source software tools
+1 -1
pkgs/tools/text/source-highlight/default.nix
···
# source-highlight uses it's own binary to generate documentation.
# During cross-compilation, that binary was built for the target
# platform architecture, so it can't run on the build host.
-
patchPhase = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+
patchPhase = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
substituteInPlace Makefile.in --replace "src doc tests" "src tests"
'';