Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix integration #61

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build/nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
name = "cairo-lang";
shellHook = ''
nix-build derivation.nix
PATH=$PATH:$(readlink -f ./result)/bin/
'';
}
46 changes: 46 additions & 0 deletions build/nix/derivation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
with import <nixpkgs> {};
#{ lib, stdenv, fetchurl }:

stdenv.mkDerivation rec {
pname = "cairo-lang";
version = "2.0.0-rc4";

src = fetchurl {
url = "https://github.com/starkware-libs/cairo/archive/refs/tags/v${version}.tar.gz";
sha256 = "e3dd3ce3f9ab5b69c44d01b13777d92516dcd830efb6a3d2cd46915d4f03e8a9";
};

buildInputs = [git rustup gcc libiconv];

configurePhase = ''
export HOME=$(pwd)
rustup override set stable
rustup update
'';

buildPhase = ''
export HOME=$(pwd)
cargo build --all --release --manifest-path ./Cargo.toml
'';

installPhase = ''
mkdir -p $out/bin/

mv "./target/release/cairo-compile" $out/bin/
mv "./target/release/cairo-format" $out/bin/
mv "./target/release/cairo-language-server" $out/bin/
mv "./target/release/cairo-run" $out/bin/
mv "./target/release/cairo-test" $out/bin/
mv "./target/release/sierra-compile" $out/bin/
mv "./target/release/starknet-compile" $out/bin/
mv "./target/release/starknet-sierra-compile" $out/bin/
'';

meta = with lib; {
description = "Cairo language instalation";
homepage = "https://cairo-by-example.com/";
sourceProvenance = with sourceTypes; [ fromSource ];
license = licenses.mit;
maintainers = with maintainers; [ samoht9277 ];
};
}