However, I’m not having problems dealing with the linker, but simply, getting the derivation to allow the use of gzip.
The output is as follows:
these derivations will be built:
/nix/store/n7kqp0jvshg9y438dl7bmby589xfi7bw-crystalline-v0.3.0.drv
building '/nix/store/n7kqp0jvshg9y438dl7bmby589xfi7bw-crystalline-v0.3.0.drv'...
unpacking sources
gzip: warning: GZIP environment variable is deprecated; use an alias or script
gzip: /nix/store/j6vy4jkp38na3d84h4k3jcr3fzfxbhxv-crystalline_x86_64-unknown-linux-gnu.gz has 1 other link -- unchanged
builder for '/nix/store/n7kqp0jvshg9y438dl7bmby589xfi7bw-crystalline-v0.3.0.drv' failed with exit code 2
error: build of '/nix/store/n7kqp0jvshg9y438dl7bmby589xfi7bw-crystalline-v0.3.0.drv' failed
I could find little to no mention of gzip (nor gunzip) in any of the Nix documentation that I went through.
I just tried gunzip though. Unfortunately, it’s still produces the same error.
these derivations will be built:
/nix/store/g8qn7z46zvbzz0x1fnx25vndn8c73m1q-crystalline-v0.3.0.drv
building '/nix/store/g8qn7z46zvbzz0x1fnx25vndn8c73m1q-crystalline-v0.3.0.drv'...
unpacking sources
gzip: warning: GZIP environment variable is deprecated; use an alias or script
gzip: /nix/store/j6vy4jkp38na3d84h4k3jcr3fzfxbhxv-crystalline_x86_64-unknown-linux-gnu.gz has 1 other link -- unchanged
builder for '/nix/store/g8qn7z46zvbzz0x1fnx25vndn8c73m1q-crystalline-v0.3.0.drv' failed with exit code 2
error: build of '/nix/store/g8qn7z46zvbzz0x1fnx25vndn8c73m1q-crystalline-v0.3.0.drv' failed
I did attempt to replicate the build instructions provided at NixOS - Nixpkgs 21.05 manual using the buildCrystalPackage function, but I guess crystal2nix hasn’t been maintained to work with newer version of Crystal.
As a last resort, I ended up manually downloading the binary archive, decompressing the gz, compressing it as a tar.gz, and using that for a locally-sourced derivation… how obnoxious… But whatever, Crystalline was installed successfully and is working without any issues.
The problem is that it tries to uncompress the file to /nix/store/j6vy4jkp38na3d84h4k3jcr3fzfxbhxv-crystalline_x86_64-unknown-linux-gnu. Copying it first to a writable location and extracting it then works better.
It also depends on Crystal, so I added a little wrapper around it so it doesn’t fail if there isn’t a crystal executable around, though one in your environment will take precedence.
Actually, the problem is that the mentioned derivation executes gzip $src vs either gunzip $src or gzip -d $src. But otherwise yes.
In any case, we definitely want the to build from source in nixpkgs but it turns out that I didn’t update the latest crystal2nix in nixpkgs (you need v0.1.1 for it to grok the shards format). Here’s a quick starting point for building it properly:
default.nix:
{ lib, fetchFromGitHub, crystal, llvm, coreutils, makeWrapper }:
crystal.buildCrystalPackage rec {
pname = "crystalline";
version = "0.3.0";
src = fetchFromGitHub {
owner = "elbywan";
repo = pname;
rev = "v${version}";
sha256 = "sha256-HInvPO1hm+HyN5dqoEo/vg6g1BdHApXzYZ7BFd8gYMQ=";
};
format = "shards";
buildInputs = [ llvm ];
shardsFile = ./shards.nix;
meta = with lib; {
description = "Code analysis server for the Crystal programming language";
homepage = "https://github.com/elvywan/crystalline";
};
}