about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/collision/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/collision/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/misc/collision/default.nix53
1 files changed, 47 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/applications/misc/collision/default.nix b/nixpkgs/pkgs/applications/misc/collision/default.nix
index f550e48ba954..8fd8ad8f33ba 100644
--- a/nixpkgs/pkgs/applications/misc/collision/default.nix
+++ b/nixpkgs/pkgs/applications/misc/collision/default.nix
@@ -4,34 +4,59 @@
 , crystal
 , wrapGAppsHook4
 , desktopToDarwinBundle
-, gi-crystal
 , gobject-introspection
+, gnome
+, python3
 , libadwaita
 , openssl
 , libxml2
 , pkg-config
+, gitUpdater
+, _experimental-update-script-combinators
+, runCommand
+, crystal2nix
+, writeShellScript
 }:
+
 crystal.buildCrystalPackage rec {
   pname = "Collision";
-  version = "3.6.0";
+  version = "3.8.0";
 
   src = fetchFromGitHub {
     owner = "GeopJr";
     repo = "Collision";
     rev = "v${version}";
-    hash = "sha256-Qxe4ILDdfYfxu95EvKRTvkAOgDIZDiLymBlZouBWn0M=";
+    hash = "sha256-Bo/u0UYM/N7tLqdCs2OU5pdj2s9LXPooSR1PCGk9dSc=";
   };
-  patches = [ ./make.patch ];
+
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace-fail 'gtk-update-icon-cache $(PREFIX)/share/icons/hicolor' 'true'
+  '';
+
   shardsFile = ./shards.nix;
+  copyShardDeps = true;
+
+  preBuild = ''
+    cd lib/gi-crystal && shards build -Dpreview_mt --release --no-debug
+    cd ../.. && mkdir bin/ && cp lib/gi-crystal/bin/gi-crystal bin/
+  '';
 
   # Crystal compiler has a strange issue with OpenSSL. The project will not compile due to
   # main_module:(.text+0x6f0): undefined reference to `SSL_library_init'
   # There is an explanation for this https://danilafe.com/blog/crystal_nix_revisited/
   # Shortly, adding pkg-config to buildInputs along with openssl fixes the issue.
 
-  nativeBuildInputs = [ wrapGAppsHook4 pkg-config gobject-introspection gi-crystal ]
+  nativeBuildInputs = [ wrapGAppsHook4 pkg-config gobject-introspection ]
     ++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ];
-  buildInputs = [ libadwaita openssl libxml2 ];
+
+  buildInputs = [
+    libadwaita
+    openssl
+    libxml2
+    gnome.nautilus-python
+    python3.pkgs.pygobject3
+  ];
 
   buildTargets = ["bindings" "build"];
 
@@ -40,6 +65,22 @@ crystal.buildCrystalPackage rec {
 
   installTargets = ["desktop" "install"];
 
+  postInstall = ''
+      install -Dm555 ./nautilus-extension/collision-extension.py -t $out/share/nautilus-python/extensions
+  '';
+
+  passthru = {
+    updateScript = _experimental-update-script-combinators.sequence [
+      (gitUpdater { rev-prefix = "v"; })
+      (_experimental-update-script-combinators.copyAttrOutputToFile "collision.shardLock" ./shard.lock)
+      { command = [ (writeShellScript "update-lock" "cd $1; ${lib.getExe crystal2nix}") ./. ]; supportedFeatures = [ "silent" ]; }
+      { command = [ "rm" ./shard.lock ]; supportedFeatures = [ "silent" ]; }
+    ];
+    shardLock = runCommand "shard.lock" { inherit src; } ''
+      cp $src/shard.lock $out
+    '';
+  };
+
   meta = with lib; {
     description = "Check hashes for your files";
     homepage = "https://github.com/GeopJr/Collision";