Skip to content

Instantly share code, notes, and snippets.

@Nekroze
Last active May 20, 2016 01:06
Show Gist options
  • Save Nekroze/c13c0784d612b23e10a3e8394f5efcdb to your computer and use it in GitHub Desktop.
Save Nekroze/c13c0784d612b23e10a3e8394f5efcdb to your computer and use it in GitHub Desktop.
LDC Calypso Nix Expression

This is a description of a reproducable build environment for ldc and ldc calypso

Nix

Nix is required to produce the build environment and works on many operating systems.

While awesome Nix is still niche and a bit complex to start with but the part I like is that while it can be hard to write its pretty easy to ready and maintain Nix expressions.

To execute a repoducable build run:

$ nix-build ldc-calypso.nix

To test it you can then use the resulting build.

$ ./result/bin/ldc2 --help

I intend to try and merge this upstream into nixpkgs

Weirdness

I was unable to build ldc in any form without gcc6 (6.1.0)

{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs;
stdenv.mkDerivation rec {
name = "ldc-calypso-${version}";
version = "0.17.1";
src = fetchgit {
url = "https://github.com/Syniurge/Calypso.git";
rev = "af189b9da8520f872fe8c034a8f42e793a06cbb9";
sha256 = "0g2d386ar68iypd1pgmi02wkvvijagdy923c9ja2js71xqciifg0";
fetchSubmodules = true;
};
buildInputs = [ cmake cacert openssl libconfig libedit zlib curl libatomic_ops libxml2 llvm_36 ];
enableParallelBuilding = true;
cmakeFlags = [
"-DLLVM_ROOT_DIR=${llvm_36}"
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_CXX_FLAGS_RELEASE=-std=c++11"
"-DCMAKE_C_COMPILER=${gcc6}/bin/cc"
"-DCMAKE_CXX_COMPILER=${gcc6}/bin/g++"
];
}
{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs;
stdenv.mkDerivation rec {
name = "ldc-${version}";
version = "0.17.1";
src = fetchgit {
url = "https://github.com/ldc-developers/ldc.git";
rev = "refs/tags/v${version}";
sha256 = "1jbvl4iv7r50lxrdiqpdgp5b0kv3igy9sz12cyr3nkjs0fkr54sx";
fetchSubmodules = true;
};
buildInputs = [cmake cacert openssl libconfig libedit zlib libxml2 curl llvm];
enableParallelBuilding = true;
cmakeFlags = [
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_CXX_FLAGS_RELEASE=-std=c++11"
"-DLLVM_ROOT_DIR=${llvm}"
"-DCMAKE_C_COMPILER=${gcc6}/bin/cc"
"-DCMAKE_CXX_COMPILER=${gcc6}/bin/g++"
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment