Unverified Commit 4586388f authored by Rick van Schijndel's avatar Rick van Schijndel Committed by GitHub
Browse files

Merge pull request #170320 from andersk/negated-version

treewide: Simplify negated uses of versionAtLeast, versionOlder
parents b491eacf 6920d8ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1018,7 +1018,7 @@ in
      inherit configIniOfService;
      mainService = mkMerge [ baseService {
        serviceConfig.StateDirectory = [ "sourcehut/gitsrht" "sourcehut/gitsrht/repos" ];
        preStart = mkIf (!versionAtLeast config.system.stateVersion "22.05") (mkBefore ''
        preStart = mkIf (versionOlder config.system.stateVersion "22.05") (mkBefore ''
          # Fix Git hooks of repositories pre-dating https://github.com/NixOS/nixpkgs/pull/133984
          (
          set +f
+14 −14
Original line number Diff line number Diff line
@@ -56,8 +56,8 @@ let
    args.version;
  version = fetched.version;
  coq-version = args.coq-version or (if version != "dev" then versions.majorMinor version else "dev");
  versionAtLeast = v: (coq-version == "dev") || (lib.versionAtLeast coq-version v);
  ideFlags = optionalString (buildIde && !versionAtLeast "8.10")
  coqAtLeast = v: coq-version == "dev" || versionAtLeast coq-version v;
  ideFlags = optionalString (buildIde && !coqAtLeast "8.10")
    "-lablgtkdir ${ocamlPackages.lablgtk}/lib/ocaml/*/site-lib/lablgtk2 -coqide opt";
  csdpPatch = if csdp != null then ''
    substituteInPlace plugins/micromega/sos.ml --replace "; csdp" "; ${csdp}/bin/csdp"
@@ -71,11 +71,11 @@ let
      { case = range "8.5" "8.6";   out = ocamlPackages_4_05; }
    ] ocamlPackages_4_12;
  ocamlNativeBuildInputs = [ ocamlPackages.ocaml ocamlPackages.findlib ]
    ++ optional (versionAtLeast "8.14") ocamlPackages.dune_2;
    ++ optional (coqAtLeast "8.14") ocamlPackages.dune_2;
  ocamlBuildInputs = []
    ++ optional (!versionAtLeast "8.10") ocamlPackages.camlp5
    ++ optional (!versionAtLeast "8.13") ocamlPackages.num
    ++ optional (versionAtLeast "8.13") ocamlPackages.zarith;
    ++ optional (!coqAtLeast "8.10") ocamlPackages.camlp5
    ++ optional (!coqAtLeast "8.13") ocamlPackages.num
    ++ optional (coqAtLeast "8.13") ocamlPackages.zarith;
self = stdenv.mkDerivation {
  pname = "coq";
  inherit (fetched) version src;
@@ -134,11 +134,11 @@ self = stdenv.mkDerivation {
  nativeBuildInputs = [ pkg-config ]
    ++ ocamlNativeBuildInputs
    ++ optional buildIde copyDesktopItems
    ++ optional (buildIde && versionAtLeast "8.10") wrapGAppsHook
    ++ optional (!versionAtLeast "8.6") gnumake42;
    ++ optional (buildIde && coqAtLeast "8.10") wrapGAppsHook
    ++ optional (!coqAtLeast "8.6") gnumake42;
  buildInputs = [ ncurses ] ++ ocamlBuildInputs
    ++ optionals buildIde
      (if versionAtLeast "8.10"
      (if coqAtLeast "8.10"
       then [ ocamlPackages.lablgtk3-sourceview3 glib gnome.adwaita-icon-theme ]
       else [ ocamlPackages.lablgtk ])
  ;
@@ -147,7 +147,7 @@ self = stdenv.mkDerivation {
    UNAME=$(type -tp uname)
    RM=$(type -tp rm)
    substituteInPlace tools/beautify-archive --replace "/bin/rm" "$RM"
    ${if !versionAtLeast "8.7" then "substituteInPlace configure.ml --replace \"md5 -q\" \"md5sum\"" else ""}
    ${if !coqAtLeast "8.7" then "substituteInPlace configure.ml --replace \"md5 -q\" \"md5sum\"" else ""}
    ${csdpPatch}
  '';

@@ -161,7 +161,7 @@ self = stdenv.mkDerivation {
    addEnvHooks "$targetOffset" addCoqPath
  '';

  preConfigure = if versionAtLeast "8.10" then ''
  preConfigure = if coqAtLeast "8.10" then ''
    patchShebangs dev/tools/
  '' else ''
    configureFlagsArray=(
@@ -171,7 +171,7 @@ self = stdenv.mkDerivation {

  prefixKey = "-prefix ";

  buildFlags = [ "revision" "coq" ] ++ optional buildIde "coqide" ++ optional (!versionAtLeast "8.14") "bin/votour";
  buildFlags = [ "revision" "coq" ] ++ optional buildIde "coqide" ++ optional (!coqAtLeast "8.14") "bin/votour";
  enableParallelBuilding = true;

  createFindlibDestdir = true;
@@ -185,10 +185,10 @@ self = stdenv.mkDerivation {
    categories = [ "Development" "Science" "Math" "IDE" "GTK" ];
  });

  postInstall = let suffix = if versionAtLeast "8.14" then "-core" else ""; in ''
  postInstall = let suffix = if coqAtLeast "8.14" then "-core" else ""; in ''
    cp bin/votour $out/bin/
    ln -s $out/lib/coq${suffix} $OCAMLFIND_DESTDIR/coq${suffix}
  '' + optionalString (versionAtLeast "8.14") ''
  '' + optionalString (coqAtLeast "8.14") ''
    ln -s $out/lib/coqide-server $OCAMLFIND_DESTDIR/coqide-server
  '' + optionalString buildIde ''
    mkdir -p "$out/share/pixmaps"
+2 −2
Original line number Diff line number Diff line
@@ -7,8 +7,8 @@ let Dune =
  { "1" = dune_1; "2" = dune_2; "3" = dune_3; }."${dune-version}"
; in

if (args ? minimumOCamlVersion && ! lib.versionAtLeast ocaml.version args.minimumOCamlVersion) ||
   (args ? minimalOCamlVersion && ! lib.versionAtLeast ocaml.version args.minimalOCamlVersion)
if (args ? minimumOCamlVersion && lib.versionOlder ocaml.version args.minimumOCamlVersion) ||
   (args ? minimalOCamlVersion && lib.versionOlder ocaml.version args.minimalOCamlVersion)
then throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
else

+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
}@args:

if args ? minimumOCamlVersion &&
   ! lib.versionAtLeast ocaml.version args.minimumOCamlVersion
   lib.versionOlder ocaml.version args.minimumOCamlVersion
then throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
else

+5 −5
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ let
in

{ lib, stdenv, fetchurl, ncurses, buildEnv, libunwind, fetchpatch
, libX11, xorgproto, useX11 ? safeX11 stdenv && !lib.versionAtLeast version "4.09"
, libX11, xorgproto, useX11 ? safeX11 stdenv && lib.versionOlder version "4.09"
, aflSupport ? false
, flambdaSupport ? false
, spaceTimeSupport ? false
@@ -87,14 +87,14 @@ stdenv.mkDerivation (args // {
  buildFlags = if useNativeCompilers
    then ["nixpkgs_world_bootstrap_world_opt"]
    else ["nixpkgs_world"];
  buildInputs = optional (!lib.versionAtLeast version "4.07") ncurses
  buildInputs = optional (lib.versionOlder version "4.07") ncurses
    ++ optionals useX11 [ libX11 xorgproto ];
  propagatedBuildInputs = optional spaceTimeSupport libunwind;
  installTargets = [ "install" ] ++ optional useNativeCompilers "installopt";
  preConfigure = optionalString (!lib.versionAtLeast version "4.04") ''
  preConfigure = optionalString (lib.versionOlder version "4.04") ''
    CAT=$(type -tp cat)
    sed -e "s@/bin/cat@$CAT@" -i config/auto-aux/sharpbang
  '' + optionalString (stdenv.isDarwin && !lib.versionAtLeast version "4.13") ''
  '' + optionalString (stdenv.isDarwin && lib.versionOlder version "4.13") ''
    # Do what upstream does by default now: https://github.com/ocaml/ocaml/pull/10176
    # This is required for aarch64-darwin, everything else works as is.
    AS="${stdenv.cc}/bin/cc -c" ASPP="${stdenv.cc}/bin/cc -c"
@@ -137,7 +137,7 @@ stdenv.mkDerivation (args // {
    '';

    platforms = with platforms; linux ++ darwin;
    broken = stdenv.isAarch64 && !lib.versionAtLeast version "4.06";
    broken = stdenv.isAarch64 && lib.versionOlder version "4.06";
  };

})
Loading