perlPackages.NetAsyncWebSocket: 0.13 -> 0.14 (#352432)
[NixPkgs.git] / pkgs / applications / misc / collision / default.nix
blobfb693b1ff66fe45b07dd459cc24a172fa8718433
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,
22 crystal.buildCrystalPackage rec {
23   pname = "Collision";
24   version = "3.9.0";
26   src = fetchFromGitHub {
27     owner = "GeopJr";
28     repo = "Collision";
29     rev = "v${version}";
30     hash = "sha256-c/74LzDM63w5zW8z2T8o4Efvuzj791/zTSKEDN32uak=";
31   };
33   postPatch = ''
34     substituteInPlace Makefile \
35       --replace-fail 'gtk-update-icon-cache $(PREFIX)/share/icons/hicolor' 'true'
36   '';
38   shardsFile = ./shards.nix;
39   copyShardDeps = true;
41   preBuild = ''
42     cd lib/gi-crystal && shards build -Dpreview_mt --release --no-debug
43     cd ../.. && mkdir bin/ && cp lib/gi-crystal/bin/gi-crystal bin/
44   '';
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.
51   nativeBuildInputs = [
52     wrapGAppsHook4
53     pkg-config
54     gobject-introspection
55   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ desktopToDarwinBundle ];
57   buildInputs = [
58     libadwaita
59     openssl
60     libxml2
61     nautilus-python
62     python3.pkgs.pygobject3
63   ];
65   buildTargets = [
66     "bindings"
67     "build"
68   ];
70   doCheck = false;
71   doInstallCheck = false;
73   installTargets = [
74     "desktop"
75     "install"
76   ];
78   postInstall = ''
79     install -Dm555 ./nautilus-extension/collision-extension.py -t $out/share/nautilus-python/extensions
80   '';
82   passthru = {
83     updateScript = _experimental-update-script-combinators.sequence [
84       (gitUpdater { rev-prefix = "v"; })
85       (_experimental-update-script-combinators.copyAttrOutputToFile "collision.shardLock" ./shard.lock)
86       {
87         command = [
88           (writeShellScript "update-lock" "cd $1; ${lib.getExe crystal2nix}")
89           ./.
90         ];
91         supportedFeatures = [ "silent" ];
92       }
93       {
94         command = [
95           "rm"
96           ./shard.lock
97         ];
98         supportedFeatures = [ "silent" ];
99       }
100     ];
101     shardLock = runCommand "shard.lock" { inherit src; } ''
102       cp $src/shard.lock $out
103     '';
104   };
106   meta = with lib; {
107     description = "Check hashes for your files";
108     homepage = "https://github.com/GeopJr/Collision";
109     license = licenses.bsd2;
110     mainProgram = "collision";
111     maintainers = with maintainers; [ sund3RRR ] ++ lib.teams.gnome-circle.members;
112   };