Skip to content

Commit

Permalink
collision: init at 3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sund3RRR committed Jul 14, 2023
1 parent d9c4c93 commit 2ae642d
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkgs/applications/misc/collision/collision-shards.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
gettext = {
url = "https://github.com/geopjr/gettext.cr.git";
rev = "v1.0.0";
sha256 = "1y27m4170rr4532j56grzhwbz8hj6z7j3zfkd0jnfwnsxclks1kc";
};
libadwaita = {
url = "https://github.com/geopjr/libadwaita.cr.git";
rev = "203737fc96bb48e1a710cb68e896d2c5b9c1a6e5";
sha256 = "11c2knxncjnwg4cgppfllxwgli1hf6sjyyx4ii8rgmnbird6xcmh";
};
non-blocking-spawn = {
url = "https://github.com/geopjr/non-blocking-spawn.git";
rev = "v1.0.5";
sha256 = "139gr87zlw0k9kf6pf9k2d88aa9x3kcnfg34qpbqrwsrck7708za";
};
version_from_shard = {
url = "https://github.com/hugopl/version_from_shard.git";
rev = "v1.2.5";
sha256 = "0xizj0q4rd541rwjbx04cjifc2gfx4l5v6q2y7gmd0ndjmkgb8ik";
};
}
70 changes: 70 additions & 0 deletions pkgs/applications/misc/collision/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{ lib
, fetchFromGitHub
, callPackage
, crystal
, libadwaita
, openssl
, libxml2
, pkg-config
, wrapGAppsHook4
}:
let
gi_crystal = callPackage gi-crystal/default.nix { };
in
crystal.buildCrystalPackage rec {
pname = "Collision";
version = "3.5.0";

src = fetchFromGitHub {
owner = "GeopJr";
repo = "Collision";
rev = "v${version}";
hash = "sha256-YNMtiMSzDqBlJJTUntRtL6oXg+IuyAobQ4FYcwOdOas=";
};


# 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 ];
buildInputs = [ libadwaita openssl libxml2 ];

format = "make";

patches = [ ./make.patch ];
shardsFile = ./collision-shards.nix;

doInstallCheck = false;

buildPhase = ''
runHook preBuild
mkdir lib/gi-crystal
cp -r ${gi_crystal}/* lib/gi-crystal
mkdir bin
crystal build ./src/collision.cr -o bin/collision -Dpreview_mt --release --no-debug
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir $out
make desktop
make prefix=$out install
runHook postInstall
'';

meta = with lib; {
description = "Check hashes for your files";
homepage = "https://github.com/GeopJr/Collision";
license = licenses.bsd2;
mainProgram = "collision";
maintainers = with maintainers; [ sund3RRR ];
};
}
63 changes: 63 additions & 0 deletions pkgs/applications/misc/collision/gi-crystal/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{ lib
, fetchFromGitHub
, crystal
, libadwaita
, gobject-introspection
}:
crystal.buildCrystalPackage rec {
pname = "gi-crystal";
version = "0.16.0";

src = fetchFromGitHub {
owner = "hugopl";
repo = "gi-crystal";
rev = "v${version}";
hash = "sha256-ij4U8BoSNHpkh5SmvoH5anGB/ZdvmC5zDwJCusR/s/c=";
};

format = "make";
shardsFile = ./shards.nix;
lockFile = ./shard.lock;

nativeBuildInputs = [ gobject-introspection ];
buildInputs = [ libadwaita ];

doCheck = false;
doInstallCheck = false;

buildPhase = ''
runHook preBuild
cd lib
for dep in *; do
dep_real_path=$(realpath "$dep")
rm "$dep"
cp -LR "$dep_real_path" "$dep"
done
cd ..
chmod +w shard.lock
shards build --error-trace
shards install
./bin/gi-crystal -o src/auto
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir $out
cp -r * $out
runHook postInstall
'';

meta = with lib; {
description = "GI Crystal is a binding generator used to generate Crystal bindings for GObject based libraries using GObject Introspection.";
homepage = "https://github.com/hugopl/gi-crystal";
mainProgram = "gi-crystal";
maintainers = with maintainers; [ sund3RRR ];
};
}
21 changes: 21 additions & 0 deletions pkgs/applications/misc/collision/gi-crystal/shard.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2.0
shards:
gio:
git: https://github.com/hugopl/gio.cr.git
version: 0.1.0

gtk4:
git: https://github.com/hugopl/gtk4.cr.git
version: 0.13.0

harfbuzz:
git: https://github.com/hugopl/harfbuzz.cr.git
version: 0.1.0

pango:
git: https://github.com/hugopl/pango.cr.git
version: 0.2.0

libadwaita:
git: https://github.com/geopjr/libadwaita.cr.git
version: 1.0.0+git.commit.203737fc96bb48e1a710cb68e896d2c5b9c1a6e5
27 changes: 27 additions & 0 deletions pkgs/applications/misc/collision/gi-crystal/shards.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
gio = {
url = "https://github.com/hugopl/gio.cr.git";
rev = "v0.1.0";
sha256 = "0vj35bi64d4hni18nrl8fmms306a0gl4zlxpf3aq08lh0sbwzhd8";
};
gtk4 = {
url = "https://github.com/hugopl/gtk4.cr.git";
rev = "v0.13.0";
sha256 = "0xsrcsh5qvwm9l7cywxpw49rfv94mkkqcliws4zkhxgr9isnirbm";
};
harfbuzz = {
url = "https://github.com/hugopl/harfbuzz.cr.git";
rev = "v0.1.0";
sha256 = "1lcb778b4k34sqxg979fpl425bbzf2gikjf2m5aj6x1fzxn46jg0";
};
pango = {
url = "https://github.com/hugopl/pango.cr.git";
rev = "v0.2.0";
sha256 = "0dl3qrhi2ybylmvzx1x5gsznp2pcdkc50waxrljxwnf5avn8ixsf";
};
libadwaita = {
url = "https://github.com/geopjr/libadwaita.cr.git";
rev = "203737fc96bb48e1a710cb68e896d2c5b9c1a6e5";
sha256 = "11c2knxncjnwg4cgppfllxwgli1hf6sjyyx4ii8rgmnbird6xcmh";
};
}
11 changes: 11 additions & 0 deletions pkgs/applications/misc/collision/make.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/Makefile 2023-07-09 10:49:31.064190374 +0300
+++ b/Makefile 2023-07-10 09:23:27.257275000 +0300
@@ -43,7 +43,7 @@
install -D -m 0644 data/dev.geopjr.Collision.desktop $(PREFIX)/share/applications/dev.geopjr.Collision.desktop
install -D -m 0644 data/icons/dev.geopjr.Collision.svg $(PREFIX)/share/icons/hicolor/scalable/apps/dev.geopjr.Collision.svg
install -D -m 0644 data/icons/dev.geopjr.Collision-symbolic.svg $(PREFIX)/share/icons/hicolor/symbolic/apps/dev.geopjr.Collision-symbolic.svg
- gtk-update-icon-cache $(PREFIX)/share/icons/hicolor
+ gtk4-update-icon-cache --ignore-theme-index $(PREFIX)/share/icons/hicolor
glib-compile-schemas $(PREFIX)/share/glib-2.0/schemas/

uninstall:
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ with pkgs;

colemak-dh = callPackage ../data/misc/colemak-dh { };

collision = callPackage ../applications/misc/collision { };

colmena = callPackage ../tools/admin/colmena { };

colorz = callPackage ../tools/misc/colorz { };
Expand Down

0 comments on commit 2ae642d

Please sign in to comment.