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 13, 2023
1 parent d9c4c93 commit c64788e
Show file tree
Hide file tree
Showing 8 changed files with 221 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";
};
}
63 changes: 63 additions & 0 deletions pkgs/applications/misc/collision/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{ lib
, fetchFromGitHub
, callPackage
, crystal
, libadwaita
, gtk3
, 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 = pname;
rev = "refs/tags/v${version}";
name = pname;
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 = [ gtk3 wrapGAppsHook4 pkg-config ];
buildInputs = [ libadwaita openssl libxml2 ];

format = "make";

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

doInstallCheck = false;

buildPhase = ''
mkdir lib/gi-crystal
cp -r ${gi_crystal}/* lib/gi-crystal
shards build -Dpreview_mt --release --no-debug
'';

installPhase = ''
mkdir $out
make desktop
make prefix=$out install
'';

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

src = fetchFromGitHub {
owner = "hugopl";
repo = pname;
rev = "refs/tags/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 = ''
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
'';

installPhase = ''
mkdir $out
cp -r * $out
'';

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
+ gtk-update-icon-cache --ignore-theme-index $(PREFIX)/share/icons/hicolor
glib-compile-schemas $(PREFIX)/share/glib-2.0/schemas/

uninstall:
20 changes: 20 additions & 0 deletions pkgs/applications/misc/collision/shard.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/shard.yml 2023-07-07 11:47:02.833326121 +0300
+++ b/shard.yml 2023-07-09 08:06:20.730777868 +0300
@@ -8,17 +8,6 @@
collision:
main: src/collision.cr

-dependencies:
- libadwaita:
- github: GeopJr/libadwaita.cr
- commit: 203737fc96bb48e1a710cb68e896d2c5b9c1a6e5
- non-blocking-spawn:
- github: GeopJr/non-blocking-spawn
- version: ~> 1.0.5
- gettext:
- github: GeopJr/gettext.cr
- version: ~> 1.0.0
-
crystal: 1.7.3

license: BSD-2-Clause
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 c64788e

Please sign in to comment.