diff --git a/pkgs/applications/emulators/xcpc/default.nix b/pkgs/applications/emulators/xcpc/default.nix index d2d946c400fd1..d5a2a6a50fe1f 100644 --- a/pkgs/applications/emulators/xcpc/default.nix +++ b/pkgs/applications/emulators/xcpc/default.nix @@ -3,7 +3,6 @@ , motifSupport ? false, lesstif }: -with lib; stdenv.mkDerivation rec { version = "20070122"; pname = "xcpc"; @@ -16,10 +15,10 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config ]; buildInputs = [ glib libdsk libXaw libX11 libXext ] - ++ optional libDSKSupport libdsk - ++ optional motifSupport lesstif; + ++ lib.optional libDSKSupport libdsk + ++ lib.optional motifSupport lesstif; - meta = { + meta = with lib; { description = "Portable Amstrad CPC 464/664/6128 emulator written in C"; homepage = "https://www.xcpc-emulator.net"; license = licenses.gpl2Plus; diff --git a/pkgs/applications/file-managers/noice/default.nix b/pkgs/applications/file-managers/noice/default.nix index d41c12faad8d1..7421a3816d292 100644 --- a/pkgs/applications/file-managers/noice/default.nix +++ b/pkgs/applications/file-managers/noice/default.nix @@ -1,7 +1,5 @@ { lib, stdenv, fetchgit, ncurses, conf ? null }: -with lib; - stdenv.mkDerivation rec { pname = "noice"; version = "0.8"; @@ -18,8 +16,8 @@ stdenv.mkDerivation rec { substituteInPlace noice.c --replace 'printw(str);' 'printw("%s", str);' ''; - configFile = optionalString (conf!=null) (builtins.toFile "config.def.h" conf); - preBuild = optionalString (conf!=null) "cp ${configFile} config.def.h"; + configFile = lib.optionalString (conf!=null) (builtins.toFile "config.def.h" conf); + preBuild = lib.optionalString (conf!=null) "cp ${configFile} config.def.h"; buildInputs = [ ncurses ]; @@ -27,7 +25,7 @@ stdenv.mkDerivation rec { installFlags = [ "DESTDIR=$(out)" "PREFIX=" ]; - meta = { + meta = with lib; { description = "Small ncurses-based file browser"; homepage = "https://git.2f30.org/noice/"; license = licenses.bsd2; diff --git a/pkgs/applications/graphics/figma-linux/default.nix b/pkgs/applications/graphics/figma-linux/default.nix index 72f5ed882c401..159dcd85b8010 100644 --- a/pkgs/applications/graphics/figma-linux/default.nix +++ b/pkgs/applications/graphics/figma-linux/default.nix @@ -8,7 +8,6 @@ , wrapGAppsHook3 , ... }: -with lib; stdenv.mkDerivation (finalAttrs: { pname = "figma-linux"; version = "0.11.4"; @@ -82,7 +81,7 @@ stdenv.mkDerivation (finalAttrs: { --replace "Exec=/opt/figma-linux/figma-linux" "Exec=$out/bin/${finalAttrs.pname}" ''; - meta = { + meta = with lib; { description = "Unofficial Electron-based Figma desktop app for Linux"; homepage = "https://github.com/Figma-Linux/figma-linux"; platforms = [ "x86_64-linux" ]; diff --git a/pkgs/applications/graphics/gscan2pdf/default.nix b/pkgs/applications/graphics/gscan2pdf/default.nix index 915a9966ef2c7..62acb1713c170 100644 --- a/pkgs/applications/graphics/gscan2pdf/default.nix +++ b/pkgs/applications/graphics/gscan2pdf/default.nix @@ -6,8 +6,6 @@ # test dependencies xvfb-run, liberation_ttf, file, tesseract }: -with lib; - perlPackages.buildPerlPackage rec { pname = "gscan2pdf"; version = "2.13.3"; @@ -132,7 +130,7 @@ perlPackages.buildPerlPackage rec { make test ''; - meta = { + meta = with lib; { description = "GUI to produce PDFs or DjVus from scanned documents"; homepage = "https://gscan2pdf.sourceforge.net/"; license = licenses.gpl3; diff --git a/pkgs/applications/graphics/image_optim/default.nix b/pkgs/applications/graphics/image_optim/default.nix index 1d9048cafaa66..feceb00c31e84 100644 --- a/pkgs/applications/graphics/image_optim/default.nix +++ b/pkgs/applications/graphics/image_optim/default.nix @@ -13,34 +13,32 @@ withSvgo ? true, svgo }: -with lib; - let - optionalDepsPath = optional withPngcrush pngcrush - ++ optional withPngout pngout - ++ optional withAdvpng advancecomp - ++ optional withOptipng optipng - ++ optional withPngquant pngquant - ++ optional withOxipng oxipng - ++ optional withJhead jhead - ++ optional withJpegoptim jpegoptim - ++ optional withJpegrecompress jpeg-archive - ++ optional withJpegtran libjpeg - ++ optional withGifsicle gifsicle - ++ optional withSvgo svgo; + optionalDepsPath = lib.optional withPngcrush pngcrush + ++ lib.optional withPngout pngout + ++ lib.optional withAdvpng advancecomp + ++ lib.optional withOptipng optipng + ++ lib.optional withPngquant pngquant + ++ lib.optional withOxipng oxipng + ++ lib.optional withJhead jhead + ++ lib.optional withJpegoptim jpegoptim + ++ lib.optional withJpegrecompress jpeg-archive + ++ lib.optional withJpegtran libjpeg + ++ lib.optional withGifsicle gifsicle + ++ lib.optional withSvgo svgo; - disabledWorkersFlags = optional (!withPngcrush) "--no-pngcrush" - ++ optional (!withPngout) "--no-pngout" - ++ optional (!withAdvpng) "--no-advpng" - ++ optional (!withOptipng) "--no-optipng" - ++ optional (!withPngquant) "--no-pngquant" - ++ optional (!withOxipng) "--no-oxipng" - ++ optional (!withJhead) "--no-jhead" - ++ optional (!withJpegoptim) "--no-jpegoptim" - ++ optional (!withJpegrecompress) "--no-jpegrecompress" - ++ optional (!withJpegtran) "--no-jpegtran" - ++ optional (!withGifsicle) "--no-gifsicle" - ++ optional (!withSvgo) "--no-svgo"; + disabledWorkersFlags = lib.optional (!withPngcrush) "--no-pngcrush" + ++ lib.optional (!withPngout) "--no-pngout" + ++ lib.optional (!withAdvpng) "--no-advpng" + ++ lib.optional (!withOptipng) "--no-optipng" + ++ lib.optional (!withPngquant) "--no-pngquant" + ++ lib.optional (!withOxipng) "--no-oxipng" + ++ lib.optional (!withJhead) "--no-jhead" + ++ lib.optional (!withJpegoptim) "--no-jpegoptim" + ++ lib.optional (!withJpegrecompress) "--no-jpegrecompress" + ++ lib.optional (!withJpegtran) "--no-jpegtran" + ++ lib.optional (!withGifsicle) "--no-gifsicle" + ++ lib.optional (!withSvgo) "--no-svgo"; in bundlerApp { @@ -53,7 +51,7 @@ bundlerApp { postBuild = '' wrapProgram $out/bin/image_optim \ - --prefix PATH : ${lib.escapeShellArg (makeBinPath optionalDepsPath)} \ + --prefix PATH : ${lib.escapeShellArg (lib.makeBinPath optionalDepsPath)} \ --add-flags "${lib.concatStringsSep " " disabledWorkersFlags}" ''; diff --git a/pkgs/applications/graphics/rx/default.nix b/pkgs/applications/graphics/rx/default.nix index c2561ed82ae51..5b7162299952f 100644 --- a/pkgs/applications/graphics/rx/default.nix +++ b/pkgs/applications/graphics/rx/default.nix @@ -3,8 +3,6 @@ , xorg ? null , libGL ? null }: -with lib; - rustPlatform.buildRustPackage rec { pname = "rx"; version = "0.5.2"; @@ -20,7 +18,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ cmake pkg-config makeWrapper ]; - buildInputs = optionals stdenv.isLinux + buildInputs = lib.optionals stdenv.isLinux (with xorg; [ # glfw-sys dependencies: libX11 libXrandr libXinerama libXcursor libXi libXext @@ -29,13 +27,13 @@ rustPlatform.buildRustPackage rec { # FIXME: GLFW (X11) requires DISPLAY env variable for all tests doCheck = false; - postInstall = optionalString stdenv.isLinux '' + postInstall = lib.optionalString stdenv.isLinux '' mkdir -p $out/share/applications cp $src/rx.desktop $out/share/applications wrapProgram $out/bin/rx --prefix LD_LIBRARY_PATH : ${libGL}/lib ''; - meta = { + meta = with lib; { description = "Modern and extensible pixel editor implemented in Rust"; mainProgram = "rx"; homepage = "https://rx.cloudhead.io/"; diff --git a/pkgs/applications/graphics/sane/config.nix b/pkgs/applications/graphics/sane/config.nix index 0405eeb05c2c4..c637ff3cfcd32 100644 --- a/pkgs/applications/graphics/sane/config.nix +++ b/pkgs/applications/graphics/sane/config.nix @@ -2,7 +2,7 @@ { paths, disabledDefaultBackends ? [] }: -with lib; + let installSanePath = path: '' if [ -e "${path}/lib/sane" ]; then @@ -48,6 +48,6 @@ stdenv.mkDerivation { mkdir -p $out/etc/sane.d $out/etc/sane.d/dll.d $out/lib/sane '' - + (concatMapStrings installSanePath paths) - + (concatMapStrings disableBackend disabledDefaultBackends); + + (lib.concatMapStrings installSanePath paths) + + (lib.concatMapStrings disableBackend disabledDefaultBackends); } diff --git a/pkgs/applications/graphics/sxiv/default.nix b/pkgs/applications/graphics/sxiv/default.nix index f3d7086d4a098..09855af551fe7 100644 --- a/pkgs/applications/graphics/sxiv/default.nix +++ b/pkgs/applications/graphics/sxiv/default.nix @@ -1,7 +1,5 @@ { lib, stdenv, fetchFromGitHub, libXft, imlib2, giflib, libexif, conf ? null }: -with lib; - stdenv.mkDerivation rec { pname = "sxiv"; version = "26"; @@ -13,8 +11,8 @@ stdenv.mkDerivation rec { sha256 = "0xaawlfdy7b277m38mgg4423kd7p1ffn0dq4hciqs6ivbb3q9c4f"; }; - configFile = optionalString (conf!=null) (builtins.toFile "config.def.h" conf); - preBuild = optionalString (conf!=null) "cp ${configFile} config.def.h"; + configFile = lib.optionalString (conf!=null) (builtins.toFile "config.def.h" conf); + preBuild = lib.optionalString (conf!=null) "cp ${configFile} config.def.h"; buildInputs = [ libXft imlib2 giflib libexif ]; @@ -24,7 +22,7 @@ stdenv.mkDerivation rec { install -Dt $out/share/applications sxiv.desktop ''; - meta = { + meta = with lib; { description = "Simple X Image Viewer"; homepage = "https://github.com/muennich/sxiv"; license = lib.licenses.gpl2Plus; diff --git a/pkgs/applications/networking/cluster/hadoop/default.nix b/pkgs/applications/networking/cluster/hadoop/default.nix index e02525e48f0a7..d9f20411a5a0e 100644 --- a/pkgs/applications/networking/cluster/hadoop/default.nix +++ b/pkgs/applications/networking/cluster/hadoop/default.nix @@ -23,9 +23,7 @@ , callPackage }: -with lib; - -assert elem stdenv.system [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; +assert lib.elem stdenv.system [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; let common = { pname, platformAttrs, jdk, tests }: @@ -34,7 +32,7 @@ let version = platformAttrs.${stdenv.system}.version or (throw "Unsupported system: ${stdenv.system}"); src = fetchurl { url = "mirror://apache/hadoop/common/hadoop-${finalAttrs.version}/hadoop-${finalAttrs.version}" - + optionalString stdenv.isAarch64 "-aarch64" + ".tar.gz"; + + lib.optionalString stdenv.isAarch64 "-aarch64" + ".tar.gz"; inherit (platformAttrs.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}")) hash; }; doCheck = true; @@ -47,24 +45,24 @@ let }) else ""; nativeBuildInputs = [ makeWrapper ] - ++ optionals stdenv.isLinux [ autoPatchelfHook ]; - buildInputs = optionals stdenv.isLinux [ stdenv.cc.cc.lib openssl protobuf zlib snappy libtirpc ]; + ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ]; + buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib openssl protobuf zlib snappy libtirpc ]; installPhase = '' mkdir $out mv * $out/ - '' + optionalString stdenv.isLinux '' + '' + lib.optionalString stdenv.isLinux '' for n in $(find ${finalAttrs.containerExecutor}/bin -type f); do ln -sf "$n" $out/bin done # these libraries are loaded at runtime by the JVM - ln -s ${getLib cyrus_sasl}/lib/libsasl2.so $out/lib/native/libsasl2.so.2 - ln -s ${getLib openssl}/lib/libcrypto.so $out/lib/native/ - ln -s ${getLib zlib}/lib/libz.so.1 $out/lib/native/ - ln -s ${getLib zstd}/lib/libzstd.so.1 $out/lib/native/ - ln -s ${getLib bzip2}/lib/libbz2.so.1 $out/lib/native/ - ln -s ${getLib snappy}/lib/libsnappy.so.1 $out/lib/native/ + ln -s ${lib.getLib cyrus_sasl}/lib/libsasl2.so $out/lib/native/libsasl2.so.2 + ln -s ${lib.getLib openssl}/lib/libcrypto.so $out/lib/native/ + ln -s ${lib.getLib zlib}/lib/libz.so.1 $out/lib/native/ + ln -s ${lib.getLib zstd}/lib/libzstd.so.1 $out/lib/native/ + ln -s ${lib.getLib bzip2}/lib/libbz2.so.1 $out/lib/native/ + ln -s ${lib.getLib snappy}/lib/libsnappy.so.1 $out/lib/native/ # libjvm.so is in different paths for java 8 and 11 # libnativetask.so in hadooop 3 and libhdfs.so in hadoop 2 depend on it @@ -76,7 +74,7 @@ let # hadoop 3.3+ depends on protobuf 3.18, 3.2 depends on 3.8 find $out/lib/native -name 'libhdfspp.so*' | \ xargs -r -n1 patchelf --replace-needed libprotobuf.so.${ - if (versionAtLeast finalAttrs.version "3.3") then "18" + if (lib.versionAtLeast finalAttrs.version "3.3") then "18" else "8" } libprotobuf.so @@ -90,17 +88,17 @@ let --set-default HADOOP_HOME $out/\ --run "test -d /etc/hadoop-conf && export HADOOP_CONF_DIR=\''${HADOOP_CONF_DIR-'/etc/hadoop-conf/'}"\ --set-default HADOOP_CONF_DIR $out/etc/hadoop/\ - --prefix PATH : "${makeBinPath [ bash coreutils which]}"\ - --prefix JAVA_LIBRARY_PATH : "${makeLibraryPath finalAttrs.buildInputs}" + --prefix PATH : "${lib.makeBinPath [ bash coreutils which]}"\ + --prefix JAVA_LIBRARY_PATH : "${lib.makeLibraryPath finalAttrs.buildInputs}" done - '' + (optionalString sparkSupport '' + '' + (lib.optionalString sparkSupport '' # Add the spark shuffle service jar to YARN cp ${spark.src}/yarn/spark-${spark.version}-yarn-shuffle.jar $out/share/hadoop/yarn/ ''); passthru = { inherit tests; }; - meta = recursiveUpdate { + meta = with lib; recursiveUpdate { homepage = "https://hadoop.apache.org/"; description = "Framework for distributed processing of large data sets across clusters of computers"; license = licenses.asl20; diff --git a/pkgs/applications/office/tryton/default.nix b/pkgs/applications/office/tryton/default.nix index 6a9d1e471a9e5..55d43623bc7ad 100644 --- a/pkgs/applications/office/tryton/default.nix +++ b/pkgs/applications/office/tryton/default.nix @@ -17,8 +17,6 @@ , wrapGAppsHook3 }: -with lib; - python3Packages.buildPythonApplication rec { pname = "tryton"; version = "7.2.4"; @@ -61,7 +59,7 @@ python3Packages.buildPythonApplication rec { doCheck = false; - meta = { + meta = with lib; { description = "Client of the Tryton application platform"; mainProgram = "tryton"; longDescription = '' diff --git a/pkgs/applications/science/chemistry/marvin/default.nix b/pkgs/applications/science/chemistry/marvin/default.nix index 4228e818e4887..e1e911e2d4dfb 100644 --- a/pkgs/applications/science/chemistry/marvin/default.nix +++ b/pkgs/applications/science/chemistry/marvin/default.nix @@ -1,14 +1,12 @@ { lib, stdenv, fetchurl, dpkg, makeWrapper, coreutils, gawk, gnugrep, gnused, openjdk17 }: -with lib; - stdenv.mkDerivation rec { pname = "marvin"; version = "23.17.0"; src = fetchurl { name = "marvin-${version}.deb"; - url = "http://dl.chemaxon.com/marvin/${version}/marvin_linux_${versions.majorMinor version}.deb"; + url = "http://dl.chemaxon.com/marvin/${version}/marvin_linux_${lib.versions.majorMinor version}.deb"; hash = "sha256-zE/9EaOsNJwzE4Doasm9N8QG4t7wDOxqpV/Nhc4p7Ws="; }; @@ -22,7 +20,7 @@ stdenv.mkDerivation rec { wrapBin() { makeWrapper $1 $out/bin/$(basename $1) \ --set INSTALL4J_JAVA_HOME "${openjdk17}" \ - --prefix PATH : ${makeBinPath [ coreutils gawk gnugrep gnused ]} + --prefix PATH : ${lib.makeBinPath [ coreutils gawk gnugrep gnused ]} } cp -r opt $out mkdir -p $out/bin $out/share/pixmaps $out/share/applications @@ -33,12 +31,12 @@ stdenv.mkDerivation rec { for name in cxcalc cxtrain evaluate molconvert mview msketch; do wrapBin $out/opt/chemaxon/marvinsuite/bin/$name done - ${concatStrings (map (name: '' + ${lib.concatStrings (map (name: '' substitute ${./. + "/${name}.desktop"} $out/share/applications/${name}.desktop --subst-var out '') [ "LicenseManager" "MarvinSketch" "MarvinView" ])} ''; - meta = { + meta = with lib; { description = "Chemical modelling, analysis and structure drawing program"; homepage = "https://chemaxon.com/products/marvin"; maintainers = with maintainers; [ fusion809 ]; diff --git a/pkgs/applications/science/electronics/fped/default.nix b/pkgs/applications/science/electronics/fped/default.nix index edfe34c0e25e8..e3984dba77d8d 100644 --- a/pkgs/applications/science/electronics/fped/default.nix +++ b/pkgs/applications/science/electronics/fped/default.nix @@ -3,7 +3,6 @@ , pkg-config }: -with lib; stdenv.mkDerivation { pname = "fped"; version = "unstable-2017-05-11"; @@ -39,7 +38,7 @@ stdenv.mkDerivation { gtk2 ]; - meta = { + meta = with lib; { description = "Editor that allows the interactive creation of footprints electronic components"; mainProgram = "fped"; homepage = "http://projects.qi-hardware.com/index.php/p/fped/"; diff --git a/pkgs/applications/science/logic/monosat/default.nix b/pkgs/applications/science/logic/monosat/default.nix index 067ba8ceb1b33..1bd2d29d45059 100644 --- a/pkgs/applications/science/logic/monosat/default.nix +++ b/pkgs/applications/science/logic/monosat/default.nix @@ -3,8 +3,6 @@ # annoying and break the python library, so let's not bother for now includeJava ? !stdenv.hostPlatform.isDarwin, includeGplCode ? true }: -with lib; - let boolToCmake = x: if x then "ON" else "OFF"; @@ -52,14 +50,14 @@ let "-DCMAKE_SKIP_BUILD_RPATH=ON" ]; - postInstall = optionalString includeJava '' + postInstall = lib.optionalString includeJava '' mkdir -p $out/share/java cp monosat.jar $out/share/java ''; passthru = { inherit python; }; - meta = { + meta = with lib; { description = "SMT solver for Monotonic Theories"; mainProgram = "monosat"; platforms = platforms.unix; diff --git a/pkgs/applications/science/logic/z3/default.nix b/pkgs/applications/science/logic/z3/default.nix index 2db1fc95f7974..a17cc5561cf21 100644 --- a/pkgs/applications/science/logic/z3/default.nix +++ b/pkgs/applications/science/logic/z3/default.nix @@ -16,8 +16,6 @@ assert javaBindings -> jdk != null; assert ocamlBindings -> ocaml != null && findlib != null && zarith != null; -with lib; - let common = { version, sha256, patches ? [ ], tag ? "z3" }: stdenv.mkDerivation rec { pname = "z3"; @@ -32,25 +30,25 @@ let common = { version, sha256, patches ? [ ], tag ? "z3" }: strictDeps = true; nativeBuildInputs = [ python ] - ++ optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames - ++ optional javaBindings jdk - ++ optionals ocamlBindings [ ocaml findlib ] + ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames + ++ lib.optional javaBindings jdk + ++ lib.optionals ocamlBindings [ ocaml findlib ] ; propagatedBuildInputs = [ python.pkgs.setuptools ] - ++ optionals ocamlBindings [ zarith ]; + ++ lib.optionals ocamlBindings [ zarith ]; enableParallelBuilding = true; - postPatch = optionalString ocamlBindings '' + postPatch = lib.optionalString ocamlBindings '' export OCAMLFIND_DESTDIR=$ocaml/lib/ocaml/${ocaml.version}/site-lib mkdir -p $OCAMLFIND_DESTDIR/stublibs ''; - configurePhase = concatStringsSep " " + configurePhase = lib.concatStringsSep " " ( [ "${python.pythonOnBuildForHost.interpreter} scripts/mk_make.py --prefix=$out" ] - ++ optional javaBindings "--java" - ++ optional ocamlBindings "--ml" - ++ optional pythonBindings "--python --pypkgdir=$out/${python.sitePackages}" + ++ lib.optional javaBindings "--java" + ++ lib.optional ocamlBindings "--ml" + ++ lib.optional pythonBindings "--python --pypkgdir=$out/${python.sitePackages}" ) + "\n" + "cd build"; doCheck = true; @@ -63,19 +61,19 @@ let common = { version, sha256, patches ? [ ], tag ? "z3" }: mkdir -p $dev $lib mv $out/lib $lib/lib mv $out/include $dev/include - '' + optionalString pythonBindings '' + '' + lib.optionalString pythonBindings '' mkdir -p $python/lib mv $lib/lib/python* $python/lib/ ln -sf $lib/lib/libz3${stdenv.hostPlatform.extensions.sharedLibrary} $python/${python.sitePackages}/z3/lib/libz3${stdenv.hostPlatform.extensions.sharedLibrary} - '' + optionalString javaBindings '' + '' + lib.optionalString javaBindings '' mkdir -p $java/share/java mv com.microsoft.z3.jar $java/share/java moveToOutput "lib/libz3java.${stdenv.hostPlatform.extensions.sharedLibrary}" "$java" ''; outputs = [ "out" "lib" "dev" "python" ] - ++ optional javaBindings "java" - ++ optional ocamlBindings "ocaml"; + ++ lib.optional javaBindings "java" + ++ lib.optional ocamlBindings "ocaml"; meta = with lib; { description = "High-performance theorem prover and SMT solver"; diff --git a/pkgs/applications/science/math/ripser/default.nix b/pkgs/applications/science/math/ripser/default.nix index 3f536f25aa115..38a00d504406b 100644 --- a/pkgs/applications/science/math/ripser/default.nix +++ b/pkgs/applications/science/math/ripser/default.nix @@ -5,14 +5,11 @@ , fileFormat ? "lowerTriangularCsv" }: -with lib; - -assert assertOneOf "fileFormat" fileFormat +assert lib.assertOneOf "fileFormat" fileFormat ["lowerTriangularCsv" "upperTriangularCsv" "dipha"]; assert useGoogleHashmap -> sparsehash != null; let - inherit (lib) optional; version = "1.2.1"; in stdenv.mkDerivation { @@ -26,19 +23,19 @@ stdenv.mkDerivation { sha256 = "sha256-BxmkPQ/nl5cF+xwQMTjXnLgkLgdmT/39y7Kzl2wDfpE="; }; - buildInputs = optional useGoogleHashmap sparsehash; + buildInputs = lib.optional useGoogleHashmap sparsehash; buildFlags = [ "-std=c++11" "-O3" "-D NDEBUG" ] - ++ optional useCoefficients "-D USE_COEFFICIENTS" - ++ optional indicateProgress "-D INDICATE_PROGRESS" - ++ optional useGoogleHashmap "-D USE_GOOGLE_HASHMAP" - ++ optional (fileFormat == "lowerTriangularCsv") "-D FILE_FORMAT_LOWER_TRIANGULAR_CSV" - ++ optional (fileFormat == "upperTriangularCsv") "-D FILE_FORMAT_UPPER_TRIANGULAR_CSV" - ++ optional (fileFormat == "dipha") "-D FILE_FORMAT_DIPHA" + ++ lib.optional useCoefficients "-D USE_COEFFICIENTS" + ++ lib.optional indicateProgress "-D INDICATE_PROGRESS" + ++ lib.optional useGoogleHashmap "-D USE_GOOGLE_HASHMAP" + ++ lib.optional (fileFormat == "lowerTriangularCsv") "-D FILE_FORMAT_LOWER_TRIANGULAR_CSV" + ++ lib.optional (fileFormat == "upperTriangularCsv") "-D FILE_FORMAT_UPPER_TRIANGULAR_CSV" + ++ lib.optional (fileFormat == "dipha") "-D FILE_FORMAT_DIPHA" ; buildPhase = "c++ ripser.cpp -o ripser $buildFlags"; diff --git a/pkgs/applications/science/math/wolfram-engine/l10ns.nix b/pkgs/applications/science/math/wolfram-engine/l10ns.nix index ae1886bae1543..2682b6d71a1b4 100644 --- a/pkgs/applications/science/math/wolfram-engine/l10ns.nix +++ b/pkgs/applications/science/math/wolfram-engine/l10ns.nix @@ -45,7 +45,7 @@ let allVersions = with lib; flip map ] ({ version, lang, language, sha256, installer }: { inherit version lang; - name = "wolfram-engine-${version}" + optionalString (lang != "en") "-${lang}"; + name = "wolfram-engine-${version}" + lib.optionalString (lang != "en") "-${lang}"; src = requireFile { name = installer; message = '' @@ -58,14 +58,12 @@ let allVersions = with lib; flip map }; }); minVersion = - with lib; if majorVersion == null - then elemAt (builtins.splitVersion (elemAt allVersions 0).version) 0 + then lib.elemAt (builtins.splitVersion (lib.elemAt allVersions 0).version) 0 else majorVersion; maxVersion = toString (1 + builtins.fromJSON minVersion); in -with lib; -findFirst (l: (l.lang == lang +lib.findFirst (l: (l.lang == lang && l.version >= minVersion && l.version < maxVersion)) (throw "Version ${minVersion} in language ${lang} not supported") diff --git a/pkgs/applications/science/medicine/dcmtk/default.nix b/pkgs/applications/science/medicine/dcmtk/default.nix index 0fa41ba08760f..8dc85e2ee1077 100644 --- a/pkgs/applications/science/medicine/dcmtk/default.nix +++ b/pkgs/applications/science/medicine/dcmtk/default.nix @@ -1,7 +1,6 @@ { lib, stdenv, fetchFromGitHub, zlib, libtiff, libxml2, openssl, libiconv , libpng, cmake }: -with lib; stdenv.mkDerivation rec { pname = "dcmtk"; version = "3.6.8"; @@ -17,7 +16,7 @@ stdenv.mkDerivation rec { doCheck = true; - meta = { + meta = with lib; { description = "Collection of libraries and applications implementing large parts of the DICOM standard"; longDescription = '' diff --git a/pkgs/applications/science/misc/simgrid/default.nix b/pkgs/applications/science/misc/simgrid/default.nix index a2b04e1877f89..8d9373278e945 100644 --- a/pkgs/applications/science/misc/simgrid/default.nix +++ b/pkgs/applications/science/misc/simgrid/default.nix @@ -12,8 +12,6 @@ , withoutBin ? false }: -with lib; - let optionOnOff = option: if option then "on" else "off"; in @@ -32,15 +30,15 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ boost ]; nativeBuildInputs = [ cmake perl python3 ] - ++ optionals fortranSupport [ gfortran ] - ++ optionals buildJavaBindings [ openjdk ] - ++ optionals buildPythonBindings [ python3Packages.pybind11 ] - ++ optionals buildDocumentation [ fig2dev ghostscript doxygen ] - ++ optionals bmfSupport [ eigen ] - ++ optionals modelCheckingSupport [ libunwind libevent elfutils ]; + ++ lib.optionals fortranSupport [ gfortran ] + ++ lib.optionals buildJavaBindings [ openjdk ] + ++ lib.optionals buildPythonBindings [ python3Packages.pybind11 ] + ++ lib.optionals buildDocumentation [ fig2dev ghostscript doxygen ] + ++ lib.optionals bmfSupport [ eigen ] + ++ lib.optionals modelCheckingSupport [ libunwind libevent elfutils ]; outputs = [ "out" ] - ++ optionals buildPythonBindings [ "python" ]; + ++ lib.optionals buildPythonBindings [ "python" ]; # "Release" does not work. non-debug mode is Debug compiled with optimization cmakeBuildType = "Debug"; @@ -69,7 +67,7 @@ stdenv.mkDerivation rec { # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/ "-DCMAKE_SKIP_BUILD_RPATH=ON" ]; - makeFlags = optional debug "VERBOSE=1"; + makeFlags = lib.optional debug "VERBOSE=1"; # needed to run tests and to ensure correct shabangs in output scripts preBuild = '' @@ -106,7 +104,7 @@ stdenv.mkDerivation rec { hardeningDisable = lib.optionals debug [ "fortify" ]; dontStrip = debug; - meta = { + meta = with lib; { description = "Framework for the simulation of distributed applications"; longDescription = '' SimGrid is a toolkit that provides core functionalities for the diff --git a/pkgs/applications/terminal-emulators/rxvt-unicode/default.nix b/pkgs/applications/terminal-emulators/rxvt-unicode/default.nix index e932fcdea05f3..f28694db29493 100644 --- a/pkgs/applications/terminal-emulators/rxvt-unicode/default.nix +++ b/pkgs/applications/terminal-emulators/rxvt-unicode/default.nix @@ -33,8 +33,6 @@ let }; in -with lib; - stdenv.mkDerivation { name = "${pname}-unwrapped-${version}"; inherit pname version; @@ -49,8 +47,8 @@ stdenv.mkDerivation { [ libX11 libXt libXft ncurses # required to build the terminfo file fontconfig freetype libXrender libptytty - ] ++ optionals perlSupport [ perl libXext ] - ++ optional gdkPixbufSupport gdk-pixbuf; + ] ++ lib.optionals perlSupport [ perl libXext ] + ++ lib.optional gdkPixbufSupport gdk-pixbuf; outputs = [ "out" "terminfo" ]; @@ -73,19 +71,19 @@ stdenv.mkDerivation { ./patches/9.06-font-width.patch ]) ++ [ ./patches/256-color-resources.patch - ] ++ optional (perlSupport && versionAtLeast perl.version "5.38") (fetchpatch { + ] ++ lib.optional (perlSupport && lib.versionAtLeast perl.version "5.38") (fetchpatch { name = "perl538-locale-c.patch"; url = "https://github.com/exg/rxvt-unicode/commit/16634bc8dd5fc4af62faf899687dfa8f27768d15.patch"; excludes = [ "Changes" ]; sha256 = "sha256-JVqzYi3tcWIN2j5JByZSztImKqbbbB3lnfAwUXrumHM="; - }) ++ optional stdenv.isDarwin ./patches/makefile-phony.patch; + }) ++ lib.optional stdenv.isDarwin ./patches/makefile-phony.patch; configureFlags = [ "--with-terminfo=${placeholder "terminfo"}/share/terminfo" "--enable-256-color" - (enableFeature perlSupport "perl") - (enableFeature unicode3Support "unicode3") - ] ++ optional emojiSupport "--enable-wide-glyphs"; + (lib.enableFeature perlSupport "perl") + (lib.enableFeature unicode3Support "unicode3") + ] ++ lib.optional emojiSupport "--enable-wide-glyphs"; LDFLAGS = [ "-lfontconfig" "-lXrender" "-lpthread" ]; CFLAGS = [ "-I${freetype.dev}/include/freetype2" ]; @@ -111,7 +109,7 @@ stdenv.mkDerivation { passthru.tests.test = nixosTests.terminal-emulators.urxvt; - meta = { + meta = with lib; { inherit description; homepage = "http://software.schmorp.de/pkg/rxvt-unicode.html"; downloadPage = "http://dist.schmorp.de/rxvt-unicode/Attic/"; diff --git a/pkgs/applications/version-management/git-octopus/default.nix b/pkgs/applications/version-management/git-octopus/default.nix index 877c795e205dd..3865c9ac83b88 100644 --- a/pkgs/applications/version-management/git-octopus/default.nix +++ b/pkgs/applications/version-management/git-octopus/default.nix @@ -1,7 +1,5 @@ { lib, stdenv, fetchFromGitHub, git, perl, makeWrapper }: -with lib; - stdenv.mkDerivation rec { pname = "git-octopus"; version = "1.4"; @@ -13,7 +11,7 @@ stdenv.mkDerivation rec { # perl provides shasum postInstall = '' for f in $out/bin/*; do - wrapProgram $f --prefix PATH : ${makeBinPath [ git perl ]} + wrapProgram $f --prefix PATH : ${lib.makeBinPath [ git perl ]} done ''; @@ -24,7 +22,7 @@ stdenv.mkDerivation rec { sha256 = "14p61xk7jankp6gc26xciag9fnvm7r9vcbhclcy23f4ghf4q4sj1"; }; - meta = { + meta = with lib; { homepage = "https://github.com/lesfurets/git-octopus"; description = "Continuous merge workflow"; license = licenses.lgpl3; diff --git a/pkgs/applications/version-management/gitkraken/default.nix b/pkgs/applications/version-management/gitkraken/default.nix index 80c890046895b..66bab500c664f 100644 --- a/pkgs/applications/version-management/gitkraken/default.nix +++ b/pkgs/applications/version-management/gitkraken/default.nix @@ -55,8 +55,6 @@ cacert, }: -with lib; - let pname = "gitkraken"; version = "10.2.0"; @@ -82,7 +80,7 @@ let src = srcs.${stdenv.hostPlatform.system} or throwSystem; - meta = { + meta = with lib; { homepage = "https://www.gitkraken.com/git-client"; description = "Simplifying Git for any OS"; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; @@ -108,7 +106,7 @@ let dontBuild = true; dontConfigure = true; - libPath = makeLibraryPath [ + libPath = lib.makeLibraryPath [ stdenv.cc.cc.lib curlWithGnuTls udev diff --git a/pkgs/applications/version-management/gogs/default.nix b/pkgs/applications/version-management/gogs/default.nix index 534fd288d43e9..5b7a986cf2069 100644 --- a/pkgs/applications/version-management/gogs/default.nix +++ b/pkgs/applications/version-management/gogs/default.nix @@ -4,8 +4,6 @@ , pamSupport ? true }: -with lib; - buildGoModule rec { pname = "gogs"; version = "0.13.0"; @@ -27,19 +25,19 @@ buildGoModule rec { nativeBuildInputs = [ makeWrapper openssh ]; - buildInputs = optional pamSupport pam; + buildInputs = lib.optional pamSupport pam; tags = - ( optional sqliteSupport "sqlite" - ++ optional pamSupport "pam"); + ( lib.optional sqliteSupport "sqlite" + ++ lib.optional pamSupport "pam"); postInstall = '' wrapProgram $out/bin/gogs \ - --prefix PATH : ${makeBinPath [ bash git gzip openssh ]} + --prefix PATH : ${lib.makeBinPath [ bash git gzip openssh ]} ''; - meta = { + meta = with lib; { description = "Painless self-hosted Git service"; homepage = "https://gogs.io"; license = licenses.mit; diff --git a/pkgs/applications/video/mpv/scripts/default.nix b/pkgs/applications/video/mpv/scripts/default.nix index af321e094b204..873010ca3f5ac 100644 --- a/pkgs/applications/video/mpv/scripts/default.nix +++ b/pkgs/applications/video/mpv/scripts/default.nix @@ -140,13 +140,12 @@ let }; in -with lib; -pipe scope [ - (makeScope newScope) +lib.pipe scope [ + (lib.makeScope newScope) ( self: assert builtins.intersectAttrs self aliases == { }; - self // optionalAttrs config.allowAliases aliases + self // lib.optionalAttrs config.allowAliases aliases ) - recurseIntoAttrs + lib.recurseIntoAttrs ] diff --git a/pkgs/applications/video/vcs/default.nix b/pkgs/applications/video/vcs/default.nix index 63a9989134735..105823fec3ab6 100644 --- a/pkgs/applications/video/vcs/default.nix +++ b/pkgs/applications/video/vcs/default.nix @@ -3,7 +3,6 @@ , util-linux, getopt , dejavu_fonts }: -with lib; let version = "1.13.4"; gopt = if stdenv.isLinux then util-linux else getopt; @@ -29,10 +28,10 @@ stdenv.mkDerivation { mv vcs $out/bin/vcs substituteAllInPlace $out/bin/vcs chmod +x $out/bin/vcs - wrapProgram $out/bin/vcs --argv0 vcs --set PATH "${makeBinPath runtimeDeps}" + wrapProgram $out/bin/vcs --argv0 vcs --set PATH "${lib.makeBinPath runtimeDeps}" ''; - meta = { + meta = with lib; { description = "Generates contact sheets from video files"; homepage = "http://p.outlyer.net/vcs"; license = licenses.lgpl21Plus; diff --git a/pkgs/applications/virtualization/docker/gc.nix b/pkgs/applications/virtualization/docker/gc.nix index 7d45427627fa9..29df4bfea3a55 100644 --- a/pkgs/applications/virtualization/docker/gc.nix +++ b/pkgs/applications/virtualization/docker/gc.nix @@ -1,7 +1,4 @@ { stdenv, lib, fetchFromGitHub, makeWrapper, docker, coreutils, procps, gnused, findutils, gnugrep }: - -with lib; - stdenv.mkDerivation rec { pname = "docker-gc"; version = "unstable-2015-10-5"; @@ -23,7 +20,7 @@ stdenv.mkDerivation rec { --prefix PATH : "${lib.makeBinPath [ docker coreutils procps gnused findutils gnugrep ]}" ''; - meta = { + meta = with lib; { description = "Docker garbage collection of containers and images"; mainProgram = "docker-gc"; license = licenses.asl20; diff --git a/pkgs/applications/virtualization/virt-viewer/default.nix b/pkgs/applications/virtualization/virt-viewer/default.nix index 8c621271e757a..a4e32f618a04f 100644 --- a/pkgs/applications/virtualization/virt-viewer/default.nix +++ b/pkgs/applications/virtualization/virt-viewer/default.nix @@ -32,9 +32,6 @@ , vte , wrapGAppsHook3 }: - -with lib; - stdenv.mkDerivation rec { pname = "virt-viewer"; version = "11.0"; @@ -76,18 +73,18 @@ stdenv.mkDerivation rec { libvirt-glib libxml2 vte - ] ++ optionals ovirtSupport [ + ] ++ lib.optionals ovirtSupport [ libgovirt - ] ++ optionals spiceSupport ([ + ] ++ lib.optionals spiceSupport ([ gdbm spice-gtk spice-protocol - ] ++ optionals stdenv.isLinux [ + ] ++ lib.optionals stdenv.isLinux [ libcap ]); # Required for USB redirection PolicyKit rules file - propagatedUserEnvPkgs = optional spiceSupport spice-gtk; + propagatedUserEnvPkgs = lib.optional spiceSupport spice-gtk; mesonFlags = [ (lib.mesonEnable "ovirt" ovirtSupport) @@ -99,7 +96,7 @@ stdenv.mkDerivation rec { patchShebangs build-aux/post_install.py ''; - meta = { + meta = with lib; { description = "Viewer for remote virtual machines"; maintainers = with maintainers; [ raskin atemu ]; platforms = with platforms; linux ++ darwin; diff --git a/pkgs/applications/virtualization/virtualbox/extpack.nix b/pkgs/applications/virtualization/virtualbox/extpack.nix index c234c079b4c89..365c635a17aef 100644 --- a/pkgs/applications/virtualization/virtualbox/extpack.nix +++ b/pkgs/applications/virtualization/virtualbox/extpack.nix @@ -1,7 +1,4 @@ { fetchurl, lib, virtualbox }: - -with lib; - let inherit (virtualbox) version; in @@ -15,7 +12,7 @@ fetchurl rec { let value = "d750fb17688d70e0cb2d7b06f1ad3a661303793f4d1ac39cfa9a54806b89da25"; in assert (builtins.stringLength value) == 64; value; - meta = { + meta = with lib; { description = "Oracle Extension pack for VirtualBox"; license = licenses.virtualbox-puel; homepage = "https://www.virtualbox.org/"; diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix index 4e0b8728f29b8..f3eea8a5c1713 100644 --- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix +++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix @@ -1,9 +1,6 @@ { stdenv, kernel, callPackage, lib, dbus , xorg, zlib, patchelf, makeWrapper }: - -with lib; - let virtualBoxNixGuestAdditionsBuilder = callPackage ./builder.nix { }; @@ -103,7 +100,7 @@ in stdenv.mkDerivation { host/guest clipboard support. ''; sourceProvenance = with lib.sourceTypes; [ fromSource ]; - license = licenses.gpl2; + license = lib.licenses.gpl2; maintainers = [ lib.maintainers.sander lib.maintainers.friedrichaltheide ]; platforms = [ "i686-linux" "x86_64-linux" ]; broken = stdenv.hostPlatform.is32bit && (kernel.kernelAtLeast "5.10"); diff --git a/pkgs/applications/window-managers/fluxbox/default.nix b/pkgs/applications/window-managers/fluxbox/default.nix index 934f8c9b3fc2e..80c5c7a216be9 100644 --- a/pkgs/applications/window-managers/fluxbox/default.nix +++ b/pkgs/applications/window-managers/fluxbox/default.nix @@ -4,7 +4,6 @@ , libXinerama , imlib2 }: -with lib; stdenv.mkDerivation rec { pname = "fluxbox"; @@ -35,7 +34,7 @@ stdenv.mkDerivation rec { --subst-var-by PREFIX "$out" ''; - meta = { + meta = with lib; { description = "Full-featured, light-resource X window manager"; longDescription = '' Fluxbox is a X window manager based on Blackbox 0.61.1 window diff --git a/pkgs/applications/window-managers/i3/blocks-gaps.nix b/pkgs/applications/window-managers/i3/blocks-gaps.nix index 1d9043686bb2d..6c32583aa0631 100644 --- a/pkgs/applications/window-managers/i3/blocks-gaps.nix +++ b/pkgs/applications/window-managers/i3/blocks-gaps.nix @@ -4,11 +4,9 @@ "load_average" "memory" "volume" "wifi" ] }: -with lib; - let perlscripts = [ "battery" "cpu_usage" "openvpn" "temperature" ]; - contains_any = l1: l2: 0 < length( intersectLists l1 l2 ); + contains_any = l1: l2: 0 < lib.length( lib.intersectLists l1 l2 ); in stdenv.mkDerivation rec { @@ -25,24 +23,24 @@ stdenv.mkDerivation rec { makeFlags = [ "all" ]; installFlags = [ "PREFIX=\${out}" "VERSION=${version}" ]; - buildInputs = optional (contains_any scripts perlscripts) perl; + buildInputs = lib.optional (contains_any scripts perlscripts) perl; nativeBuildInputs = [ makeWrapper ]; - postFixup = optionalString (elem "bandwidth" scripts) '' + postFixup = lib.optionalString (lib.elem "bandwidth" scripts) '' wrapProgram $out/libexec/i3blocks/bandwidth \ - --prefix PATH : ${makeBinPath [ iproute2 ]} - '' + optionalString (elem "battery" scripts) '' + --prefix PATH : ${lib.makeBinPath [ iproute2 ]} + '' + lib.optionalString (lib.elem "battery" scripts) '' wrapProgram $out/libexec/i3blocks/battery \ - --prefix PATH : ${makeBinPath [ acpi ]} - '' + optionalString (elem "cpu_usage" scripts) '' + --prefix PATH : ${lib.makeBinPath [ acpi ]} + '' + lib.optionalString (lib.elem "cpu_usage" scripts) '' wrapProgram $out/libexec/i3blocks/cpu_usage \ - --prefix PATH : ${makeBinPath [ sysstat ]} - '' + optionalString (elem "iface" scripts) '' + --prefix PATH : ${lib.makeBinPath [ sysstat ]} + '' + lib.optionalString (lib.elem "iface" scripts) '' wrapProgram $out/libexec/i3blocks/iface \ - --prefix PATH : ${makeBinPath [ iproute2 ]} - '' + optionalString (elem "volume" scripts) '' + --prefix PATH : ${lib.makeBinPath [ iproute2 ]} + '' + lib.optionalString (lib.elem "volume" scripts) '' wrapProgram $out/libexec/i3blocks/volume \ - --prefix PATH : ${makeBinPath [ alsa-utils ]} + --prefix PATH : ${lib.makeBinPath [ alsa-utils ]} ''; meta = with lib; { diff --git a/pkgs/applications/window-managers/i3/blocks.nix b/pkgs/applications/window-managers/i3/blocks.nix index d9ed823400d65..ad495723b6db8 100644 --- a/pkgs/applications/window-managers/i3/blocks.nix +++ b/pkgs/applications/window-managers/i3/blocks.nix @@ -1,7 +1,5 @@ { fetchFromGitHub, fetchpatch, lib, stdenv, autoreconfHook, pkg-config }: -with lib; - stdenv.mkDerivation { pname = "i3blocks"; version = "1.5"; @@ -24,7 +22,7 @@ stdenv.mkDerivation { nativeBuildInputs = [ autoreconfHook pkg-config ]; - meta = { + meta = with lib; { description = "Flexible scheduler for your i3bar blocks"; mainProgram = "i3blocks"; homepage = "https://github.com/vivien/i3blocks"; diff --git a/pkgs/desktops/deepin/core/dde-gsettings-schemas/default.nix b/pkgs/desktops/deepin/core/dde-gsettings-schemas/default.nix index b211250bc9cf5..46fb6480ca4d6 100644 --- a/pkgs/desktops/deepin/core/dde-gsettings-schemas/default.nix +++ b/pkgs/desktops/deepin/core/dde-gsettings-schemas/default.nix @@ -27,8 +27,6 @@ let ] ++ extraGSettingsOverridePackages; in -with lib; - # TODO: Having https://github.com/NixOS/nixpkgs/issues/54150 would supersede this runCommand "nixos-gsettings-desktop-schemas" { preferLocalBuild = true; } '' @@ -37,7 +35,7 @@ runCommand "nixos-gsettings-desktop-schemas" { preferLocalBuild = true; } mkdir -p $schema_dir - ${concatMapStringsSep "\n" (pkg: "cp -rf \"${glib.getSchemaPath pkg}\"/*.xml \"$schema_dir\"") gsettingsOverridePackages} + ${lib.concatMapStringsSep "\n" (pkg: "cp -rf \"${glib.getSchemaPath pkg}\"/*.xml \"$schema_dir\"") gsettingsOverridePackages} chmod -R a+w "$data_dir" diff --git a/pkgs/development/compilers/flutter/engine/package.nix b/pkgs/development/compilers/flutter/engine/package.nix index a87088dc8131d..0e8b355202220 100644 --- a/pkgs/development/compilers/flutter/engine/package.nix +++ b/pkgs/development/compilers/flutter/engine/package.nix @@ -46,12 +46,11 @@ runtimeMode ? "release", isOptimized ? true, }: -with lib; let expandSingleDep = dep: lib.optionals (lib.isDerivation dep) ([ dep ] ++ map (output: dep.${output}) dep.outputs); - expandDeps = deps: flatten (map expandSingleDep deps); + expandDeps = deps: lib.flatten (map expandSingleDep deps); constants = callPackage ./constants.nix { inherit targetPlatform; }; @@ -103,7 +102,7 @@ stdenv.mkDerivation (finalAttrs: { paths = expandDeps ( - optionals (stdenv.isLinux) [ + lib.optionals (stdenv.isLinux) [ gtk3 wayland libepoxy @@ -128,7 +127,7 @@ stdenv.mkDerivation (finalAttrs: { xorg.xorgproto zlib ] - ++ optionals (stdenv.isDarwin) [ + ++ lib.optionals (stdenv.isDarwin) [ clang llvm ] @@ -160,7 +159,7 @@ stdenv.mkDerivation (finalAttrs: { dart ] ++ lib.optionals (stdenv.isLinux) [ patchelf ] - ++ optionals (stdenv.isDarwin) [ + ++ lib.optionals (stdenv.isDarwin) [ darwin.system_cmds darwin.xcode tools.xcode-select @@ -237,7 +236,7 @@ stdenv.mkDerivation (finalAttrs: { "--embedder-for-target" "--no-goma" ] - ++ optionals (targetPlatform.isx86_64 == false) [ + ++ lib.optionals (targetPlatform.isx86_64 == false) [ "--linux" "--linux-cpu ${constants.alt-arch}" ]; @@ -311,7 +310,7 @@ stdenv.mkDerivation (finalAttrs: { dart = callPackage ./dart.nix { engine = finalAttrs.finalPackage; }; }; - meta = { + meta = with lib; { # Very broken on Darwin broken = stdenv.isDarwin; description = "The Flutter engine"; diff --git a/pkgs/development/julia-modules/extra-python-packages.nix b/pkgs/development/julia-modules/extra-python-packages.nix index 30e5179b38200..14731fb9de350 100644 --- a/pkgs/development/julia-modules/extra-python-packages.nix +++ b/pkgs/development/julia-modules/extra-python-packages.nix @@ -3,9 +3,6 @@ }: # This file contains an extra mapping from Julia packages to the Python packages they depend on. - -with lib; - rec { packageMapping = { ExcelFiles = ["xlrd"]; @@ -14,9 +11,9 @@ rec { SymPy = ["sympy"]; }; - getExtraPythonPackages = names: concatMap (name: let - allCandidates = if hasAttr name packageMapping then getAttr name packageMapping else []; + getExtraPythonPackages = names: lib.concatMap (name: let + allCandidates = if lib.hasAttr name packageMapping then lib.getAttr name packageMapping else []; in - filter (x: hasAttr x python3.pkgs) allCandidates + lib.filter (x: lib.hasAttr x python3.pkgs) allCandidates ) names; } diff --git a/pkgs/misc/cups/drivers/samsung/1.00.36/module.nix b/pkgs/misc/cups/drivers/samsung/1.00.36/module.nix index 3cf7c62c4e723..1b9ea38a3006c 100644 --- a/pkgs/misc/cups/drivers/samsung/1.00.36/module.nix +++ b/pkgs/misc/cups/drivers/samsung/1.00.36/module.nix @@ -15,17 +15,16 @@ # again after turning the device off and on. atm i have no idea how # to fix this and no time to do more about it. {config, pkgs, lib ? pkgs.lib, ...}: -with lib; let cfg = config.services.samsung-unified-linux-driver_1_00_36; pkg = pkgs.samsung-unified-linux-driver_1_00_36; in { options = { services.samsung-unified-linux-driver_1_00_36 = { - enable = mkEnableOption "samsung-unified-linux-driver_1_00_36"; + enable = lib.mkEnableOption "samsung-unified-linux-driver_1_00_36"; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.printing.drivers = [pkg]; hardware.sane.extraBackends = [pkg]; environment.etc = { diff --git a/pkgs/misc/drivers/sundtek/default.nix b/pkgs/misc/drivers/sundtek/default.nix index da2852e70d56a..3cba4a5f15c82 100644 --- a/pkgs/misc/drivers/sundtek/default.nix +++ b/pkgs/misc/drivers/sundtek/default.nix @@ -1,10 +1,7 @@ { fetchurl, lib, stdenv }: - -with lib; - let version = "2016-01-26"; - rpath = makeLibraryPath [ "$out/lib" "$out/bin" ]; + rpath = lib.makeLibraryPath [ "$out/lib" "$out/bin" ]; platform = with stdenv; if isx86_64 then "64bit" else @@ -13,7 +10,6 @@ let sha256 = with stdenv; if isx86_64 then "1jfsng5n3phw5rqpkid9m5j7m7zgj5bifh7swvba7f97y6imdaax" else "15y6r5w306pcq4g1rn9f7vf70f3a7qhq237ngaf0wxh2nr0aamxp"; - in stdenv.mkDerivation { src = fetchurl { @@ -42,7 +38,7 @@ in preferLocalBuild = true; - meta = { + meta = with lib; { description = "Sundtek MediaTV driver"; maintainers = [ maintainers.simonvandel ]; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; diff --git a/pkgs/misc/libcardiacarrest/default.nix b/pkgs/misc/libcardiacarrest/default.nix index b5cfa1216eee2..4c0d0fa97ad11 100644 --- a/pkgs/misc/libcardiacarrest/default.nix +++ b/pkgs/misc/libcardiacarrest/default.nix @@ -1,7 +1,5 @@ { lib, stdenv, fetchFromGitHub, pkg-config, glib, libpulseaudio }: -with lib; - stdenv.mkDerivation rec { pname = "libcardiacarrest"; version = "12.2.8"; # . @@ -27,7 +25,7 @@ stdenv.mkDerivation rec { moveToOutput $out/lib/cmake $dev ''; - meta = src.meta // { + meta = with lib; src.meta // { description = "Trivial implementation of libpulse PulseAudio library API"; longDescription = '' libcardiacarrest is a trivial implementation of libpulse diff --git a/pkgs/misc/stabber/default.nix b/pkgs/misc/stabber/default.nix index c0b34982303dc..fd64b3942b5a1 100644 --- a/pkgs/misc/stabber/default.nix +++ b/pkgs/misc/stabber/default.nix @@ -1,9 +1,6 @@ { lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, glib, expat , libmicrohttpd, darwin }: - -with lib; - stdenv.mkDerivation { pname = "stabber-unstable"; version = "2020-06-08"; @@ -28,7 +25,7 @@ stdenv.mkDerivation { buildInputs = [ glib expat libmicrohttpd ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; - meta = { + meta = with lib; { description = "Stubbed XMPP Server"; mainProgram = "stabber"; homepage = "https://github.com/profanity-im/stabber"; diff --git a/pkgs/os-specific/linux/conky/default.nix b/pkgs/os-specific/linux/conky/default.nix index 0818850f75493..de2c16b8d55c5 100644 --- a/pkgs/os-specific/linux/conky/default.nix +++ b/pkgs/os-specific/linux/conky/default.nix @@ -3,11 +3,11 @@ # dependencies , glib, libXinerama, catch2 -# optional features without extra dependencies +# lib.optional features without extra dependencies , mpdSupport ? true , ibmSupport ? true # IBM/Lenovo notebooks -# optional features with extra dependencies +# lib.optional features with extra dependencies # ouch, this is ugly, but this gives the man page , docsSupport ? true, docbook2x, libxslt ? null @@ -64,8 +64,6 @@ assert weatherMetarSupport -> curlSupport; assert weatherXoapSupport -> curlSupport && libxml2 != null; assert journalSupport -> systemd != null; -with lib; - stdenv.mkDerivation rec { pname = "conky"; version = "1.19.6"; @@ -77,11 +75,11 @@ stdenv.mkDerivation rec { hash = "sha256-L8YSbdk+qQl17L4IRajFD/AEWRXb2w7xH9sM9qPGrQo="; }; - postPatch = optionalString docsSupport '' + postPatch = lib.optionalString docsSupport '' substituteInPlace cmake/Conky.cmake --replace "# set(RELEASE true)" "set(RELEASE true)" cp ${catch2}/include/catch2/catch.hpp tests/catch2/catch.hpp - '' + optionalString waylandSupport '' + '' + lib.optionalString waylandSupport '' substituteInPlace src/CMakeLists.txt \ --replace 'COMMAND ''${Wayland_SCANNER}' 'COMMAND wayland-scanner' ''; @@ -93,49 +91,49 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cmake pkg-config ] - ++ optionals docsSupport [ docbook2x docbook_xsl docbook_xml_dtd_44 libxslt man less ] - ++ optional waylandSupport wayland-scanner - ++ optional luaImlib2Support toluapp - ++ optional luaCairoSupport toluapp + ++ lib.optionals docsSupport [ docbook2x docbook_xsl docbook_xml_dtd_44 libxslt man less ] + ++ lib.optional waylandSupport wayland-scanner + ++ lib.optional luaImlib2Support toluapp + ++ lib.optional luaCairoSupport toluapp ; buildInputs = [ glib libXinerama ] - ++ optional ncursesSupport ncurses - ++ optionals x11Support [ freetype xorg.libICE xorg.libX11 xorg.libXext xorg.libXft xorg.libSM ] - ++ optionals waylandSupport [ pango wayland wayland-protocols ] - ++ optional xdamageSupport libXdamage - ++ optional imlib2Support imlib2 - ++ optional luaSupport lua - ++ optional luaImlib2Support imlib2 - ++ optional luaCairoSupport cairo - ++ optional wirelessSupport wirelesstools - ++ optional curlSupport curl - ++ optional rssSupport libxml2 - ++ optional weatherXoapSupport libxml2 - ++ optional nvidiaSupport libXNVCtrl - ++ optional pulseSupport libpulseaudio - ++ optional journalSupport systemd + ++ lib.optional ncursesSupport ncurses + ++ lib.optionals x11Support [ freetype xorg.libICE xorg.libX11 xorg.libXext xorg.libXft xorg.libSM ] + ++ lib.optionals waylandSupport [ pango wayland wayland-protocols ] + ++ lib.optional xdamageSupport libXdamage + ++ lib.optional imlib2Support imlib2 + ++ lib.optional luaSupport lua + ++ lib.optional luaImlib2Support imlib2 + ++ lib.optional luaCairoSupport cairo + ++ lib.optional wirelessSupport wirelesstools + ++ lib.optional curlSupport curl + ++ lib.optional rssSupport libxml2 + ++ lib.optional weatherXoapSupport libxml2 + ++ lib.optional nvidiaSupport libXNVCtrl + ++ lib.optional pulseSupport libpulseaudio + ++ lib.optional journalSupport systemd ; cmakeFlags = [] - ++ optional docsSupport "-DMAINTAINER_MODE=ON" - ++ optional curlSupport "-DBUILD_CURL=ON" - ++ optional (!ibmSupport) "-DBUILD_IBM=OFF" - ++ optional imlib2Support "-DBUILD_IMLIB2=ON" - ++ optional luaCairoSupport "-DBUILD_LUA_CAIRO=ON" - ++ optional luaImlib2Support "-DBUILD_LUA_IMLIB2=ON" - ++ optional (!mpdSupport) "-DBUILD_MPD=OFF" - ++ optional (!ncursesSupport) "-DBUILD_NCURSES=OFF" - ++ optional rssSupport "-DBUILD_RSS=ON" - ++ optional (!x11Support) "-DBUILD_X11=OFF" - ++ optional waylandSupport "-DBUILD_WAYLAND=ON" - ++ optional xdamageSupport "-DBUILD_XDAMAGE=ON" - ++ optional doubleBufferSupport "-DBUILD_XDBE=ON" - ++ optional weatherMetarSupport "-DBUILD_WEATHER_METAR=ON" - ++ optional weatherXoapSupport "-DBUILD_WEATHER_XOAP=ON" - ++ optional wirelessSupport "-DBUILD_WLAN=ON" - ++ optional nvidiaSupport "-DBUILD_NVIDIA=ON" - ++ optional pulseSupport "-DBUILD_PULSEAUDIO=ON" - ++ optional journalSupport "-DBUILD_JOURNAL=ON" + ++ lib.optional docsSupport "-DMAINTAINER_MODE=ON" + ++ lib.optional curlSupport "-DBUILD_CURL=ON" + ++ lib.optional (!ibmSupport) "-DBUILD_IBM=OFF" + ++ lib.optional imlib2Support "-DBUILD_IMLIB2=ON" + ++ lib.optional luaCairoSupport "-DBUILD_LUA_CAIRO=ON" + ++ lib.optional luaImlib2Support "-DBUILD_LUA_IMLIB2=ON" + ++ lib.optional (!mpdSupport) "-DBUILD_MPD=OFF" + ++ lib.optional (!ncursesSupport) "-DBUILD_NCURSES=OFF" + ++ lib.optional rssSupport "-DBUILD_RSS=ON" + ++ lib.optional (!x11Support) "-DBUILD_X11=OFF" + ++ lib.optional waylandSupport "-DBUILD_WAYLAND=ON" + ++ lib.optional xdamageSupport "-DBUILD_XDAMAGE=ON" + ++ lib.optional doubleBufferSupport "-DBUILD_XDBE=ON" + ++ lib.optional weatherMetarSupport "-DBUILD_WEATHER_METAR=ON" + ++ lib.optional weatherXoapSupport "-DBUILD_WEATHER_XOAP=ON" + ++ lib.optional wirelessSupport "-DBUILD_WLAN=ON" + ++ lib.optional nvidiaSupport "-DBUILD_NVIDIA=ON" + ++ lib.optional pulseSupport "-DBUILD_PULSEAUDIO=ON" + ++ lib.optional journalSupport "-DBUILD_JOURNAL=ON" ; # `make -f src/CMakeFiles/conky.dir/build.make src/CMakeFiles/conky.dir/conky.cc.o`: diff --git a/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix b/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix index 53f32ac31f9d6..49a3b9c13ac4f 100644 --- a/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix +++ b/pkgs/os-specific/linux/firmware/rtl8192su-firmware/default.nix @@ -1,5 +1,4 @@ { lib, stdenvNoCC, fetchFromGitHub }: -with lib; stdenvNoCC.mkDerivation { pname = "rtl8192su"; version = "unstable-2016-10-05"; diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index bbfb317d67ac8..629eff65368d2 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -15,18 +15,15 @@ , features ? {} }: -with lib; with lib.kernel; with (lib.kernel.whenHelpers version); let - - # configuration items have to be part of a subattrs - flattenKConf = nested: mapAttrs (name: values: if length values == 1 then head values else throw "duplicate kernel configuration option: ${name}") (zipAttrs (attrValues nested)); + flattenKConf = nested: lib.mapAttrs (name: values: if lib.length values == 1 then lib.head values else throw "duplicate kernel configuration option: ${name}") (lib.zipAttrs (lib.attrValues nested)); whenPlatformHasEBPFJit = - mkIf (stdenv.hostPlatform.isAarch32 || + lib.mkIf (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isx86_64 || (stdenv.hostPlatform.isPower && stdenv.hostPlatform.is64bit) || @@ -36,7 +33,7 @@ let debug = { # Necessary for BTF - DEBUG_INFO = mkMerge [ + DEBUG_INFO = lib.mkMerge [ (whenOlder "5.2" (if (features.debug or false) then yes else no)) (whenBetween "5.2" "5.18" yes) ]; @@ -129,7 +126,7 @@ let # Enable Pulse-Width-Modulation support, commonly used for fan and backlight. PWM = yes; - } // optionalAttrs (stdenv.hostPlatform.isx86) { + } // lib.optionalAttrs (stdenv.hostPlatform.isx86) { INTEL_IDLE = yes; INTEL_RAPL = whenAtLeast "5.3" module; X86_INTEL_LPSS = yes; @@ -170,7 +167,7 @@ let }; optimization = { - X86_GENERIC = mkIf (stdenv.hostPlatform.system == "i686-linux") yes; + X86_GENERIC = lib.mkIf (stdenv.hostPlatform.system == "i686-linux") yes; # Optimize with -O2, not -Os CC_OPTIMIZE_FOR_SIZE = no; }; @@ -188,7 +185,7 @@ let # Collect ECC errors and retire pages that fail too often RAS_CEC = yes; - } // optionalAttrs (stdenv.is32bit) { + } // lib.optionalAttrs (stdenv.is32bit) { # Enable access to the full memory range (aka PAE) on 32-bit architectures # This check isn't super accurate but it's close enough HIGHMEM = option yes; @@ -220,7 +217,7 @@ let timer = { # Enable Full Dynticks System. # NO_HZ_FULL depends on HAVE_VIRT_CPU_ACCOUNTING_GEN depends on 64BIT - NO_HZ_FULL = mkIf stdenv.is64bit yes; + NO_HZ_FULL = lib.mkIf stdenv.is64bit yes; }; # Enable NUMA. @@ -309,7 +306,7 @@ let # IPv6: Netfilter Configuration NF_TABLES_IPV6 = yes; # Bridge Netfilter Configuration - NF_TABLES_BRIDGE = mkMerge [ (whenOlder "5.3" yes) + NF_TABLES_BRIDGE = lib.mkMerge [ (whenOlder "5.3" yes) (whenAtLeast "5.3" module) ]; # Expose some debug info NF_CONNTRACK_PROCFS = yes; @@ -321,11 +318,11 @@ let # needed for ss # Use a lower priority to allow these options to be overridden in hardened/config.nix - INET_DIAG = mkDefault module; - INET_TCP_DIAG = mkDefault module; - INET_UDP_DIAG = mkDefault module; - INET_RAW_DIAG = mkDefault module; - INET_DIAG_DESTROY = mkDefault yes; + INET_DIAG = lib.mkDefault module; + INET_TCP_DIAG = lib.mkDefault module; + INET_UDP_DIAG = lib.mkDefault module; + INET_RAW_DIAG = lib.mkDefault module; + INET_DIAG_DESTROY = lib.mkDefault yes; # IPsec over TCP INET_ESPINTCP = whenAtLeast "5.8" yes; @@ -334,7 +331,7 @@ let # enable multipath-tcp MPTCP = whenAtLeast "5.6" yes; MPTCP_IPV6 = whenAtLeast "5.6" yes; - INET_MPTCP_DIAG = whenAtLeast "5.9" (mkDefault module); + INET_MPTCP_DIAG = whenAtLeast "5.9" (lib.mkDefault module); # Kernel TLS TLS = module; @@ -348,7 +345,7 @@ let # Enable debugfs for wireless drivers CFG80211_DEBUGFS = yes; MAC80211_DEBUGFS = yes; - } // optionalAttrs (stdenv.hostPlatform.system == "aarch64-linux") { + } // lib.optionalAttrs (stdenv.hostPlatform.system == "aarch64-linux") { # Not enabled by default, hides modules behind it NET_VENDOR_MEDIATEK = yes; # Enable SoC interface for MT7915 module, required for MT798X. @@ -381,8 +378,8 @@ let B43_PHY_HT = option yes; BCMA_HOST_PCI = option yes; RTW88 = whenAtLeast "5.2" module; - RTW88_8822BE = mkMerge [ (whenBetween "5.2" "5.8" yes) (whenAtLeast "5.8" module) ]; - RTW88_8822CE = mkMerge [ (whenBetween "5.2" "5.8" yes) (whenAtLeast "5.8" module) ]; + RTW88_8822BE = lib.mkMerge [ (whenBetween "5.2" "5.8" yes) (whenAtLeast "5.8" module) ]; + RTW88_8822CE = lib.mkMerge [ (whenBetween "5.2" "5.8" yes) (whenAtLeast "5.8" module) ]; }; fb = { @@ -402,7 +399,7 @@ let FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER = yes; FRAMEBUFFER_CONSOLE_ROTATION = yes; FRAMEBUFFER_CONSOLE_DETECT_PRIMARY = yes; - FB_GEODE = mkIf (stdenv.hostPlatform.system == "i686-linux") yes; + FB_GEODE = lib.mkIf (stdenv.hostPlatform.system == "i686-linux") yes; # Use simplefb on older kernels where we don't have simpledrm (enabled below) FB_SIMPLE = whenOlder "5.15" yes; DRM_FBDEV_EMULATION = yes; @@ -418,7 +415,7 @@ let }; video = let - whenHasDevicePrivate = mkIf (!stdenv.isx86_32 && versionAtLeast version "5.1"); + whenHasDevicePrivate = lib.mkIf (!stdenv.isx86_32 && lib.versionAtLeast version "5.1"); in { # compile in DRM so simpledrm can load before initrd if necessary AGP = yes; @@ -477,13 +474,13 @@ let # Enable CEC over DisplayPort DRM_DP_CEC = whenOlder "6.10" yes; DRM_DISPLAY_DP_AUX_CEC = whenAtLeast "6.10" yes; - } // optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") { + } // lib.optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") { # Intel GVT-g graphics virtualization supports 64-bit only DRM_I915_GVT = yes; DRM_I915_GVT_KVMGT = module; # Enable Hyper-V Synthetic DRM Driver DRM_HYPERV = whenAtLeast "5.14" module; - } // optionalAttrs (stdenv.hostPlatform.system == "aarch64-linux") { + } // lib.optionalAttrs (stdenv.hostPlatform.system == "aarch64-linux") { # enable HDMI-CEC on RPi boards DRM_VC4_HDMI_CEC = yes; }; @@ -493,7 +490,7 @@ let # of time to appear and this would hold up Linux kernel and Rust toolchain updates. # # Once Rust in the kernel has more users, we can reconsider enabling it by default. - rust = optionalAttrs ((features.rust or false) && versionAtLeast version "6.7") { + rust = lib.optionalAttrs ((features.rust or false) && lib.versionAtLeast version "6.7") { RUST = yes; GCC_PLUGINS = no; }; @@ -516,8 +513,8 @@ let SND_USB_CAIAQ_INPUT = yes; SND_USB_AUDIO_MIDI_V2 = whenAtLeast "6.5" yes; # Enable Sound Open Firmware support - } // optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux" && - versionAtLeast version "5.5") { + } // lib.optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux" && + lib.versionAtLeast version "5.5") { SND_SOC_INTEL_SOUNDWIRE_SOF_MACH = whenAtLeast "5.10" module; SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES = whenAtLeast "5.10" yes; # dep of SOF_MACH SND_SOC_SOF_INTEL_SOUNDWIRE_LINK = whenBetween "5.10" "5.11" yes; # dep of SOF_MACH @@ -578,7 +575,7 @@ let TMPFS = yes; TMPFS_POSIX_ACL = yes; - FS_ENCRYPTION = if (versionAtLeast version "5.1") then yes else option module; + FS_ENCRYPTION = if (lib.versionAtLeast version "5.1") then yes else option module; EXT2_FS_XATTR = yes; EXT2_FS_POSIX_ACL = yes; @@ -685,8 +682,8 @@ let RANDOMIZE_BASE = option yes; STRICT_KERNEL_RWX = yes; STRICT_MODULE_RWX = yes; - STRICT_DEVMEM = mkDefault yes; # Filter access to /dev/mem - IO_STRICT_DEVMEM = mkDefault yes; + STRICT_DEVMEM = lib.mkDefault yes; # Filter access to /dev/mem + IO_STRICT_DEVMEM = lib.mkDefault yes; SECURITY_SELINUX_BOOTPARAM_VALUE = whenOlder "5.1" (freeform "0"); # Disable SELinux by default # Prevent processes from ptracing non-children processes @@ -737,7 +734,7 @@ let # Enable stack smashing protections in schedule() # See: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.8&id=0d9e26329b0c9263d4d9e0422d80a0e73268c52f SCHED_STACK_END_CHECK = yes; - } // optionalAttrs stdenv.hostPlatform.isx86_64 { + } // lib.optionalAttrs stdenv.hostPlatform.isx86_64 { # Enable Intel SGX X86_SGX = whenAtLeast "5.11" yes; # Allow KVM guests to load SGX enclaves @@ -759,7 +756,7 @@ let MITIGATION_SLS = whenAtLeast "6.9" yes; DEFAULT_MMAP_MIN_ADDR = freeform "65536"; - } // optionalAttrs stdenv.hostPlatform.isAarch64 { + } // lib.optionalAttrs stdenv.hostPlatform.isAarch64 { DEFAULT_MMAP_MIN_ADDR = freeform "32768"; }; @@ -838,9 +835,9 @@ let KSM = yes; VIRT_DRIVERS = yes; # We need 64 GB (PAE) support for Xen guest support - HIGHMEM64G = { optional = true; tristate = mkIf (!stdenv.is64bit) "y";}; + HIGHMEM64G = { optional = true; tristate = lib.mkIf (!stdenv.is64bit) "y";}; - VFIO_PCI_VGA = mkIf stdenv.is64bit yes; + VFIO_PCI_VGA = lib.mkIf stdenv.is64bit yes; UDMABUF = whenAtLeast "4.20" yes; @@ -900,7 +897,7 @@ let ZRAM_MULTI_COMP = whenAtLeast "6.2" yes; ZRAM_DEF_COMP_ZSTD = whenAtLeast "5.11" yes; ZSWAP = option yes; - ZSWAP_COMPRESSOR_DEFAULT_ZSTD = whenAtLeast "5.7" (mkOptionDefault yes); + ZSWAP_COMPRESSOR_DEFAULT_ZSTD = whenAtLeast "5.7" (lib.mkOptionDefault yes); ZPOOL = yes; ZSMALLOC = option yes; }; @@ -912,7 +909,7 @@ let }; # Support x2APIC (which requires IRQ remapping) - x2apic = optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") { + x2apic = lib.optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") { X86_X2APIC = yes; IRQ_REMAP = yes; }; @@ -943,18 +940,18 @@ let # Allows soft-dirty tracking on pages, used by CRIU. # See https://docs.kernel.org/admin-guide/mm/soft-dirty.html - MEM_SOFT_DIRTY = mkIf (!stdenv.isx86_32) yes; + MEM_SOFT_DIRTY = lib.mkIf (!stdenv.isx86_32) yes; }; misc = let # Use zstd for kernel compression if 64-bit and newer than 5.9, otherwise xz. # i686 issues: https://github.com/NixOS/nixpkgs/pull/117961#issuecomment-812106375 - useZstd = stdenv.buildPlatform.is64bit && versionAtLeast version "5.9"; + useZstd = stdenv.buildPlatform.is64bit && lib.versionAtLeast version "5.9"; in { # stdenv.hostPlatform.linux-kernel.target assumes uncompressed on RISC-V. - KERNEL_UNCOMPRESSED = mkIf stdenv.hostPlatform.isRiscV yes; - KERNEL_XZ = mkIf (!stdenv.hostPlatform.isRiscV && !useZstd) yes; - KERNEL_ZSTD = mkIf (!stdenv.hostPlatform.isRiscV && useZstd) yes; + KERNEL_UNCOMPRESSED = lib.mkIf stdenv.hostPlatform.isRiscV yes; + KERNEL_XZ = lib.mkIf (!stdenv.hostPlatform.isRiscV && !useZstd) yes; + KERNEL_ZSTD = lib.mkIf (!stdenv.hostPlatform.isRiscV && useZstd) yes; HID_BATTERY_STRENGTH = yes; # enabled by default in x86_64 but not arm64, so we do that here @@ -1056,7 +1053,7 @@ let # Generic compression support for EFI payloads # Add new platforms only after they have been verified to build and boot. # This is unsupported on x86 due to a custom decompression mechanism. - EFI_ZBOOT = mkIf stdenv.hostPlatform.isAarch64 (whenAtLeast "6.1" yes); + EFI_ZBOOT = lib.mkIf stdenv.hostPlatform.isAarch64 (whenAtLeast "6.1" yes); CGROUPS = yes; # used by systemd FHANDLE = yes; # used by systemd @@ -1090,7 +1087,7 @@ let NVME_MULTIPATH = yes; - NVME_AUTH = mkMerge [ + NVME_AUTH = lib.mkMerge [ (whenBetween "6.0" "6.7" yes) (whenAtLeast "6.7" module) ]; @@ -1103,7 +1100,7 @@ let NVME_TARGET_AUTH = whenAtLeast "6.0" yes; NVME_TARGET_TCP_TLS = whenAtLeast "6.7" yes; - PCI_P2PDMA = mkIf (stdenv.hostPlatform.is64bit && versionAtLeast version "4.20") yes; + PCI_P2PDMA = lib.mkIf (stdenv.hostPlatform.is64bit && lib.versionAtLeast version "4.20") yes; PSI = whenAtLeast "4.20" yes; @@ -1169,8 +1166,8 @@ let HOTPLUG_PCI_PCIE = yes; # PCI-Expresscard hotplug support # Enable AMD's ROCm GPU compute stack - HSA_AMD = mkIf stdenv.hostPlatform.is64bit (whenAtLeast "4.20" yes); - ZONE_DEVICE = mkIf stdenv.hostPlatform.is64bit (whenAtLeast "5.3" yes); + HSA_AMD = lib.mkIf stdenv.hostPlatform.is64bit (whenAtLeast "4.20" yes); + ZONE_DEVICE = lib.mkIf stdenv.hostPlatform.is64bit (whenAtLeast "5.3" yes); HMM_MIRROR = whenAtLeast "5.3" yes; DRM_AMDGPU_USERPTR = whenAtLeast "5.3" yes; @@ -1188,7 +1185,7 @@ let LRU_GEN = whenAtLeast "6.1" yes; LRU_GEN_ENABLED = whenAtLeast "6.1" yes; - FSL_MC_UAPI_SUPPORT = mkIf (stdenv.hostPlatform.system == "aarch64-linux") (whenAtLeast "5.12" yes); + FSL_MC_UAPI_SUPPORT = lib.mkIf (stdenv.hostPlatform.system == "aarch64-linux") (whenAtLeast "5.12" yes); ASHMEM = { optional = true; tristate = whenBetween "5.0" "5.18" "y";}; ANDROID = { optional = true; tristate = whenBetween "5.0" "5.19" "y";}; @@ -1217,7 +1214,7 @@ let # Enable generic kernel watch queues # See https://docs.kernel.org/core-api/watch_queue.html WATCH_QUEUE = whenAtLeast "5.8" yes; - } // optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "aarch64-linux") { + } // lib.optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "aarch64-linux") { # Enable CPU/memory hotplug support # Allows you to dynamically add & remove CPUs/memory to a VM client running NixOS without requiring a reboot ACPI_HOTPLUG_CPU = yes; @@ -1234,7 +1231,7 @@ let # Enable LEDS to display link-state status of PHY devices (i.e. eth lan/wan interfaces) LED_TRIGGER_PHY = whenAtLeast "4.10" yes; - } // optionalAttrs (stdenv.hostPlatform.system == "armv7l-linux" || stdenv.hostPlatform.system == "aarch64-linux") { + } // lib.optionalAttrs (stdenv.hostPlatform.system == "armv7l-linux" || stdenv.hostPlatform.system == "aarch64-linux") { # Enables support for the Allwinner Display Engine 2.0 SUN8I_DE2_CCU = yes; @@ -1260,7 +1257,7 @@ let # This is the default on armv7l, anyway, but it is explicitly # enabled here for the sake of providing context for the # aarch64 compat option which follows. - ALIGNMENT_TRAP = mkIf (stdenv.hostPlatform.system == "armv7l-linux") yes; + ALIGNMENT_TRAP = lib.mkIf (stdenv.hostPlatform.system == "armv7l-linux") yes; # https://patchwork.kernel.org/project/linux-arm-kernel/patch/20220701135322.3025321-1-ardb@kernel.org/ # tldr: @@ -1272,8 +1269,8 @@ let # This minimizes the potential for aarch32 userspace to behave # differently when run under aarch64 kernels compared to when # it is run under an aarch32 kernel. - COMPAT_ALIGNMENT_FIXUPS = mkIf (stdenv.hostPlatform.system == "aarch64-linux") (whenAtLeast "6.1" yes); - } // optionalAttrs (versionAtLeast version "5.4" && (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "aarch64-linux")) { + COMPAT_ALIGNMENT_FIXUPS = lib.mkIf (stdenv.hostPlatform.system == "aarch64-linux") (whenAtLeast "6.1" yes); + } // lib.optionalAttrs (lib.versionAtLeast version "5.4" && (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "aarch64-linux")) { # Required for various hardware features on Chrome OS devices CHROME_PLATFORMS = yes; CHROMEOS_TBMC = module; @@ -1288,10 +1285,10 @@ let CROS_KBD_LED_BACKLIGHT = module; TCG_TIS_SPI_CR50 = whenAtLeast "5.5" yes; - } // optionalAttrs (versionAtLeast version "5.4" && stdenv.hostPlatform.system == "x86_64-linux") { + } // lib.optionalAttrs (lib.versionAtLeast version "5.4" && stdenv.hostPlatform.system == "x86_64-linux") { CHROMEOS_LAPTOP = module; CHROMEOS_PSTORE = module; - } // optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") { + } // lib.optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux") { # Enable x86 resource control X86_CPU_RESCTRL = whenAtLeast "5.0" yes; diff --git a/pkgs/os-specific/linux/kernel/gpio-utils.nix b/pkgs/os-specific/linux/kernel/gpio-utils.nix index dc8f88b5769f7..88b8efbe540c2 100644 --- a/pkgs/os-specific/linux/kernel/gpio-utils.nix +++ b/pkgs/os-specific/linux/kernel/gpio-utils.nix @@ -1,7 +1,5 @@ { lib, stdenv, linux }: -with lib; - stdenv.mkDerivation { pname = "gpio-utils"; version = linux.version; @@ -15,7 +13,7 @@ stdenv.mkDerivation { separateDebugInfo = true; installFlags = [ "install" "DESTDIR=$(out)" "bindir=/bin" ]; - meta = { + meta = with lib; { description = "Linux tools to inspect the gpiochip interface"; maintainers = with maintainers; [ kwohlfahrt ]; platforms = platforms.linux; diff --git a/pkgs/os-specific/linux/kernel/hardened/config.nix b/pkgs/os-specific/linux/kernel/hardened/config.nix index 0ab89d23952db..f655f85f490e2 100644 --- a/pkgs/os-specific/linux/kernel/hardened/config.nix +++ b/pkgs/os-specific/linux/kernel/hardened/config.nix @@ -10,11 +10,10 @@ { stdenv, lib, version }: -with lib; with lib.kernel; with (lib.kernel.whenHelpers version); -assert (versionAtLeast version "4.9"); +assert (lib.versionAtLeast version "4.9"); { # Mark LSM hooks read-only after init. SECURITY_WRITABLE_HOOKS n diff --git a/pkgs/os-specific/linux/libselinux/default.nix b/pkgs/os-specific/linux/libselinux/default.nix index 28cf291fd7851..583f6af2bc67a 100644 --- a/pkgs/os-specific/linux/libselinux/default.nix +++ b/pkgs/os-specific/linux/libselinux/default.nix @@ -6,14 +6,12 @@ assert enablePython -> swig != null && python3 != null; -with lib; - stdenv.mkDerivation (rec { pname = "libselinux"; version = "3.6"; inherit (libsepol) se_url; - outputs = [ "bin" "out" "dev" "man" ] ++ optional enablePython "py"; + outputs = [ "bin" "out" "dev" "man" ] ++ lib.optional enablePython "py"; src = fetchurl { url = "${se_url}/${version}/libselinux-${version}.tar.gz"; @@ -46,13 +44,13 @@ stdenv.mkDerivation (rec { }) ]; - nativeBuildInputs = [ pkg-config python3 ] ++ optionals enablePython [ + nativeBuildInputs = [ pkg-config python3 ] ++ lib.optionals enablePython [ python3Packages.pip python3Packages.setuptools python3Packages.wheel swig ]; - buildInputs = [ libsepol pcre2 fts ] ++ optionals enablePython [ python3 ]; + buildInputs = [ libsepol pcre2 fts ] ++ lib.optionals enablePython [ python3 ]; # drop fortify here since package uses it by default, leading to compile error: # command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror] @@ -72,11 +70,11 @@ stdenv.mkDerivation (rec { "LIBSEPOLA=${lib.getLib libsepol}/lib/libsepol.a" "ARCH=${stdenv.hostPlatform.linuxArch}" - ] ++ optionals (fts != null) [ + ] ++ lib.optionals (fts != null) [ "FTS_LDLIBS=-lfts" - ] ++ optionals stdenv.hostPlatform.isStatic [ + ] ++ lib.optionals stdenv.hostPlatform.isStatic [ "DISABLE_SHARED=y" - ] ++ optionals enablePython [ + ] ++ lib.optionals enablePython [ "PYTHON=${python3.pythonOnBuildForHost.interpreter}" "PYTHONLIBDIR=$(py)/${python3.sitePackages}" "PYTHON_SETUP_ARGS=--no-build-isolation" @@ -87,11 +85,11 @@ stdenv.mkDerivation (rec { --replace "#include " "" ''; - preInstall = optionalString enablePython '' + preInstall = lib.optionalString enablePython '' mkdir -p $py/${python3.sitePackages}/selinux ''; - installTargets = [ "install" ] ++ optional enablePython "install-pywrap"; + installTargets = [ "install" ] ++ lib.optional enablePython "install-pywrap"; meta = removeAttrs libsepol.meta ["outputsToInstall"] // { description = "SELinux core library"; diff --git a/pkgs/os-specific/linux/libsemanage/default.nix b/pkgs/os-specific/linux/libsemanage/default.nix index 966ac7c945b05..1c1d66432db43 100644 --- a/pkgs/os-specific/linux/libsemanage/default.nix +++ b/pkgs/os-specific/linux/libsemanage/default.nix @@ -2,8 +2,6 @@ , enablePython ? true, swig ? null, python ? null }: -with lib; - stdenv.mkDerivation rec { pname = "libsemanage"; version = "3.7"; @@ -14,13 +12,13 @@ stdenv.mkDerivation rec { sha256 = "sha256-4WbK4ppBfasAjbnKCHQCPzU6MBewdpOgNu2XSH7aNbE="; }; - outputs = [ "out" "dev" "man" ] ++ optional enablePython "py"; + outputs = [ "out" "dev" "man" ] ++ lib.optional enablePython "py"; strictDeps = true; - nativeBuildInputs = [ bison flex pkg-config ] ++ optional enablePython swig; + nativeBuildInputs = [ bison flex pkg-config ] ++ lib.optional enablePython swig; buildInputs = [ libsepol libselinux bzip2 audit ] - ++ optional enablePython python; + ++ lib.optional enablePython python; makeFlags = [ "PREFIX=$(out)" @@ -43,7 +41,7 @@ stdenv.mkDerivation rec { # cc1: all warnings being treated as errors env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=clobbered" ]; - installTargets = [ "install" ] ++ optionals enablePython [ "install-pywrap" ]; + installTargets = [ "install" ] ++ lib.optionals enablePython [ "install-pywrap" ]; enableParallelBuilding = true; diff --git a/pkgs/os-specific/linux/mwprocapture/default.nix b/pkgs/os-specific/linux/mwprocapture/default.nix index 711a14845df76..b0513f5663d49 100644 --- a/pkgs/os-specific/linux/mwprocapture/default.nix +++ b/pkgs/os-specific/linux/mwprocapture/default.nix @@ -1,13 +1,11 @@ { lib, stdenv, fetchurl, kernel, alsa-lib }: -with lib; - let bits = if stdenv.is64bit then "64" else "32"; - libpath = makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc alsa-lib ]; + libpath = lib.makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc alsa-lib ]; in stdenv.mkDerivation rec { @@ -56,7 +54,7 @@ stdenv.mkDerivation rec { "$out"/bin/mwcap-info ''; - meta = { + meta = with lib; { homepage = "https://www.magewell.com/"; description = "Linux driver for the Magewell Pro Capture family"; license = licenses.unfreeRedistributable; diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix index 5907c6e81e430..87fde8db23408 100644 --- a/pkgs/os-specific/linux/nvidia-x11/generic.nix +++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix @@ -59,19 +59,17 @@ , acceptLicense ? config.nvidia.acceptLicense or false }: -with lib; - assert !libsOnly -> kernel != null; -assert versionOlder version "391" -> sha256_32bit != null; +assert lib.versionOlder version "391" -> sha256_32bit != null; assert useSettings -> settingsSha256 != null; assert usePersistenced -> persistencedSha256 != null; assert useFabricmanager -> fabricmanagerSha256 != null; assert useFabricmanager -> !useSettings; let - nameSuffix = optionalString (!libsOnly) "-${kernel.version}"; - pkgSuffix = optionalString (versionOlder version "304") "-pkg0"; - i686bundled = versionAtLeast version "391" && !disable32Bit; + nameSuffix = lib.optionalString (!libsOnly) "-${kernel.version}"; + pkgSuffix = lib.optionalString (lib.versionOlder version "304") "-pkg0"; + i686bundled = lib.versionAtLeast version "391" && !disable32Bit; libPathFor = pkgs: lib.makeLibraryPath (with pkgs; [ libdrm @@ -153,15 +151,15 @@ let inherit i686bundled; outputs = [ "out" ] - ++ optional i686bundled "lib32" - ++ optional (!libsOnly) "bin" - ++ optional (!libsOnly && firmware) "firmware"; + ++ lib.optional i686bundled "lib32" + ++ lib.optional (!libsOnly) "bin" + ++ lib.optional (!libsOnly && firmware) "firmware"; outputDev = if libsOnly then null else "bin"; kernel = if libsOnly then null else kernel.dev; kernelVersion = if libsOnly then null else kernel.modDirVersion; - makeFlags = optionals (!libsOnly) (kernel.makeFlags ++ [ + makeFlags = lib.optionals (!libsOnly) (kernel.makeFlags ++ [ "IGNORE_PREEMPT_RT_PRESENCE=1" "NV_BUILD_SUPPORTS_HMM=1" "SYSSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source" @@ -174,12 +172,12 @@ let dontPatchELF = true; libPath = libPathFor pkgs; - libPath32 = optionalString i686bundled (libPathFor pkgsi686Linux); + libPath32 = lib.optionalString i686bundled (libPathFor pkgsi686Linux); nativeBuildInputs = [ perl nukeReferences which libarchive jq ] - ++ optionals (!libsOnly) kernel.moduleBuildDependencies; + ++ lib.optionals (!libsOnly) kernel.moduleBuildDependencies; - disallowedReferences = optionals (!libsOnly) [ kernel.dev ]; + disallowedReferences = lib.optionals (!libsOnly) [ kernel.dev ]; passthru = let @@ -199,7 +197,7 @@ let }); in { - open = mapNullable + open = lib.mapNullable (hash: callPackage ./open.nix { inherit hash; nvidia_x11 = self; @@ -216,7 +214,7 @@ let } else { }; persistenced = if usePersistenced then - mapNullable + lib.mapNullable (hash: callPackage (import ./persistenced.nix self hash) { fetchFromGitHub = fetchFromGithubOrNvidia; }) @@ -224,12 +222,12 @@ let else { }; fabricmanager = if useFabricmanager then - mapNullable (hash: callPackage (import ./fabricmanager.nix self hash) { }) fabricmanagerSha256 + lib.mapNullable (hash: callPackage (import ./fabricmanager.nix self hash) { }) fabricmanagerSha256 else { }; inherit persistencedVersion settingsVersion; compressFirmware = false; ibtSupport = ibtSupport || (lib.versionAtLeast version "530"); - } // optionalAttrs (!i686bundled) { + } // lib.optionalAttrs (!i686bundled) { inherit lib32; }; @@ -238,8 +236,8 @@ let description = "${if useFabricmanager then "Data Center" else "X.org"} driver and kernel module for NVIDIA cards"; license = licenses.unfreeRedistributable; platforms = [ "x86_64-linux" ] - ++ optionals (sha256_32bit != null) [ "i686-linux" ] - ++ optionals (sha256_aarch64 != null) [ "aarch64-linux" ]; + ++ lib.optionals (sha256_32bit != null) [ "i686-linux" ] + ++ lib.optionals (sha256_aarch64 != null) [ "aarch64-linux" ]; maintainers = with maintainers; [ kiskae edwtjo ]; priority = 4; # resolves collision with xorg-server's "lib/xorg/modules/extensions/libglx.so" inherit broken; diff --git a/pkgs/os-specific/linux/rtl8192eu/default.nix b/pkgs/os-specific/linux/rtl8192eu/default.nix index 529f16fc1db4f..425edf3309ca4 100644 --- a/pkgs/os-specific/linux/rtl8192eu/default.nix +++ b/pkgs/os-specific/linux/rtl8192eu/default.nix @@ -1,7 +1,5 @@ { stdenv, lib, fetchFromGitHub, kernel, bc }: -with lib; - let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/rtl8192eu"; in stdenv.mkDerivation { diff --git a/pkgs/os-specific/linux/selinux-python/default.nix b/pkgs/os-specific/linux/selinux-python/default.nix index 121511401151f..c2d91104bf4f5 100644 --- a/pkgs/os-specific/linux/selinux-python/default.nix +++ b/pkgs/os-specific/linux/selinux-python/default.nix @@ -2,9 +2,6 @@ , libselinux, libsemanage, libsepol, setools }: # this is python3 only because setools only supports python3 - -with lib; - stdenv.mkDerivation rec { pname = "selinux-python"; version = "3.3"; @@ -42,7 +39,7 @@ stdenv.mkDerivation rec { wrapPythonPrograms ''; - meta = { + meta = with lib; { description = "SELinux policy core utilities written in Python"; license = licenses.gpl2Plus; homepage = "https://selinuxproject.org"; diff --git a/pkgs/os-specific/linux/selinux-sandbox/default.nix b/pkgs/os-specific/linux/selinux-sandbox/default.nix index 0b4f0a203b81e..cbddfc3ec50a3 100644 --- a/pkgs/os-specific/linux/selinux-sandbox/default.nix +++ b/pkgs/os-specific/linux/selinux-sandbox/default.nix @@ -4,7 +4,6 @@ # this is python3 only as it depends on selinux-python -with lib; with python3.pkgs; stdenv.mkDerivation rec { @@ -51,7 +50,7 @@ stdenv.mkDerivation rec { wrapPythonPrograms ''; - meta = { + meta = with lib; { description = "SELinux sandbox utility"; license = licenses.gpl2Only; homepage = "https://selinuxproject.org"; diff --git a/pkgs/os-specific/linux/setools/default.nix b/pkgs/os-specific/linux/setools/default.nix index 5a2f180a0ad96..7442815f3a7da 100644 --- a/pkgs/os-specific/linux/setools/default.nix +++ b/pkgs/os-specific/linux/setools/default.nix @@ -3,10 +3,7 @@ , withGraphics ? false }: -with lib; -with python3.pkgs; - -buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "setools"; version = "4.5.1"; @@ -17,12 +14,12 @@ buildPythonApplication rec { hash = "sha256-/6dOzSz2Do4d6TSS50fuak0CysoQ532zJ0bJ532BUCE="; }; - nativeBuildInputs = [ cython ]; + nativeBuildInputs = [ python3.pkgs.cython ]; buildInputs = [ libsepol ]; - propagatedBuildInputs = [ enum34 libselinux networkx setuptools ] - ++ optionals withGraphics [ pyqt5 ]; + propagatedBuildInputs = with python3.pkgs; [ enum34 libselinux networkx setuptools ] + ++ lib.optionals withGraphics [ pyqt5 ]; - nativeCheckInputs = [ tox checkpolicy ]; + nativeCheckInputs = [ python3.pkgs.tox checkpolicy ]; preCheck = '' export CHECKPOLICY=${checkpolicy}/bin/checkpolicy ''; @@ -33,7 +30,7 @@ buildPythonApplication rec { export SEPOL="${lib.getLib libsepol}/lib/libsepol.a" ''; - meta = { + meta = with lib; { description = "SELinux Policy Analysis Tools"; homepage = "https://github.com/SELinuxProject/setools"; license = licenses.gpl2Only; diff --git a/pkgs/os-specific/linux/wpa_supplicant/default.nix b/pkgs/os-specific/linux/wpa_supplicant/default.nix index 617eadbcc59f3..4770f0956d567 100644 --- a/pkgs/os-specific/linux/wpa_supplicant/default.nix +++ b/pkgs/os-specific/linux/wpa_supplicant/default.nix @@ -5,7 +5,6 @@ , withPcsclite ? !stdenv.hostPlatform.isStatic, pcsclite }: -with lib; stdenv.mkDerivation rec { version = "2.11"; @@ -70,12 +69,12 @@ stdenv.mkDerivation rec { CONFIG_WPS_NFS=y CONFIG_SUITEB=y CONFIG_SUITEB192=y - '' + optionalString withPcsclite '' + '' + lib.optionalString withPcsclite '' CONFIG_EAP_SIM=y CONFIG_EAP_AKA=y CONFIG_EAP_AKA_PRIME=y CONFIG_PCSC=y - '' + optionalString dbusSupport '' + '' + lib.optionalString dbusSupport '' CONFIG_CTRL_IFACE_DBUS=y CONFIG_CTRL_IFACE_DBUS_NEW=y CONFIG_CTRL_IFACE_DBUS_INTRO=y @@ -84,7 +83,7 @@ stdenv.mkDerivation rec { # not =n, as one may expect, but undefine. # # This config is sourced into makefile. - + optionalString (!dbusSupport) '' + + lib.optionalString (!dbusSupport) '' undefine CONFIG_CTRL_IFACE_DBUS undefine CONFIG_CTRL_IFACE_DBUS_NEW undefine CONFIG_CTRL_IFACE_DBUS_INTRO @@ -105,13 +104,13 @@ stdenv.mkDerivation rec { substituteInPlace Makefile --replace /usr/local $out export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE \ -I$(echo "${lib.getDev libnl}"/include/libnl*/) \ - ${optionalString withPcsclite "-I${lib.getDev pcsclite}/include/PCSC/"}" + ${lib.optionalString withPcsclite "-I${lib.getDev pcsclite}/include/PCSC/"}" ''; buildInputs = [ openssl libnl ] - ++ optional dbusSupport dbus - ++ optional withReadline readline - ++ optional withPcsclite pcsclite; + ++ lib.optional dbusSupport dbus + ++ lib.optional withReadline readline + ++ lib.optional withPcsclite pcsclite; nativeBuildInputs = [ pkg-config ]; diff --git a/pkgs/os-specific/windows/cygwin-setup/default.nix b/pkgs/os-specific/windows/cygwin-setup/default.nix index 074157c182c38..a88d802c5cf79 100644 --- a/pkgs/os-specific/windows/cygwin-setup/default.nix +++ b/pkgs/os-specific/windows/cygwin-setup/default.nix @@ -2,8 +2,6 @@ , zlib, bzip2, xz, libgcrypt }: -with lib; - stdenv.mkDerivation rec { pname = "cygwin-setup"; version = "20131101"; @@ -18,9 +16,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoconf automake libtool flex bison pkg-config ]; buildInputs = let - mkStatic = flip overrideDerivation (o: { + mkStatic = lib.flip lib.overrideDerivation (o: { dontDisableStatic = true; - configureFlags = toList (o.configureFlags or []) ++ [ "--enable-static" ]; + configureFlags = lib.toList (o.configureFlags or []) ++ [ "--enable-static" ]; buildInputs = map mkStatic (o.buildInputs or []); propagatedBuildInputs = map mkStatic (o.propagatedBuildInputs or []); }); @@ -41,6 +39,6 @@ stdenv.mkDerivation rec { meta = { homepage = "https://sourceware.org/cygwin-apps/setup.html"; description = "Tool for installing Cygwin"; - license = licenses.gpl2Plus; + license = lib.licenses.gpl2Plus; }; } diff --git a/pkgs/shells/zsh/grml-zsh-config/default.nix b/pkgs/shells/zsh/grml-zsh-config/default.nix index ed7e81fd88d60..00349696bd3f3 100644 --- a/pkgs/shells/zsh/grml-zsh-config/default.nix +++ b/pkgs/shells/zsh/grml-zsh-config/default.nix @@ -1,8 +1,4 @@ -{ stdenv, fetchFromGitHub, lib -, zsh, coreutils, inetutils, procps, txt2tags }: - -with lib; - +{ stdenv, fetchFromGitHub, lib, zsh, coreutils, inetutils, procps, txt2tags }: stdenv.mkDerivation rec { pname = "grml-zsh-config"; version = "0.19.7"; @@ -17,7 +13,7 @@ stdenv.mkDerivation rec { strictDeps = true; nativeBuildInputs = [ txt2tags ]; buildInputs = [ zsh coreutils procps ] - ++ optional stdenv.isLinux inetutils; + ++ lib.optional stdenv.isLinux inetutils; buildPhase = '' cd doc diff --git a/pkgs/shells/zsh/pure-prompt/default.nix b/pkgs/shells/zsh/pure-prompt/default.nix index 2a1ba113ce196..20da12041805b 100644 --- a/pkgs/shells/zsh/pure-prompt/default.nix +++ b/pkgs/shells/zsh/pure-prompt/default.nix @@ -1,7 +1,5 @@ { lib, stdenv, fetchFromGitHub }: -with lib; - stdenv.mkDerivation rec { pname = "pure-prompt"; version = "1.23.0"; @@ -21,7 +19,7 @@ stdenv.mkDerivation rec { cp async.zsh "$OUTDIR/async" ''; - meta = { + meta = with lib; { description = "Pretty, minimal and fast ZSH prompt"; homepage = "https://github.com/sindresorhus/pure"; license = licenses.mit; diff --git a/pkgs/test/kernel.nix b/pkgs/test/kernel.nix index e345d9fa207e7..210d69f7ffae3 100644 --- a/pkgs/test/kernel.nix +++ b/pkgs/test/kernel.nix @@ -2,9 +2,6 @@ # common-config.nix { lib, pkgs }: -with lib; -with kernel; - let lts_kernel = pkgs.linuxPackages.kernel; @@ -14,29 +11,29 @@ let structuredExtraConfig = structuredConfig; }).configfile.structuredConfig; - mandatoryVsOptionalConfig = mkMerge [ - { NIXOS_FAKE_USB_DEBUG = yes;} - { NIXOS_FAKE_USB_DEBUG = option yes; } + mandatoryVsOptionalConfig = lib.mkMerge [ + { NIXOS_FAKE_USB_DEBUG = lib.kernel.yes;} + { NIXOS_FAKE_USB_DEBUG = lib.kernel.option lib.kernel.yes; } ]; - freeformConfig = mkMerge [ - { NIXOS_FAKE_MMC_BLOCK_MINORS = freeform "32"; } # same as default, won't trigger any error - { NIXOS_FAKE_MMC_BLOCK_MINORS = freeform "64"; } # will trigger an error but the message is not great: + freeformConfig = lib.mkMerge [ + { NIXOS_FAKE_MMC_BLOCK_MINORS = lib.kernel.freeform "32"; } # same as default, won't trigger any error + { NIXOS_FAKE_MMC_BLOCK_MINORS = lib.kernel.freeform "64"; } # will trigger an error but the message is not great: ]; - mkDefaultWorksConfig = mkMerge [ - { "NIXOS_TEST_BOOLEAN" = yes; } - { "NIXOS_TEST_BOOLEAN" = lib.mkDefault no; } + mkDefaultWorksConfig = lib.mkMerge [ + { "NIXOS_TEST_BOOLEAN" = lib.kernel.yes; } + { "NIXOS_TEST_BOOLEAN" = lib.mkDefault lib.kernel.no; } ]; - allOptionalRemainOptional = mkMerge [ - { NIXOS_FAKE_USB_DEBUG = option yes;} - { NIXOS_FAKE_USB_DEBUG = option yes;} + allOptionalRemainOptional = lib.mkMerge [ + { NIXOS_FAKE_USB_DEBUG = lib.kernel.option lib.kernel.yes;} + { NIXOS_FAKE_USB_DEBUG = lib.kernel.option lib.kernel.yes;} ]; - failures = runTests { + failures = lib.runTests { testEasy = { - expr = (getConfig { NIXOS_FAKE_USB_DEBUG = yes;}).NIXOS_FAKE_USB_DEBUG; + expr = (getConfig { NIXOS_FAKE_USB_DEBUG = lib.kernel.yes;}).NIXOS_FAKE_USB_DEBUG; expected = { tristate = "y"; optional = false; freeform = null; }; };