Skip to content

Instantly share code, notes, and snippets.

@manveru
Created December 16, 2019 23:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manveru/ebe3b669fdec44f0d9b9c6f04d4986f2 to your computer and use it in GitHub Desktop.
Save manveru/ebe3b669fdec44f0d9b9c6f04d4986f2 to your computer and use it in GitHub Desktop.
static compilation with crystal
{ lib, crystal, nix-prefetch-git, makeStaticLibraries, stdenv, glibc, pcre
, libyaml, boehmgc, libevent }:
let
staticStdenv = makeStaticLibraries stdenv;
staticGlibc = glibc.static;
staticPcre = pcre.override { stdenv = staticStdenv; };
staticLibyaml = libyaml.override { stdenv = staticStdenv; };
staticBoehmgc =
boehmgc.override { stdenv = staticStdenv // { isLinux = false; }; };
staticLibevent = libevent.override { stdenv = staticStdenv; };
in crystal.buildCrystalPackage {
pname = "crystal2nix";
version = "unstable-2018-07-31";
nixPrefetchGit = "${lib.getBin nix-prefetch-git}/bin/nix-prefetch-git";
unpackPhase = "substituteAll ${./crystal2nix.cr} crystal2nix.cr";
buildInputs =
[ staticGlibc staticPcre staticLibyaml staticBoehmgc staticLibevent ];
crystalBinaries.crystal2nix = {
src = "crystal2nix.cr";
options = [ "--release" "--static" "--no-debug" ];
};
meta = with lib; {
description = "Utility to convert Crystal's shard.lock files to a Nix file";
license = licenses.mit;
maintainers = [ maintainers.manveru ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment