Skip to content

Commit

Permalink
Merge pull request NixOS#172250 from Artturin/ridofnulls
Browse files Browse the repository at this point in the history
remove some useless null asserts
  • Loading branch information
Artturin authored May 10, 2022
2 parents 189af8d + 49b6244 commit 6d007b2
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 246 deletions.
63 changes: 21 additions & 42 deletions pkgs/applications/audio/deadbeef/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,35 @@
, pkg-config
, jansson
# deadbeef can use either gtk2 or gtk3
, gtk2Support ? false, gtk2 ? null
, gtk3Support ? true, gtk3 ? null, gsettings-desktop-schemas ? null, wrapGAppsHook ? null
, gtk2Support ? false, gtk2
, gtk3Support ? true, gtk3, gsettings-desktop-schemas, wrapGAppsHook
# input plugins
, vorbisSupport ? true, libvorbis ? null
, mp123Support ? true, libmad ? null
, flacSupport ? true, flac ? null
, wavSupport ? true, libsndfile ? null
, cdaSupport ? true, libcdio ? null, libcddb ? null
, aacSupport ? true, faad2 ? null
, opusSupport ? true, opusfile ? null
, wavpackSupport ? false, wavpack ? null
, ffmpegSupport ? false, ffmpeg ? null
, apeSupport ? true, yasm ? null
, vorbisSupport ? true, libvorbis
, mp123Support ? true, libmad
, flacSupport ? true, flac
, wavSupport ? true, libsndfile
, cdaSupport ? true, libcdio, libcddb
, aacSupport ? true, faad2
, opusSupport ? true, opusfile
, wavpackSupport ? false, wavpack
, ffmpegSupport ? false, ffmpeg
, apeSupport ? true, yasm
# misc plugins
, zipSupport ? true, libzip ? null
, artworkSupport ? true, imlib2 ? null
, hotkeysSupport ? true, libX11 ? null
, osdSupport ? true, dbus ? null
, zipSupport ? true, libzip
, artworkSupport ? true, imlib2
, hotkeysSupport ? true, libX11
, osdSupport ? true, dbus
# output plugins
, alsaSupport ? true, alsa-lib ? null
, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio ? null
, alsaSupport ? true, alsa-lib
, pulseSupport ? config.pulseaudio or stdenv.isLinux, libpulseaudio
# effect plugins
, resamplerSupport ? true, libsamplerate ? null
, overloadSupport ? true, zlib ? null
, resamplerSupport ? true, libsamplerate
, overloadSupport ? true, zlib
# transports
, remoteSupport ? true, curl ? null
, remoteSupport ? true, curl
}:

assert gtk2Support || gtk3Support;
assert gtk2Support -> gtk2 != null;
assert gtk3Support -> gtk3 != null && gsettings-desktop-schemas != null && wrapGAppsHook != null;
assert vorbisSupport -> libvorbis != null;
assert mp123Support -> libmad != null;
assert flacSupport -> flac != null;
assert wavSupport -> libsndfile != null;
assert cdaSupport -> (libcdio != null && libcddb != null);
assert aacSupport -> faad2 != null;
assert opusSupport -> opusfile != null;
assert zipSupport -> libzip != null;
assert ffmpegSupport -> ffmpeg != null;
assert apeSupport -> yasm != null;
assert artworkSupport -> imlib2 != null;
assert hotkeysSupport -> libX11 != null;
assert osdSupport -> dbus != null;
assert alsaSupport -> alsa-lib != null;
assert pulseSupport -> libpulseaudio != null;
assert resamplerSupport -> libsamplerate != null;
assert overloadSupport -> zlib != null;
assert wavpackSupport -> wavpack != null;
assert remoteSupport -> curl != null;

stdenv.mkDerivation rec {
pname = "deadbeef";
Expand Down
34 changes: 11 additions & 23 deletions pkgs/applications/graphics/image_optim/default.nix
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
{ lib, bundlerApp, bundlerUpdateScript, makeWrapper,
withPngcrush ? true, pngcrush ? null,
withPngout ? true, pngout ? null,
withAdvpng ? true, advancecomp ? null,
withOptipng ? true, optipng ? null,
withPngquant ? true, pngquant ? null,
withJhead ? true, jhead ? null,
withJpegoptim ? true, jpegoptim ? null,
withJpegrecompress ? true, jpeg-archive ? null,
withJpegtran ? true, libjpeg ? null,
withGifsicle ? true, gifsicle ? null,
withSvgo ? true, svgo ? null
withPngcrush ? true, pngcrush,
withPngout ? true, pngout,
withAdvpng ? true, advancecomp,
withOptipng ? true, optipng,
withPngquant ? true, pngquant,
withJhead ? true, jhead,
withJpegoptim ? true, jpegoptim,
withJpegrecompress ? true, jpeg-archive,
withJpegtran ? true, libjpeg,
withGifsicle ? true, gifsicle,
withSvgo ? true, svgo
}:

assert withPngcrush -> pngcrush != null;
assert withPngout -> pngout != null;
assert withAdvpng -> advancecomp != null;
assert withOptipng -> optipng != null;
assert withPngquant -> pngquant != null;
assert withJhead -> jhead != null;
assert withJpegoptim -> jpegoptim != null;
assert withJpegrecompress -> jpeg-archive != null;
assert withJpegtran -> libjpeg != null;
assert withGifsicle -> gifsicle != null;
assert withSvgo -> svgo != null;

with lib;

let
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,14 @@
, pkg-config
, readline
, sqlite
, autoAwaySupport ? true, libXScrnSaver ? null, libX11
, autoAwaySupport ? true, libXScrnSaver, libX11
, notifySupport ? true, libnotify, gdk-pixbuf
, omemoSupport ? true, libsignal-protocol-c, libgcrypt
, pgpSupport ? true, gpgme
, pythonPluginSupport ? true, python
, traySupport ? true, gtk
, pythonPluginSupport ? true, python3
, traySupport ? true, gtk3
}:

assert autoAwaySupport -> libXScrnSaver != null && libX11 != null;
assert notifySupport -> libnotify != null && gdk-pixbuf != null;
assert traySupport -> gtk != null;
assert pgpSupport -> gpgme != null;
assert pythonPluginSupport -> python != null;
assert omemoSupport -> libsignal-protocol-c != null && libgcrypt != null;

stdenv.mkDerivation rec {
pname = "profanity";
version = "0.12.0";
Expand Down Expand Up @@ -75,8 +68,8 @@ stdenv.mkDerivation rec {
++ lib.optionals notifySupport [ libnotify gdk-pixbuf ]
++ lib.optionals omemoSupport [ libsignal-protocol-c libgcrypt ]
++ lib.optionals pgpSupport [ gpgme ]
++ lib.optionals pythonPluginSupport [ python ]
++ lib.optionals traySupport [ gtk ];
++ lib.optionals pythonPluginSupport [ python3 ]
++ lib.optionals traySupport [ gtk3 ];

# Enable feature flags, so that build fail if libs are missing
configureFlags = [
Expand Down
40 changes: 13 additions & 27 deletions pkgs/applications/science/chemistry/gwyddion/default.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
{ lib, stdenv, fetchurl, gtk2, pkg-config, fftw, file,
pythonSupport ? false, pythonPackages ? null,
gnome2 ? null,
openexrSupport ? true, openexr ? null,
libzipSupport ? true, libzip ? null,
libxml2Support ? true, libxml2 ? null,
libwebpSupport ? true, libwebp ? null,
pythonSupport ? false, python2Packages,
gnome2,
openexrSupport ? true, openexr,
libzipSupport ? true, libzip,
libxml2Support ? true, libxml2,
libwebpSupport ? true, libwebp,
# libXmu is not used if libunique is.
libXmuSupport ? false, xorg ? null,
libxsltSupport ? true, libxslt ? null,
fitsSupport ? true, cfitsio ? null,
zlibSupport ? true, zlib ? null,
libuniqueSupport ? true, libunique ? null,
libpngSupport ? true, libpng ? null,
libXmuSupport ? false, xorg,
libxsltSupport ? true, libxslt,
fitsSupport ? true, cfitsio,
zlibSupport ? true, zlib,
libuniqueSupport ? true, libunique,
libpngSupport ? true, libpng,
openglSupport ? !stdenv.isDarwin
}:

assert openexrSupport -> openexr != null;
assert libzipSupport -> libzip != null;
assert libxml2Support -> libxml2 != null;
assert libwebpSupport -> libwebp != null;
assert libXmuSupport -> xorg != null;
assert libxsltSupport -> libxslt != null;
assert fitsSupport -> cfitsio != null;
assert zlibSupport -> zlib != null;
assert libuniqueSupport -> libunique != null;
assert libpngSupport -> libpng != null;
assert openglSupport -> gnome2 != null;
assert pythonSupport -> (pythonPackages != null && gnome2 != null);

let
inherit (pythonPackages) pygtk pygobject2 python;

inherit (python2Packages) pygtk pygobject2 python;
in

stdenv.mkDerivation rec {
Expand Down
79 changes: 28 additions & 51 deletions pkgs/applications/video/mplayer/default.nix
Original file line number Diff line number Diff line change
@@ -1,60 +1,37 @@
{ config, lib, stdenv, fetchurl, fetchsvn, pkg-config, freetype, yasm, ffmpeg
, aalibSupport ? true, aalib ? null
, fontconfigSupport ? true, fontconfig ? null, freefont_ttf ? null
, fribidiSupport ? true, fribidi ? null
, x11Support ? true, libX11 ? null, libXext ? null, libGLU, libGL ? null
, xineramaSupport ? true, libXinerama ? null
, xvSupport ? true, libXv ? null
, alsaSupport ? stdenv.isLinux, alsa-lib ? null
, screenSaverSupport ? true, libXScrnSaver ? null
, vdpauSupport ? false, libvdpau ? null
, cddaSupport ? !stdenv.isDarwin, cdparanoia ? null
, dvdnavSupport ? !stdenv.isDarwin, libdvdnav ? null
, dvdreadSupport ? true, libdvdread ? null
, bluraySupport ? true, libbluray ? null
, amrSupport ? false, amrnb ? null, amrwb ? null
, cacaSupport ? true, libcaca ? null
, lameSupport ? true, lame ? null
, speexSupport ? true, speex ? null
, theoraSupport ? true, libtheora ? null
, x264Support ? false, x264 ? null
, jackaudioSupport ? false, libjack2 ? null
, pulseSupport ? config.pulseaudio or false, libpulseaudio ? null
, bs2bSupport ? false, libbs2b ? null
, v4lSupport ? false, libv4l ? null
, aalibSupport ? true, aalib
, fontconfigSupport ? true, fontconfig, freefont_ttf
, fribidiSupport ? true, fribidi
, x11Support ? true, libX11, libXext, libGLU, libGL
, xineramaSupport ? true, libXinerama
, xvSupport ? true, libXv
, alsaSupport ? stdenv.isLinux, alsa-lib
, screenSaverSupport ? true, libXScrnSaver
, vdpauSupport ? false, libvdpau
, cddaSupport ? !stdenv.isDarwin, cdparanoia
, dvdnavSupport ? !stdenv.isDarwin, libdvdnav
, dvdreadSupport ? true, libdvdread
, bluraySupport ? true, libbluray
, amrSupport ? false, amrnb, amrwb
, cacaSupport ? true, libcaca
, lameSupport ? true, lame
, speexSupport ? true, speex
, theoraSupport ? true, libtheora
, x264Support ? false, x264
, jackaudioSupport ? false, libjack2
, pulseSupport ? config.pulseaudio or false, libpulseaudio
, bs2bSupport ? false, libbs2b
, v4lSupport ? false, libv4l
# For screenshots
, libpngSupport ? true, libpng ? null
, libjpegSupport ? true, libjpeg ? null
, libpngSupport ? true, libpng
, libjpegSupport ? true, libjpeg
, useUnfreeCodecs ? false
, darwin ? null
, darwin
, buildPackages
}:

assert fontconfigSupport -> (fontconfig != null);
assert (!fontconfigSupport) -> (freefont_ttf != null);
assert fribidiSupport -> (fribidi != null);
assert x11Support -> (libX11 != null && libXext != null && libGLU != null && libGL != null);
assert xineramaSupport -> (libXinerama != null && x11Support);
assert xvSupport -> (libXv != null && x11Support);
assert alsaSupport -> alsa-lib != null;
assert screenSaverSupport -> libXScrnSaver != null;
assert vdpauSupport -> libvdpau != null;
assert cddaSupport -> cdparanoia != null;
assert dvdnavSupport -> libdvdnav != null;
assert dvdreadSupport -> libdvdread != null;
assert bluraySupport -> libbluray != null;
assert amrSupport -> (amrnb != null && amrwb != null);
assert cacaSupport -> libcaca != null;
assert lameSupport -> lame != null;
assert speexSupport -> speex != null;
assert theoraSupport -> libtheora != null;
assert x264Support -> x264 != null;
assert jackaudioSupport -> libjack2 != null;
assert pulseSupport -> libpulseaudio != null;
assert bs2bSupport -> libbs2b != null;
assert libpngSupport -> libpng != null;
assert libjpegSupport -> libjpeg != null;
assert v4lSupport -> libv4l != null;
assert xineramaSupport -> x11Support;
assert xvSupport -> x11Support;

let

Expand Down
19 changes: 7 additions & 12 deletions pkgs/development/libraries/aravis/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, gtk-doc, intltool
, audit, glib, libusb1, libxml2
, wrapGAppsHook
, gstreamer ? null
, gst-plugins-base ? null
, gst-plugins-good ? null
, gst-plugins-bad ? null
, libnotify ? null
, gnome ? null
, gtk3 ? null
, gstreamer
, gst-plugins-base
, gst-plugins-good
, gst-plugins-bad
, libnotify
, gnome
, gtk3
, enableUsb ? true
, enablePacketSocket ? true
, enableViewer ? true
Expand All @@ -23,11 +23,7 @@ let
(pkg: pkg != null && lib.versionAtLeast (lib.getVersion pkg) "1.0")
[ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ];
in
assert enableGstPlugin -> lib.all (pkg: pkg != null) [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ];
assert enableViewer -> enableGstPlugin;
assert enableViewer -> libnotify != null;
assert enableViewer -> gnome != null;
assert enableViewer -> gtk3 != null;
assert enableViewer -> gstreamerAtLeastVersion1;

stdenv.mkDerivation rec {
Expand Down Expand Up @@ -87,4 +83,3 @@ in
platforms = lib.platforms.unix;
};
}

10 changes: 3 additions & 7 deletions pkgs/development/libraries/gloox/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{ lib, stdenv, fetchurl
, zlibSupport ? true, zlib ? null
, sslSupport ? true, openssl ? null
, idnSupport ? true, libidn ? null
, zlibSupport ? true, zlib
, sslSupport ? true, openssl
, idnSupport ? true, libidn
}:

assert zlibSupport -> zlib != null;
assert sslSupport -> openssl != null;
assert idnSupport -> libidn != null;

with lib;

stdenv.mkDerivation rec{
Expand Down
13 changes: 4 additions & 9 deletions pkgs/development/libraries/lame/default.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
{ lib, stdenv, fetchurl
, nasmSupport ? true, nasm ? null # Assembly optimizations
, nasmSupport ? true, nasm # Assembly optimizations
, cpmlSupport ? true # Compaq's fast math library
#, efenceSupport ? false, libefence ? null # Use ElectricFence for malloc debugging
, sndfileFileIOSupport ? false, libsndfile ? null # Use libsndfile, instead of lame's internal routines
#, efenceSupport ? false, libefence # Use ElectricFence for malloc debugging
, sndfileFileIOSupport ? false, libsndfile # Use libsndfile, instead of lame's internal routines
, analyzerHooksSupport ? true # Use analyzer hooks
, decoderSupport ? true # mpg123 decoder
, frontendSupport ? true # Build the lame executable
#, mp3xSupport ? false, gtk1 ? null # Build GTK frame analyzer
#, mp3xSupport ? false, gtk1 # Build GTK frame analyzer
, mp3rtpSupport ? false # Build mp3rtp
, debugSupport ? false # Debugging (disables optimizations)
}:

assert nasmSupport -> (nasm != null);
#assert efenceSupport -> (libefence != null);
assert sndfileFileIOSupport -> (libsndfile != null);
#assert mp3xSupport -> (analyzerHooksSupport && (gtk1 != null));

let
mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
in
Expand Down
16 changes: 5 additions & 11 deletions pkgs/development/libraries/libbluray/default.nix
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
{ lib, stdenv, fetchurl, pkg-config, fontconfig, autoreconfHook, DiskArbitration
, withJava ? false, jdk ? null, ant ? null
, withAACS ? false, libaacs ? null
, withBDplus ? false, libbdplus ? null
, withMetadata ? true, libxml2 ? null
, withFonts ? true, freetype ? null
, withJava ? false, jdk, ant
, withAACS ? false, libaacs
, withBDplus ? false, libbdplus
, withMetadata ? true, libxml2
, withFonts ? true, freetype
}:

with lib;

assert withJava -> jdk != null && ant != null;
assert withAACS -> libaacs != null;
assert withBDplus -> libbdplus != null;
assert withMetadata -> libxml2 != null;
assert withFonts -> freetype != null;

# Info on how to use:
# https://wiki.archlinux.org/index.php/BluRay

Expand Down
Loading

0 comments on commit 6d007b2

Please sign in to comment.