Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 116 lines 2.7 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 crystal, 6 wrapGAppsHook4, 7 desktopToDarwinBundle, 8 gobject-introspection, 9 nautilus-python, 10 python3, 11 libadwaita, 12 openssl, 13 libxml2, 14 pkg-config, 15 gitUpdater, 16 _experimental-update-script-combinators, 17 runCommand, 18 crystal2nix, 19 writeShellScript, 20}: 21 22crystal.buildCrystalPackage rec { 23 pname = "Collision"; 24 version = "3.10.0"; 25 26 src = fetchFromGitHub { 27 owner = "GeopJr"; 28 repo = "Collision"; 29 rev = "v${version}"; 30 hash = "sha256-ZXGhMicwlkXUw8I6HUNVxY4vCaVixdV76+wYn34Py6Q="; 31 }; 32 33 postPatch = '' 34 substituteInPlace Makefile \ 35 --replace-fail 'gtk-update-icon-cache $(PREFIX)/share/icons/hicolor' 'true' 36 ''; 37 38 shardsFile = ./shards.nix; 39 copyShardDeps = true; 40 41 preBuild = '' 42 cd lib/gi-crystal && shards build -Dpreview_mt --release --no-debug && \ 43 install -Dm755 bin/gi-crystal ../../bin/gi-crystal && cd ../.. 44 ''; 45 46 # Crystal compiler has a strange issue with OpenSSL. The project will not compile due to 47 # main_module:(.text+0x6f0): undefined reference to `SSL_library_init' 48 # There is an explanation for this https://danilafe.com/blog/crystal_nix_revisited/ 49 # Shortly, adding pkg-config to buildInputs along with openssl fixes the issue. 50 nativeBuildInputs = [ 51 wrapGAppsHook4 52 pkg-config 53 gobject-introspection 54 ] 55 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 56 desktopToDarwinBundle 57 ]; 58 59 buildInputs = [ 60 libadwaita 61 openssl 62 libxml2 63 nautilus-python 64 python3.pkgs.pygobject3 65 ]; 66 67 buildTargets = [ 68 "bindings" 69 "build" 70 ]; 71 72 doCheck = false; 73 doInstallCheck = false; 74 75 installTargets = [ 76 "desktop" 77 "install" 78 ]; 79 80 postInstall = '' 81 install -Dm555 ./nautilus-extension/collision-extension.py -t $out/share/nautilus-python/extensions 82 ''; 83 84 passthru = { 85 updateScript = _experimental-update-script-combinators.sequence [ 86 (gitUpdater { rev-prefix = "v"; }) 87 (_experimental-update-script-combinators.copyAttrOutputToFile "collision.shardLock" "./shard.lock") 88 { 89 command = [ 90 (writeShellScript "update-lock" "cd $1; ${lib.getExe crystal2nix}") 91 ./. 92 ]; 93 supportedFeatures = [ "silent" ]; 94 } 95 { 96 command = [ 97 "rm" 98 "./shard.lock" 99 ]; 100 supportedFeatures = [ "silent" ]; 101 } 102 ]; 103 shardLock = runCommand "shard.lock" { inherit src; } '' 104 cp $src/shard.lock $out 105 ''; 106 }; 107 108 meta = with lib; { 109 description = "Check hashes for your files"; 110 homepage = "https://github.com/GeopJr/Collision"; 111 license = licenses.bsd2; 112 mainProgram = "collision"; 113 maintainers = with maintainers; [ sund3RRR ]; 114 teams = [ teams.gnome-circle ]; 115 }; 116}