Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 87 lines 2.2 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 stdenv, 5 bash, 6 bat, 7 fish, 8 getconf, 9 nix-update-script, 10 zsh, 11}: 12stdenv.mkDerivation rec { 13 pname = "bat-extras"; 14 version = "2024.08.24"; 15 16 src = fetchFromGitHub { 17 owner = "eth-p"; 18 repo = "bat-extras"; 19 tag = "v${version}"; 20 hash = "sha256-xkND/w6UNC58dC8WrsifwjqU9ZI4yUUq+ZljkhhUNT8="; 21 fetchSubmodules = true; 22 }; 23 24 # bat needs to be in the PATH during building so EXECUTABLE_BAT picks it up 25 nativeBuildInputs = [ bat ]; 26 27 dontConfigure = true; 28 29 patches = [ ../patches/disable-theme-tests.patch ]; 30 31 postPatch = '' 32 patchShebangs --build test.sh test/shimexec .test-framework/bin/best.sh 33 ''; 34 35 buildPhase = '' 36 runHook preBuild 37 bash ./build.sh --minify=none --no-verify 38 runHook postBuild 39 ''; 40 41 # Run the library tests as they don't have external dependencies 42 doCheck = true; 43 nativeCheckInputs = [ 44 bash 45 fish 46 zsh 47 ] 48 ++ (lib.optionals stdenv.hostPlatform.isDarwin [ getconf ]); 49 checkPhase = '' 50 runHook preCheck 51 # test list repeats suites. Unique them 52 declare -A test_suites 53 while read -r action arg _; do 54 [[ "$action" == "test_suite" && "$arg" == lib_* ]] && 55 test_suites+=(["$arg"]=1) 56 done <<<"$(./test.sh --compiled --list --porcelain)" 57 (( ''${#test_suites[@]} != 0 )) || { 58 echo "Couldn't find any library test suites" 59 exit 1 60 } 61 ./test.sh --compiled $(printf -- "--suite %q\n" "''${!test_suites[@]}") 62 runHook postCheck 63 ''; 64 65 installPhase = '' 66 runHook preInstall 67 cp -a . $out 68 runHook postInstall 69 ''; 70 71 # A few random files have shebangs. Don't patch them, they don't make it into the final output. 72 # The per-script derivations will go ahead and patch the files they actually install. 73 dontPatchShebangs = true; 74 75 passthru.updateScript = nix-update-script { }; 76 77 meta = { 78 description = "Bash scripts that integrate bat with various command line tools"; 79 homepage = "https://github.com/eth-p/bat-extras"; 80 license = with lib.licenses; [ mit ]; 81 maintainers = with lib.maintainers; [ 82 bbigras 83 perchun 84 ]; 85 platforms = lib.platforms.all; 86 }; 87}