diff --git a/pkgs/servers/corosync/default.nix b/pkgs/servers/corosync/default.nix index 4ae9b8abed7c..f24838b2df66 100644 --- a/pkgs/servers/corosync/default.nix +++ b/pkgs/servers/corosync/default.nix @@ -7,8 +7,9 @@ , nixosTests }: -with lib; - +let + inherit (lib) optional; +in stdenv.mkDerivation rec { pname = "corosync"; version = "3.1.8"; @@ -50,7 +51,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - preConfigure = optionalString enableInfiniBandRdma '' + preConfigure = lib.optionalString enableInfiniBandRdma '' # configure looks for the pkg-config files # of librdmacm and libibverbs # Howver, rmda-core does not provide a pkg-config file @@ -70,7 +71,7 @@ stdenv.mkDerivation rec { inherit (nixosTests) pacemaker; }; - meta = { + meta = with lib; { homepage = "http://corosync.org/"; description = "Group Communication System with features for implementing high availability within applications"; license = licenses.bsd3; diff --git a/pkgs/servers/http/tengine/default.nix b/pkgs/servers/http/tengine/default.nix index d36071de2142..6f7ff9ceb765 100644 --- a/pkgs/servers/http/tengine/default.nix +++ b/pkgs/servers/http/tengine/default.nix @@ -7,8 +7,9 @@ , ... }: -with lib; - +let + inherit (lib) optional optionals optionalString; +in stdenv.mkDerivation rec { version = "3.1.0"; pname = "tengine"; @@ -22,9 +23,9 @@ stdenv.mkDerivation rec { buildInputs = [ openssl zlib pcre libxcrypt libxml2 libxslt gd geoip gperftools jemalloc ] - ++ concatMap (mod: mod.inputs or []) modules; + ++ lib.concatMap (mod: mod.inputs or []) modules; - patches = singleton (substituteAll { + patches = lib.singleton (substituteAll { src = ../nginx/nix-etag-1.15.4.patch; preInstall = '' export nixStoreDir="$NIX_STORE" nixStoreDirLen="''${#NIX_STORE}" @@ -101,7 +102,7 @@ stdenv.mkDerivation rec { env.NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2 -Wno-error=implicit-fallthrough" + optionalString stdenv.isDarwin " -Wno-error=deprecated-declarations"; - preConfigure = (concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules); + preConfigure = (lib.concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules); hardeningEnable = optional (!stdenv.isDarwin) "pie"; @@ -116,7 +117,7 @@ stdenv.mkDerivation rec { tests = nixosTests.nginx-variants.tengine; }; - meta = { + meta = with lib; { description = "Web server based on Nginx and has many advanced features, originated by Taobao"; mainProgram = "nginx"; homepage = "https://tengine.taobao.org"; diff --git a/pkgs/servers/http/unit/default.nix b/pkgs/servers/http/unit/default.nix index d2d53df71352..31f4b8bec100 100644 --- a/pkgs/servers/http/unit/default.nix +++ b/pkgs/servers/http/unit/default.nix @@ -12,8 +12,6 @@ , withDebug ? false }: -with lib; - let phpConfig = { embedSupport = true; @@ -27,6 +25,7 @@ let php81-unit = php81.override phpConfig; php82-unit = php82.override phpConfig; + inherit (lib) optional optionals optionalString; in stdenv.mkDerivation rec { version = "1.32.1"; pname = "unit"; @@ -74,7 +73,7 @@ in stdenv.mkDerivation rec { passthru.tests.unit-php = nixosTests.unit-php; - meta = { + meta = with lib; { description = "Dynamic web and application server, designed to run applications in multiple languages"; mainProgram = "unitd"; homepage = "https://unit.nginx.org/"; diff --git a/pkgs/servers/nats-streaming-server/default.nix b/pkgs/servers/nats-streaming-server/default.nix index d43bbc2fdc54..30f7b366e579 100644 --- a/pkgs/servers/nats-streaming-server/default.nix +++ b/pkgs/servers/nats-streaming-server/default.nix @@ -1,7 +1,5 @@ { buildGoModule, fetchFromGitHub, lib }: -with lib; - buildGoModule rec { pname = "nats-streaming-server"; version = "0.25.6"; @@ -18,7 +16,7 @@ buildGoModule rec { # tests fail and ask to `go install` doCheck = false; - meta = { + meta = with lib; { description = "NATS Streaming System Server"; license = licenses.asl20; maintainers = [ maintainers.swdunlop ]; diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix index b8a007c0e985..d1cc3030afd2 100644 --- a/pkgs/servers/nosql/mongodb/mongodb.nix +++ b/pkgs/servers/nosql/mongodb/mongodb.nix @@ -25,8 +25,6 @@ # The command line administrative tools are part of other packages: # see pkgs.mongodb-tools and pkgs.mongosh. -with lib; - { version, sha256, patches ? [] , license ? lib.licenses.sspl , avxSupport ? stdenv.hostPlatform.avxSupport @@ -39,7 +37,7 @@ let cheetah3 psutil setuptools - ] ++ lib.optionals (versionAtLeast version "6.0") [ + ] ++ lib.optionals (lib.versionAtLeast version "6.0") [ packaging pymongo ]); @@ -57,7 +55,7 @@ let #"stemmer" -- not nice to package yet (no versioning, no makefile, no shared libs). #"valgrind" -- mongodb only requires valgrind.h, which is vendored in the source. #"wiredtiger" - ] ++ optionals stdenv.isLinux [ "tcmalloc" ]; + ] ++ lib.optionals stdenv.isLinux [ "tcmalloc" ]; inherit (lib) systems subtractLists; in stdenv.mkDerivation rec { @@ -108,7 +106,7 @@ in stdenv.mkDerivation rec { #include ' substituteInPlace src/mongo/db/exec/plan_stats.h --replace '#include ' '#include #include ' - '' + lib.optionalString (stdenv.isDarwin && versionOlder version "6.0") '' + '' + lib.optionalString (stdenv.isDarwin && lib.versionOlder version "6.0") '' substituteInPlace src/third_party/mozjs-${mozjsVersion}/extract/js/src/jsmath.cpp --replace '${mozjsReplace}' 0 '' + lib.optionalString stdenv.isi686 '' @@ -143,9 +141,9 @@ in stdenv.mkDerivation rec { preBuild = '' sconsFlags+=" CC=$CC" sconsFlags+=" CXX=$CXX" - '' + optionalString (!stdenv.isDarwin) '' + '' + lib.optionalString (!stdenv.isDarwin) '' sconsFlags+=" AR=$AR" - '' + optionalString stdenv.isAarch64 '' + '' + lib.optionalString stdenv.isAarch64 '' sconsFlags+=" CCFLAGS='-march=armv8-a+crc'" ''; @@ -165,7 +163,7 @@ in stdenv.mkDerivation rec { ''; installTargets = - if (versionAtLeast version "6.0") then "install-devcore" + if (lib.versionAtLeast version "6.0") then "install-devcore" else "install-core"; prefixKey = "DESTDIR="; @@ -174,7 +172,7 @@ in stdenv.mkDerivation rec { hardeningEnable = [ "pie" ]; - meta = { + meta = with lib; { description = "Scalable, high-performance, open source NoSQL database"; homepage = "http://www.mongodb.org"; inherit license; diff --git a/pkgs/servers/rippled/data-api.nix b/pkgs/servers/rippled/data-api.nix index b0d63905ff96..66cdf9e8e6d2 100644 --- a/pkgs/servers/rippled/data-api.nix +++ b/pkgs/servers/rippled/data-api.nix @@ -1,10 +1,8 @@ { lib, fetchFromGitHub, nodePackages }: -with lib; - let np = nodePackages.override { generated = ./package.nix; self = np; }; -in nodePackages.buildNodePackage rec { +in nodePackages.buildNodePackage { pname = "ripple-data-api"; version = "unstable-2015-03-26"; @@ -15,11 +13,11 @@ in nodePackages.buildNodePackage rec { sha256 = "sha256-QEBdYdW55sAz6jshIAr2dSfXuqE/vqA2/kBeoxf75a8="; }; - deps = (filter (v: nixType v == "derivation") (attrValues np)); + deps = (lib.filter (v: lib.nixType v == "derivation") (lib.attrValues np)); meta = { description = "Historical ripple data"; homepage = "https://github.com/ripple/ripple-data-api"; - maintainers = with maintainers; [ offline ]; + maintainers = with lib.maintainers; [ offline ]; }; } diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix index a45b1bd488d2..f305158e601c 100644 --- a/pkgs/servers/samba/4.x.nix +++ b/pkgs/servers/samba/4.x.nix @@ -50,8 +50,6 @@ , enablePam ? (!stdenv.isDarwin), pam }: -with lib; - let # samba-tool requires libxcrypt-legacy algorithms python = python3Packages.python.override { @@ -61,6 +59,8 @@ let wrapPython = python3Packages.wrapPython.override { inherit python; }; + + inherit (lib) optional optionals; in stdenv.mkDerivation (finalAttrs: { pname = "samba"; @@ -200,7 +200,7 @@ stdenv.mkDerivation (finalAttrs: { # Save asn1_compile and compile_et so they are available to run on the build # platform when cross-compiling - postInstall = optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' + postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' mkdir -p "$dev/bin" cp bin/asn1_compile bin/compile_et "$dev/bin" ''; diff --git a/pkgs/servers/search/elasticsearch/7.x.nix b/pkgs/servers/search/elasticsearch/7.x.nix index f439b0ae4304..0244783c5873 100644 --- a/pkgs/servers/search/elasticsearch/7.x.nix +++ b/pkgs/servers/search/elasticsearch/7.x.nix @@ -11,11 +11,10 @@ , zlib }: -with lib; let - info = splitString "-" stdenv.hostPlatform.system; - arch = elemAt info 0; - plat = elemAt info 1; + info = lib.splitString "-" stdenv.hostPlatform.system; + arch = lib.elemAt info 0; + plat = lib.elemAt info 1; hashes = { x86_64-linux = "sha512-OiWGRxaCdRxXuxE/W04v87ytzOeUEcHRjF5nyRkdqSbZSnLXUyKOYQ4fKmk4til0VBOaKZYId20XyPiu/XTXNw=="; @@ -62,7 +61,7 @@ stdenv.mkDerivation rec { --replace 'bin/elasticsearch-keystore' "$out/bin/elasticsearch-keystore" wrapProgram $out/bin/elasticsearch \ - --prefix PATH : "${makeBinPath [ util-linux coreutils gnugrep ]}" \ + --prefix PATH : "${lib.makeBinPath [ util-linux coreutils gnugrep ]}" \ --set JAVA_HOME "${jre_headless}" wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre_headless}" @@ -70,9 +69,9 @@ stdenv.mkDerivation rec { passthru = { enableUnfree = true; }; - meta = { + meta = with lib; { description = "Open Source, Distributed, RESTful Search Engine"; - sourceProvenance = with lib.sourceTypes; [ + sourceProvenance = with sourceTypes; [ binaryBytecode binaryNativeCode ]; diff --git a/pkgs/servers/shishi/default.nix b/pkgs/servers/shishi/default.nix index 6f8f92e3ac99..4b3060d90b04 100644 --- a/pkgs/servers/shishi/default.nix +++ b/pkgs/servers/shishi/default.nix @@ -11,8 +11,9 @@ let optPam = shouldUsePkg pam; optLibidn = shouldUsePkg libidn; optGnutls = shouldUsePkg gnutls; + + inherit (lib) enableFeature withFeature optionalString; in -with lib; stdenv.mkDerivation rec { pname = "shishi"; version = "1.0.2"; @@ -66,7 +67,7 @@ stdenv.mkDerivation rec { -e 's,\(-ltasn1\),-L${libtasn1.out}/lib \1,' ''; - meta = { + meta = with lib; { homepage = "https://www.gnu.org/software/shishi/"; description = "Implementation of the Kerberos 5 network security system"; license = licenses.gpl3Plus; diff --git a/pkgs/servers/sql/mariadb/connector-c/default.nix b/pkgs/servers/sql/mariadb/connector-c/default.nix index be4af113c1d9..a2da81a0094f 100644 --- a/pkgs/servers/sql/mariadb/connector-c/default.nix +++ b/pkgs/servers/sql/mariadb/connector-c/default.nix @@ -4,10 +4,8 @@ , version, hash, ... }: -with lib; - let - isVer33 = versionAtLeast version "3.3"; + isVer33 = lib.versionAtLeast version "3.3"; in stdenv.mkDerivation { pname = "mariadb-connector-c"; @@ -46,12 +44,12 @@ in stdenv.mkDerivation { ''; # The cmake setup-hook uses $out/lib by default, this is not the case here. - preConfigure = optionalString stdenv.isDarwin '' + preConfigure = lib.optionalString stdenv.isDarwin '' cmakeFlagsArray+=("-DCMAKE_INSTALL_NAME_DIR=$out/lib/mariadb") ''; nativeBuildInputs = [ cmake ]; - propagatedBuildInputs = [ curl openssl zlib ] ++ optional isVer33 zstd; + propagatedBuildInputs = [ curl openssl zlib ] ++ lib.optional isVer33 zstd; buildInputs = [ libiconv ]; postInstall = '' @@ -67,7 +65,7 @@ in stdenv.mkDerivation { install -Dm644 include/ma_config.h $dev/include/mariadb/my_config.h ''; - meta = { + meta = with lib; { description = "Client library that can be used to connect to MySQL or MariaDB"; license = licenses.lgpl21Plus; maintainers = with maintainers; [ globin ]; diff --git a/pkgs/servers/xmpp/prosody/default.nix b/pkgs/servers/xmpp/prosody/default.nix index c9e606c5128b..d325ed61a40f 100644 --- a/pkgs/servers/xmpp/prosody/default.nix +++ b/pkgs/servers/xmpp/prosody/default.nix @@ -9,8 +9,6 @@ , withOnlyInstalledCommunityModules ? [ ] , withCommunityModules ? [ ] }: -with lib; - let luaEnv = lua.withPackages(p: with p; [ luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3 luaunbound @@ -72,7 +70,7 @@ stdenv.mkDerivation rec { # the wrapping should go away once lua hook is fixed postInstall = '' - ${concatMapStringsSep "\n" (module: '' + ${lib.concatMapStringsSep "\n" (module: '' cp -r $communityModules/mod_${module} $out/lib/prosody/modules/ '') (lib.lists.unique(nixosModuleDeps ++ withCommunityModules ++ withOnlyInstalledCommunityModules))} make -C tools/migration install @@ -83,7 +81,7 @@ stdenv.mkDerivation rec { tests = { inherit (nixosTests) prosody prosody-mysql; }; }; - meta = { + meta = with lib; { description = "Open-source XMPP application server written in Lua"; license = licenses.mit; homepage = "https://prosody.im";