ligo/nix/packageDeb.nix
Alexander Bantyev edb3fce642 Add nix as a build system
* Dynamically linked executables (ligo-bin)
* Statically linked executables (ligo-static)
* Docker (ligo-docker)
* deb package (ligo-deb)
* webide (ligo-editor)
* webide docker (ligo-editor-docker)
* website (ligo-website)
2020-04-29 19:40:04 +01:00

47 lines
1.1 KiB
Nix

{ stdenv, lib, writeTextFile, ligo-static, dpkg }:
let
project = "ligo";
version = "0.0.0";
revision = lib.commitIdFromGitRepo ../.git;
pkgArch = "amd64";
bin = "${ligo-static}/bin/ligo";
pkgName = "${project}_0ubuntu${version}-${revision}_${pkgArch}";
depends = "";
maintainer = "ligolang ligolang.org";
description = "A friendly Smart Contract Language for Tezos";
writeControlFile = writeTextFile {
name = "control";
text = ''
Package: ${project}
Version: ${version}-${revision}
Priority: optional
Architecture: ${pkgArch}
Depends: ${depends}
Maintainer: ${maintainer}
Description: ${project}
${description}
'';
};
in stdenv.mkDerivation rec {
name = "${pkgName}.deb";
nativeBuildInputs = [ dpkg ];
phases = "packagePhase";
packagePhase = ''
mkdir ${pkgName}
mkdir -p ${pkgName}/usr/local/bin
cp ${bin} ${pkgName}/usr/local/bin/${project}
mkdir ${pkgName}/DEBIAN
cp ${writeControlFile} ${pkgName}/DEBIAN/control
dpkg-deb --build ${pkgName}
mkdir -p $out
cp ${name} $out/
'';
}