From 26775c365901eb099baa798ea0a1e38b6d9d51c9 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Thu, 20 Apr 2023 10:55:57 +0200 Subject: [PATCH 1/3] ocamlformat: 0.24.1 -> 0.25.1 The ocamlformat package have been split into two in version 0.25.1: one for the library and one for the executable. This adds both packages at the same time. They have the same sources and very similar dependencies, for which the definition is shared. --- .../ocaml-modules/ocamlformat/generic.nix | 63 +++++++++++++++++++ .../ocamlformat/ocamlformat-lib.nix | 26 ++++++++ .../ocamlformat-rpc-lib.nix} | 0 .../tools/ocaml/ocamlformat/default.nix | 1 + .../tools/ocaml/ocamlformat/generic.nix | 61 ++++-------------- pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/ocaml-packages.nix | 4 +- 7 files changed, 107 insertions(+), 50 deletions(-) create mode 100644 pkgs/development/ocaml-modules/ocamlformat/generic.nix create mode 100644 pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix rename pkgs/development/ocaml-modules/{ocamlformat-rpc-lib/default.nix => ocamlformat/ocamlformat-rpc-lib.nix} (100%) diff --git a/pkgs/development/ocaml-modules/ocamlformat/generic.nix b/pkgs/development/ocaml-modules/ocamlformat/generic.nix new file mode 100644 index 000000000000..9f9f7cff1301 --- /dev/null +++ b/pkgs/development/ocaml-modules/ocamlformat/generic.nix @@ -0,0 +1,63 @@ +{ lib, fetchurl, ocaml-ng, version }: + +# The ocamlformat package have been split into two in version 0.25.1: +# one for the library and one for the executable. +# Both have the same sources and very similar dependencies. + +with ocaml-ng.ocamlPackages; + +rec { + tarballName = "ocamlformat-${version}.tbz"; + + src = fetchurl { + url = + "https://github.com/ocaml-ppx/ocamlformat/releases/download/${version}/${tarballName}"; + sha256 = { + "0.19.0" = "0ihgwl7d489g938m1jvgx8azdgq9f5np5mzqwwya797hx2m4dz32"; + "0.20.0" = "sha256-JtmNCgwjbCyUE4bWqdH5Nc2YSit+rekwS43DcviIfgk="; + "0.20.1" = "sha256-fTpRZFQW+ngoc0T6A69reEUAZ6GmHkeQvxspd5zRAjU="; + "0.21.0" = "sha256-KhgX9rxYH/DM6fCqloe4l7AnJuKrdXSe6Y1XY3BXMy0="; + "0.22.4" = "sha256-61TeK4GsfMLmjYGn3ICzkagbc3/Po++Wnqkb2tbJwGA="; + "0.23.0" = "sha256-m9Pjz7DaGy917M1GjyfqG5Lm5ne7YSlJF2SVcDHe3+0="; + "0.24.0" = "sha256-Zil0wceeXmq2xy0OVLxa/Ujl4Dtsmc4COyv6Jo7rVaM="; + "0.24.1" = "sha256-AjQl6YGPgOpQU3sjcaSnZsFJqZV9BYB+iKAE0tX0Qc4="; + "0.25.1" = "sha256-3I8qMwyjkws2yssmI7s2Dti99uSorNKT29niJBpv0z0="; + }."${version}"; + }; + + odoc-parser_v = odoc-parser.override { + version = if lib.versionAtLeast version "0.24.0" then + "2.0.0" + else if lib.versionAtLeast version "0.20.1" then + "1.0.1" + else + "0.9.0"; + }; + + cmdliner_v = + if lib.versionAtLeast version "0.21.0" then cmdliner_1_1 else cmdliner_1_0; + + library_deps = [ + base + cmdliner_v + dune-build-info + fix + fpath + menhirLib + menhirSdk + ocp-indent + stdio + uuseg + uutf + ] ++ lib.optionals (lib.versionAtLeast version "0.20.0") [ + either + ocaml-version + ] ++ lib.optionals (lib.versionAtLeast version "0.22.4") [ csexp ] + ++ (if lib.versionOlder version "0.25.1" then + [ odoc-parser_v ] + else [ + camlp-streams + result + astring + ]); +} diff --git a/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix new file mode 100644 index 000000000000..af8b574d5d6f --- /dev/null +++ b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix @@ -0,0 +1,26 @@ +{ lib, callPackage, ocaml-ng, version ? "0.25.1" }: + +with ocaml-ng.ocamlPackages; + +let inherit (callPackage ./generic.nix { inherit version; }) src library_deps; + +in assert (lib.versionAtLeast version "0.25.1"); + +buildDunePackage { + pname = "ocamlformat-lib"; + inherit src version; + + minimalOCamlVersion = "4.08"; + duneVersion = "3"; + + nativeBuildInputs = [ menhir ]; + + propagatedBuildInputs = library_deps; + + meta = { + homepage = "https://github.com/ocaml-ppx/ocamlformat"; + description = "Auto-formatter for OCaml code (library)"; + maintainers = [ lib.maintainers.Zimmi48 lib.maintainers.marsam ]; + license = lib.licenses.mit; + }; +} diff --git a/pkgs/development/ocaml-modules/ocamlformat-rpc-lib/default.nix b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix similarity index 100% rename from pkgs/development/ocaml-modules/ocamlformat-rpc-lib/default.nix rename to pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix diff --git a/pkgs/development/tools/ocaml/ocamlformat/default.nix b/pkgs/development/tools/ocaml/ocamlformat/default.nix index f90eaca5273c..f0f38777f1c2 100644 --- a/pkgs/development/tools/ocaml/ocamlformat/default.nix +++ b/pkgs/development/tools/ocaml/ocamlformat/default.nix @@ -12,6 +12,7 @@ rec { ocamlformat_0_22_4 = ocamlformat.override { version = "0.22.4"; }; ocamlformat_0_23_0 = ocamlformat.override { version = "0.23.0"; }; ocamlformat_0_24_1 = ocamlformat.override { version = "0.24.1"; }; + ocamlformat_0_25_1 = ocamlformat.override { version = "0.25.1"; }; ocamlformat = callPackage ./generic.nix {}; } diff --git a/pkgs/development/tools/ocaml/ocamlformat/generic.nix b/pkgs/development/tools/ocaml/ocamlformat/generic.nix index 4ed53aad3789..0d38d2e0ac02 100644 --- a/pkgs/development/tools/ocaml/ocamlformat/generic.nix +++ b/pkgs/development/tools/ocaml/ocamlformat/generic.nix @@ -1,61 +1,26 @@ -{ lib, fetchurl, fetchzip, ocaml-ng -, version ? "0.24.1" -, tarballName ? "ocamlformat-${version}.tbz", -}: +{ lib, callPackage, ocaml-ng, version ? "0.25.1" }: -let src = - fetchurl { - url = "https://github.com/ocaml-ppx/ocamlformat/releases/download/${version}/${tarballName}"; - sha256 = { - "0.19.0" = "0ihgwl7d489g938m1jvgx8azdgq9f5np5mzqwwya797hx2m4dz32"; - "0.20.0" = "sha256-JtmNCgwjbCyUE4bWqdH5Nc2YSit+rekwS43DcviIfgk="; - "0.20.1" = "sha256-fTpRZFQW+ngoc0T6A69reEUAZ6GmHkeQvxspd5zRAjU="; - "0.21.0" = "sha256-KhgX9rxYH/DM6fCqloe4l7AnJuKrdXSe6Y1XY3BXMy0="; - "0.22.4" = "sha256-61TeK4GsfMLmjYGn3ICzkagbc3/Po++Wnqkb2tbJwGA="; - "0.23.0" = "sha256-m9Pjz7DaGy917M1GjyfqG5Lm5ne7YSlJF2SVcDHe3+0="; - "0.24.0" = "sha256-Zil0wceeXmq2xy0OVLxa/Ujl4Dtsmc4COyv6Jo7rVaM="; - "0.24.1" = "sha256-AjQl6YGPgOpQU3sjcaSnZsFJqZV9BYB+iKAE0tX0Qc4="; - }."${version}"; - }; - ocamlPackages = ocaml-ng.ocamlPackages; -in +with ocaml-ng.ocamlPackages; -with ocamlPackages; +let + inherit (callPackage ../../../ocaml-modules/ocamlformat/generic.nix { + inherit version; + }) + src library_deps; -buildDunePackage { +in buildDunePackage { pname = "ocamlformat"; inherit src version; minimalOCamlVersion = "4.08"; duneVersion = "3"; - nativeBuildInputs = [ - menhir - ]; + nativeBuildInputs = + if lib.versionAtLeast version "0.25.1" then [ ] else [ menhir ]; - buildInputs = [ - base - dune-build-info - fix - fpath - menhirLib - menhirSdk - ocp-indent - re - stdio - uuseg - uutf - ] - ++ lib.optionals (lib.versionAtLeast version "0.20.0") [ ocaml-version either ] - ++ (if lib.versionAtLeast version "0.24.0" - then [ (odoc-parser.override { version = "2.0.0"; }) ] - else if lib.versionAtLeast version "0.20.1" - then [ (odoc-parser.override { version = "1.0.1"; }) ] - else [ (odoc-parser.override { version = "0.9.0"; }) ]) - ++ (if lib.versionAtLeast version "0.21.0" - then [ cmdliner_1_1 ] - else [ cmdliner_1_0 ]) - ++ lib.optionals (lib.versionAtLeast version "0.22.4") [ csexp ]; + buildInputs = [ re ] ++ library_deps + ++ lib.optionals (lib.versionAtLeast version "0.25.1") + [ (ocamlformat-lib.override { inherit version; }) ]; meta = { homepage = "https://github.com/ocaml-ppx/ocamlformat"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ecc9e21686b5..bbc9d4ac44be 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15814,7 +15814,7 @@ with pkgs; inherit (callPackage ../development/tools/ocaml/ocamlformat { }) ocamlformat # latest version ocamlformat_0_19_0 ocamlformat_0_20_0 ocamlformat_0_20_1 ocamlformat_0_21_0 - ocamlformat_0_22_4 ocamlformat_0_23_0 ocamlformat_0_24_1; + ocamlformat_0_22_4 ocamlformat_0_23_0 ocamlformat_0_24_1 ocamlformat_0_25_1; orc = callPackage ../development/compilers/orc { }; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 0185ed26d42f..7b8a2da42b49 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -1163,7 +1163,9 @@ let ocamlc-loc = callPackage ../development/ocaml-modules/ocamlc-loc { }; - ocamlformat-rpc-lib = callPackage ../development/ocaml-modules/ocamlformat-rpc-lib { }; + ocamlformat-lib = callPackage ../development/ocaml-modules/ocamlformat/ocamlformat-lib.nix { }; + + ocamlformat-rpc-lib = callPackage ../development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix { }; ocamlfuse = callPackage ../development/ocaml-modules/ocamlfuse { }; From 5bd77fec8393a791a7bd2db3a0d320b1d7402199 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Thu, 20 Apr 2023 11:33:43 +0200 Subject: [PATCH 2/3] maintainers: add Julow --- maintainers/maintainer-list.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 7e99a5aba827..60c64894f8c3 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -7853,6 +7853,13 @@ githubId = 21160136; name = "Julien Moutinho"; }; + Julow = { + email = "jules@j3s.fr"; + matrix = "@juloo:matrix.org"; + github = "Julow"; + githubId = 2310568; + name = "Jules Aguillon"; + }; jumper149 = { email = "felixspringer149@gmail.com"; github = "jumper149"; From 3833306fc4c166e54062c99796b6bc309a0defef Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Thu, 20 Apr 2023 11:37:52 +0200 Subject: [PATCH 3/3] ocamlformat: add maintainer Julow --- pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix | 2 +- .../ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix | 2 +- pkgs/development/tools/ocaml/ocamlformat/generic.nix | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix index af8b574d5d6f..a95f8d9a410b 100644 --- a/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix +++ b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-lib.nix @@ -20,7 +20,7 @@ buildDunePackage { meta = { homepage = "https://github.com/ocaml-ppx/ocamlformat"; description = "Auto-formatter for OCaml code (library)"; - maintainers = [ lib.maintainers.Zimmi48 lib.maintainers.marsam ]; + maintainers = with lib.maintainers; [ Zimmi48 marsam Julow ]; license = lib.licenses.mit; }; } diff --git a/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix index 81328dc78df6..abd3a33dde8e 100644 --- a/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix +++ b/pkgs/development/ocaml-modules/ocamlformat/ocamlformat-rpc-lib.nix @@ -30,6 +30,6 @@ buildDunePackage rec { homepage = "https://github.com/ocaml-ppx/ocamlformat"; description = "Auto-formatter for OCaml code (RPC mode)"; license = licenses.mit; - maintainers = with maintainers; [ Zimmi48 marsam ]; + maintainers = with maintainers; [ Zimmi48 marsam Julow ]; }; } diff --git a/pkgs/development/tools/ocaml/ocamlformat/generic.nix b/pkgs/development/tools/ocaml/ocamlformat/generic.nix index 0d38d2e0ac02..d63d0d9894b0 100644 --- a/pkgs/development/tools/ocaml/ocamlformat/generic.nix +++ b/pkgs/development/tools/ocaml/ocamlformat/generic.nix @@ -25,7 +25,7 @@ in buildDunePackage { meta = { homepage = "https://github.com/ocaml-ppx/ocamlformat"; description = "Auto-formatter for OCaml code"; - maintainers = [ lib.maintainers.Zimmi48 lib.maintainers.marsam ]; + maintainers = with lib.maintainers; [ Zimmi48 marsam Julow ]; license = lib.licenses.mit; }; }