bin.nix (1330B)
1 { lib, stdenv, fetchfromgh, unzip }: 2 let 3 pname = "fx"; 4 version = "18.0.1"; 5 6 inherit (stdenv.hostPlatform) system; 7 throwSystem = throw "Unsupported system: ${system}"; 8 9 suffix = { 10 x86_64-linux = "linux"; 11 x86_64-darwin = "macos"; 12 }.${system} or throwSystem; 13 in 14 stdenv.mkDerivation { 15 inherit pname version; 16 17 src = fetchfromgh { 18 inherit version; 19 owner = "antonmedv"; 20 repo = "fx"; 21 name = "fx-${suffix}.zip"; 22 sha256 = { 23 x86_64-linux = "1q46qidyg6jmk1f74rp2yaqqpg8yzzrw2vmpm2djyiszsqsakfbz"; 24 x86_64-darwin = "1mcclxn6hw1b8z47kdp26kybk03b59llfgamp425nni0mi5vzrm0"; 25 }.${system} or throwSystem; 26 }; 27 28 dontConfigure = true; 29 dontBuild = true; 30 dontStrip = true; 31 32 unpackPhase = "${unzip}/bin/unzip $src"; 33 34 installPhase = "install -Dm755 fx-${suffix} $out/bin/fx"; 35 36 postFixup = lib.optionalString stdenv.isLinux '' 37 patchelf \ 38 --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ 39 --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}" \ 40 $out/bin/fx 41 ''; 42 43 meta = with lib; { 44 description = "Command-line tool and terminal JSON viewer"; 45 homepage = "https://github.com/antonmedv/fx"; 46 license = licenses.mit; 47 maintainers = [ maintainers.sikmir ]; 48 platforms = [ "x86_64-linux" "x86_64-darwin" ]; 49 skip.ci = true; 50 }; 51 }