Skip to content

Commit

Permalink
Merge pull request #212449 from Shawn8901/remove_with_lib_1
Browse files Browse the repository at this point in the history
treewide: remove global with lib; in pkgs/tools
  • Loading branch information
wegank authored Jan 24, 2023
2 parents bdf53b6 + 133fa5f commit 6b9e9ff
Show file tree
Hide file tree
Showing 46 changed files with 153 additions and 235 deletions.
4 changes: 1 addition & 3 deletions pkgs/tools/X11/xpra/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
, xorgserver
}:

with lib;

let
inherit (python3.pkgs) cython buildPythonApplication;

Expand Down Expand Up @@ -206,7 +204,7 @@ in buildPythonApplication rec {
updateScript = ./update.sh;
};

meta = {
meta = with lib; {
homepage = "https://xpra.org/";
downloadPage = "https://xpra.org/src/";
description = "Persistent remote applications for X";
Expand Down
8 changes: 3 additions & 5 deletions pkgs/tools/admin/pulumi-bin/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ lib, stdenv, fetchurl, autoPatchelfHook, makeWrapper, installShellFiles }:

with lib;

let
data = import ./data.nix {};
in stdenv.mkDerivation {
Expand All @@ -16,7 +14,7 @@ in stdenv.mkDerivation {

installPhase = ''
install -D -t $out/bin/ *
'' + optionalString stdenv.isLinux ''
'' + lib.optionalString stdenv.isLinux ''
wrapProgram $out/bin/pulumi --set LD_LIBRARY_PATH "${stdenv.cc.cc.lib}/lib"
'' + ''
installShellCompletion --cmd pulumi \
Expand All @@ -25,9 +23,9 @@ in stdenv.mkDerivation {
--zsh <($out/bin/pulumi completion zsh)
'';

nativeBuildInputs = [ installShellFiles ] ++ optionals stdenv.isLinux [ autoPatchelfHook makeWrapper ];
nativeBuildInputs = [ installShellFiles ] ++ lib.optionals stdenv.isLinux [ autoPatchelfHook makeWrapper ];

meta = {
meta = with lib; {
homepage = "https://pulumi.io/";
description = "Pulumi is a cloud development platform that makes creating cloud programs easy and productive";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
Expand Down
2 changes: 0 additions & 2 deletions pkgs/tools/admin/tigervnc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
, nixosTests
}:

with lib;

stdenv.mkDerivation rec {
version = "1.12.0";
pname = "tigervnc";
Expand Down
6 changes: 2 additions & 4 deletions pkgs/tools/backup/bup/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ assert par2Support -> par2cmdline != null;

let version = "0.32"; in

with lib;

stdenv.mkDerivation {
pname = "bup";
inherit version;
Expand All @@ -31,7 +29,7 @@ stdenv.mkDerivation {
postPatch = ''
patchShebangs .
substituteInPlace Makefile --replace "-Werror" ""
'' + optionalString par2Support ''
'' + lib.optionalString par2Support ''
substituteInPlace cmd/fsck-cmd.py --replace "'par2'" "'${par2cmdline}/bin/par2'"
'';

Expand All @@ -49,7 +47,7 @@ stdenv.mkDerivation {
--prefix PATH : ${git}/bin
'';

meta = {
meta = with lib; {
homepage = "https://github.com/bup/bup";
description = "Efficient file backup system based on the git packfile format";
license = licenses.gpl2Plus;
Expand Down
3 changes: 1 addition & 2 deletions pkgs/tools/backup/luckybackup/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
, rsync, ssh
}:

with lib;
mkDerivation rec {
pname = "luckybackup";
version = "0.5.0";
Expand All @@ -26,7 +25,7 @@ mkDerivation rec {
done
'';

meta = {
meta = with lib; {
description = "A powerful, fast and reliable backup & sync tool";
longDescription = ''
luckyBackup is an application for data back-up and synchronization
Expand Down
8 changes: 3 additions & 5 deletions pkgs/tools/bluetooth/bluez-alsa/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
# TODO: aptxSupport
}:

with lib;

stdenv.mkDerivation rec {
pname = "bluez-alsa";
version = "4.0.0";
Expand All @@ -28,17 +26,17 @@ stdenv.mkDerivation rec {
alsa-lib bluez glib sbc dbus
readline libbsd ncurses
]
++ optional aacSupport fdk_aac;
++ lib.optional aacSupport fdk_aac;

configureFlags = [
"--with-alsaplugindir=${placeholder "out"}/lib/alsa-lib"
"--with-dbusconfdir=${placeholder "out"}/share/dbus-1/system.d"
"--enable-rfcomm"
"--enable-hcitop"
]
++ optional aacSupport "--enable-aac";
++ lib.optional aacSupport "--enable-aac";

meta = {
meta = with lib; {
description = "Bluez 5 Bluetooth Audio ALSA Backend";
longDescription = ''
Bluez-ALSA (BlueALSA) is an ALSA backend for Bluez 5 audio interface.
Expand Down
4 changes: 1 addition & 3 deletions pkgs/tools/filesystems/squashfuse/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{ lib, stdenv, fetchFromGitHub, autoreconfHook, libtool, fuse,
pkg-config, lz4, xz, zlib, lzo, zstd }:

with lib;

stdenv.mkDerivation rec {

pname = "squashfuse";
Expand All @@ -22,7 +20,7 @@ stdenv.mkDerivation rec {
description = "FUSE filesystem to mount squashfs archives";
homepage = "https://github.com/vasi/squashfuse";
maintainers = [ ];
platforms = platforms.unix;
platforms = lib.platforms.unix;
license = "BSD-2-Clause";
};
}
10 changes: 4 additions & 6 deletions pkgs/tools/graphics/gifsicle/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
, static ? stdenv.hostPlatform.isStatic
}:

with lib;

stdenv.mkDerivation rec {
pname = "gifsicle";
version = "1.93";
Expand All @@ -14,11 +12,11 @@ stdenv.mkDerivation rec {
sha256 = "sha256-kvZweXMr9MHaCH5q4JBSBYRuWsd3ulyqZtEqc6qUNEc=";
};

buildInputs = optionals gifview [ xorgproto libXt libX11 ];
buildInputs = lib.optionals gifview [ xorgproto libXt libX11 ];

configureFlags = optional (!gifview) "--disable-gifview";
configureFlags = lib.optional (!gifview) "--disable-gifview";

LDFLAGS = optionalString static "-static";
LDFLAGS = lib.optionalString static "-static";

doCheck = true;
checkPhase = ''
Expand All @@ -29,7 +27,7 @@ stdenv.mkDerivation rec {
description = "Command-line tool for creating, editing, and getting information about GIF images and animations";
homepage = "https://www.lcdf.org/gifsicle/";
license = lib.licenses.gpl2;
platforms = platforms.all;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ zimbatm ];
};
}
6 changes: 2 additions & 4 deletions pkgs/tools/graphics/ldgallery/viewer/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ lib, stdenv, fetchFromGitHub, pkgs, pandoc, CoreServices }:

with lib;

let
# Note for maintainers:
# * keep version in sync with the ldgallery compiler
Expand All @@ -21,13 +19,13 @@ let
nodePkg = nodePackages.package.override {
src = "${sourcePkg}/viewer";
postInstall = "npm run build";
buildInputs = optionals stdenv.isDarwin [ CoreServices ];
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
};

in

# making sure that the source and the node package are in sync
assert versions.majorMinor nodePkg.version == removePrefix "v" sourcePkg.rev;
assert lib.versions.majorMinor nodePkg.version == lib.removePrefix "v" sourcePkg.rev;

stdenv.mkDerivation {
pname = nodePkg.packageName;
Expand Down
4 changes: 1 addition & 3 deletions pkgs/tools/graphics/optipng/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# This package comes with its own copy of zlib, libpng and pngxtern

with lib;

stdenv.mkDerivation rec {
pname = "optipng";
version = "0.7.7";
Expand All @@ -17,7 +15,7 @@ stdenv.mkDerivation rec {

buildInputs = [ libpng ];

LDFLAGS = optional static "-static";
LDFLAGS = lib.optional static "-static";
# Workaround for crash in cexcept.h. See
# https://github.com/NixOS/nixpkgs/issues/28106
preConfigure = ''
Expand Down
1 change: 0 additions & 1 deletion pkgs/tools/graphics/pgf/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{ lib, stdenv, fetchurl, autoconf, automake, libtool, dos2unix, libpgf, freeimage, doxygen }:

with lib;
stdenv.mkDerivation rec {
pname = "pgf";
version = "6.14.12";
Expand Down
14 changes: 6 additions & 8 deletions pkgs/tools/inputmethods/ibus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
, nixosTests
}:

with lib;

let
python3Runtime = python3.withPackages (ps: with ps; [ pygobject3 ]);
python3BuildEnv = python3.buildEnv.override {
Expand Down Expand Up @@ -88,10 +86,10 @@ stdenv.mkDerivation rec {

configureFlags = [
"--disable-memconf"
(enableFeature (dconf != null) "dconf")
(enableFeature (libnotify != null) "libnotify")
(enableFeature withWayland "wayland")
(enableFeature enableUI "ui")
(lib.enableFeature (dconf != null) "dconf")
(lib.enableFeature (libnotify != null) "libnotify")
(lib.enableFeature withWayland "wayland")
(lib.enableFeature enableUI "ui")
"--enable-gtk4"
"--enable-install-tests"
"--with-unicode-emoji-dir=${unicode-emoji}/share/unicode/emoji"
Expand Down Expand Up @@ -133,7 +131,7 @@ stdenv.mkDerivation rec {
isocodes
json-glib
libnotify
] ++ optionals withWayland [
] ++ lib.optionals withWayland [
libxkbcommon
wayland
];
Expand Down Expand Up @@ -165,7 +163,7 @@ stdenv.mkDerivation rec {
};
};

meta = {
meta = with lib; {
homepage = "https://github.com/ibus/ibus";
description = "Intelligent Input Bus, input method framework";
license = licenses.lgpl21Plus;
Expand Down
42 changes: 20 additions & 22 deletions pkgs/tools/inputmethods/uim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
, withMisc ? false, libeb ? null
}:

with lib;

assert withGtk2 -> gtk2 != null;
assert withGtk3 -> gtk3 != null;

Expand Down Expand Up @@ -59,18 +57,18 @@ stdenv.mkDerivation rec {
buildInputs = [
ncurses m17n_lib m17n_db expat
]
++ optional withAnthy anthy
++ optional withGtk2 gtk2
++ optional withGtk3 gtk3
++ optional withQt4 qt4
++ optionals withQt5 [ qt5.qtbase.bin qt5.qtbase.dev ]
++ optional withLibnotify libnotify
++ optional withSqlite sqlite
++ optionals withNetworking [
++ lib.optional withAnthy anthy
++ lib.optional withGtk2 gtk2
++ lib.optional withGtk3 gtk3
++ lib.optional withQt4 qt4
++ lib.optionals withQt5 [ qt5.qtbase.bin qt5.qtbase.dev ]
++ lib.optional withLibnotify libnotify
++ lib.optional withSqlite sqlite
++ lib.optionals withNetworking [
curl openssl
]
++ optional withFFI libffi
++ optional withMisc libeb;
++ lib.optional withFFI libffi
++ lib.optional withMisc libeb;

prePatch = ''
patchShebangs *.sh */*.sh */*/*.sh
Expand Down Expand Up @@ -113,25 +111,25 @@ stdenv.mkDerivation rec {
"--with-xft"
"--with-expat=${expat.dev}"
]
++ optional withAnthy "--with-anthy-utf8"
++ optional withGtk2 "--with-gtk2"
++ optional withGtk3 "--with-gtk3"
++ optionals withQt4 [
++ lib.optional withAnthy "--with-anthy-utf8"
++ lib.optional withGtk2 "--with-gtk2"
++ lib.optional withGtk3 "--with-gtk3"
++ lib.optionals withQt4 [
"--with-qt4"
"--with-qt4-immodule"
]
++ optionals withQt5 [
++ lib.optionals withQt5 [
"--with-qt5"
"--with-qt5-immodule"
]
++ optional withLibnotify "--enable-notify=libnotify"
++ optional withSqlite "--with-sqlite3"
++ optionals withNetworking [
++ lib.optional withLibnotify "--enable-notify=libnotify"
++ lib.optional withSqlite "--with-sqlite3"
++ lib.optionals withNetworking [
"--with-curl"
"--with-openssl-dir=${openssl.dev}"
]
++ optional withFFI "--with-ffi"
++ optional withMisc "--with-eb";
++ lib.optional withFFI "--with-ffi"
++ lib.optional withMisc "--with-eb";

# TODO: things in `./configure --help`, but not in nixpkgs
#--with-canna Use Canna [default=no]
Expand Down
4 changes: 1 addition & 3 deletions pkgs/tools/misc/catimg/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ lib, stdenv, fetchFromGitHub, cmake } :

with lib;

stdenv.mkDerivation rec {
pname = "catimg";
version = "2.7.0";
Expand All @@ -15,7 +13,7 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [ cmake ];

meta = {
meta = with lib; {
license = licenses.mit;
homepage = "https://github.com/posva/catimg";
description = "Insanely fast image printing in your terminal";
Expand Down
4 changes: 1 addition & 3 deletions pkgs/tools/misc/desktop-file-utils/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ lib, stdenv, fetchurl, pkg-config, meson, ninja, glib, libintl }:

with lib;

stdenv.mkDerivation rec {
pname = "desktop-file-utils";
version = "0.26";
Expand All @@ -21,7 +19,7 @@ stdenv.mkDerivation rec {

setupHook = ./setup-hook.sh;

meta = {
meta = with lib; {
homepage = "http://www.freedesktop.org/wiki/Software/desktop-file-utils";
description = "Command line utilities for working with .desktop files";
platforms = platforms.linux ++ platforms.darwin;
Expand Down
Loading

0 comments on commit 6b9e9ff

Please sign in to comment.