nix-community / crystal2nix

Build crystal projects using nix.
https://nixos.org
MIT License
14 stars 4 forks source link

Support non-git sources #9

Open OPNA2608 opened 1 year ago

OPNA2608 commented 1 year ago

Today I tried to package Benben by following the Crystal packaging instructions in the Nixpkgs manual, but the packaging process fails much earlier than I would've expected:

Unhandled exception: Missing YAML attribute: git at line 4, column 5 (YAML::ParseException)
  from /nix/store/cbx9ddy5g52wwjjarjbch327i0fp6pvf-crystal2nix-0.3.0/bin/crystal2nix in '??'
  from /nix/store/cbx9ddy5g52wwjjarjbch327i0fp6pvf-crystal2nix-0.3.0/bin/crystal2nix in '??'
  from /nix/store/cbx9ddy5g52wwjjarjbch327i0fp6pvf-crystal2nix-0.3.0/bin/crystal2nix in '??'
  from /nix/store/cbx9ddy5g52wwjjarjbch327i0fp6pvf-crystal2nix-0.3.0/bin/crystal2nix in '??'
  from /nix/store/cbx9ddy5g52wwjjarjbch327i0fp6pvf-crystal2nix-0.3.0/bin/crystal2nix in '__crystal_main'
  from /nix/store/cbx9ddy5g52wwjjarjbch327i0fp6pvf-crystal2nix-0.3.0/bin/crystal2nix in 'main'
  from /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6 in '??'
  from /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6 in '__libc_start_main'
  from /nix/store/cbx9ddy5g52wwjjarjbch327i0fp6pvf-crystal2nix-0.3.0/bin/crystal2nix in '_start'
  from ???

Benben and its dependencies use mostly fossil sources instead of git ones, and crystal2nix doesn't know how to handle non-git sources like that.

peterhoeg commented 1 year ago

Couple of things:

  1. when pasting in error messages, please use normal text instead of an image. Text can be indexed and searched.
  2. yes, we only support git sources (initially it was only github)

In principle, there is nothing preventing us from adding support for other SCMs - someone just need to do it. I don't have a need for it myself, but if you are interested in doing up a PR, that would be great!

donovanglover commented 6 months ago

If this gets changed then pkgs/development/compilers/crystal/build-package.nix would also need to be updated to support fossil sources.

peterhoeg commented 6 months ago

There's a GSoC project idea that will address this together with a number of other current shortcomings in our crystal infrastructure: https://github.com/NixOS/GSoC/blob/main/ideas/2024.md#first-class-support-for-crystal-applications