From e026413db95aa3c26c5886f3ec72fa2592426a82 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Wed, 11 Sep 2024 10:58:20 +0200 Subject: [PATCH] flitter: unstable-2020-10-05 -> 1.0.0 --- pkgs/tools/misc/flitter/default.nix | 48 ++++++++------------------- pkgs/tools/misc/flitter/flitter.patch | 46 ------------------------- 2 files changed, 13 insertions(+), 81 deletions(-) delete mode 100644 pkgs/tools/misc/flitter/flitter.patch diff --git a/pkgs/tools/misc/flitter/default.nix b/pkgs/tools/misc/flitter/default.nix index 6b092b35be8c..9ef8b525584f 100644 --- a/pkgs/tools/misc/flitter/default.nix +++ b/pkgs/tools/misc/flitter/default.nix @@ -1,55 +1,32 @@ { lib -, ocamlPackages +, stdenv +, rustPlatform , fetchFromGitHub -, makeWrapper -, python3 +, pkg-config +, xorg }: -ocamlPackages.buildDunePackage { +rustPlatform.buildRustPackage rec { pname = "flitter"; - # request to tag releases: https://github.com/alexozer/flitter/issues/34 - version = "unstable-2020-10-05"; - - duneVersion = "3"; + version = "1.0.0"; src = fetchFromGitHub { owner = "alexozer"; repo = "flitter"; - rev = "666c5483bc93efa6d01e0b7a927461269f8e14de"; - sha256 = "1k3m7bjq5yrrq7vhnbdykni65dsqhq6knnv9wvwq3svb3n07z4w3"; + rev = "v${version}"; + sha256 = "sha256-XyHUUuENnGmIUlfYl7+NuSP115+sZfjXtd4bEIZQpf8="; }; - # compatibility with core >= 0.15 - patches = [ ./flitter.patch ]; - - # https://github.com/alexozer/flitter/issues/28 - postPatch = '' - for f in src/*.ml; do - substituteInPlace "$f" \ - --replace 'Unix.gettimeofday' 'Caml_unix.gettimeofday' \ - --replace 'Core_kernel' 'Core' \ - --replace 'sexp_option' 'option[@sexp.option]' \ - --replace 'sexp_list' 'list[@sexp.list]' - done - ''; + cargoHash = "sha256-ydYBHC/LxdYGA1+eYLTSZdkOhAgkw99J9JVT5micgdg="; nativeBuildInputs = [ - makeWrapper + pkg-config ]; - buildInputs = with ocamlPackages; [ - core_unix - lwt_ppx - sexp_pretty - color - notty + buildInputs = [ + xorg.libX11 ]; - postInstall = '' - wrapProgram $out/bin/flitter \ - --prefix PATH : "${python3.withPackages (pp: [ pp.pynput ])}/bin" - ''; - meta = with lib; { description = "Livesplit-inspired speedrunning split timer for Linux/macOS terminal"; license = licenses.mit; @@ -57,5 +34,6 @@ ocamlPackages.buildDunePackage { homepage = "https://github.com/alexozer/flitter"; platforms = platforms.unix; mainProgram = "flitter"; + broken = stdenv.isDarwin; }; } diff --git a/pkgs/tools/misc/flitter/flitter.patch b/pkgs/tools/misc/flitter/flitter.patch deleted file mode 100644 index 04cd40dc74e5..000000000000 --- a/pkgs/tools/misc/flitter/flitter.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/src/big.ml b/src/big.ml -index 7cd327f..f84bc10 100644 ---- a/src/big.ml -+++ b/src/big.ml -@@ -11,7 +11,7 @@ let big_font_map = - ] in - - let uchar_of_char = -- let open Caml.Uchar in -+ let open Stdlib.Uchar in - function - | '[' -> of_int 0x258C - | ']' -> of_int 0x2590 -@@ -48,4 +48,4 @@ let image_of_string attr str = - List.map (String.to_list str) ~f:(fun ch -> - List.map (Map.find_exn big_font_map ch) ~f:(I.uchars attr) - |> I.vcat -- ) |> I.hcat -\ No newline at end of file -+ ) |> I.hcat -diff --git a/src/display.ml b/src/display.ml -index bd6f7e4..44d7f6d 100644 ---- a/src/display.ml -+++ b/src/display.ml -@@ -41,7 +41,7 @@ let splits_header timer width = - let joined = I.hcat cell_padded in - let padded = left_pad width joined in - -- let br = I.uchar Colors.label (Caml.Uchar.of_int 0x2500) width 1 in -+ let br = I.uchar Colors.label (Stdlib.Uchar.of_int 0x2500) width 1 in - I.(padded <-> br) - - type time_status = Ahead_gain | Ahead_loss | Behind_gain | Behind_loss | Gold -diff --git a/src/dune b/src/dune -index a50b09a..2b00ee2 100644 ---- a/src/dune -+++ b/src/dune -@@ -1,7 +1,7 @@ - (library - (name flitter) - (wrapped false) -- (libraries core lwt.unix notty notty.unix re color sexp_pretty) -+ (libraries core core_kernel.caml_unix lwt.unix notty notty.unix re color sexp_pretty) - (preprocess (pps lwt_ppx ppx_sexp_conv)) - ) -