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

feat: add starknet-devnet scripts as a nix pkg and app #485

Merged
merged 3 commits into from
Jul 12, 2024
Merged
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
34 changes: 26 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,37 @@
};

outputs = inputs@{ self, nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlays.default ]; };
devnet-hardhat = import ./ops/scripts { inherit pkgs; };
in rec {
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlays.default ]; };
in
{
devShell = pkgs.callPackage ./shell.nix {
inherit pkgs;
scriptDir = toString ./.; # This converts the flake's root directory to a string
scriptDir = toString ./.; # This converts the flake's root directory to a string
};

apps.starknet-devnet = {
type = "app";
program = "${devnet-hardhat}/ops/scripts/devnet-hardhat.sh";
packages = {
starknet-devnet = pkgs.stdenv.mkDerivation rec {
name = "starknet-devnet";
src = ./ops/scripts;
installPhase = ''
mkdir -p $out/bin
cp $src/devnet-hardhat.sh $out/bin/${name}
cp $src/devnet-hardhat-down.sh $out/bin/
chmod +x $out/bin/${name}
'';
};

starknet-devnet-down = pkgs.stdenv.mkDerivation rec {
name = "starknet-devnet-down";
src = ./ops/scripts;
installPhase = ''
mkdir -p $out/bin
cp $src/devnet-hardhat-down.sh $out/bin/${name}
chmod +x $out/bin/${name}
'';
};
};

formatter = pkgs.nixpkgs-fmt;
Expand Down
21 changes: 0 additions & 21 deletions ops/scripts/default.nix

This file was deleted.

4 changes: 2 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ in
mkShell' {
nativeBuildInputs = [
stdenv.cc.cc.lib
(rust-bin.stable.latest.default.override { extensions = ["rust-src"]; })
(rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; })
nodejs-18_x
(yarn.override { nodejs = nodejs-18_x; })
nodePackages.typescript
Expand All @@ -39,7 +39,7 @@ mkShell' {
libusb1
];

LD_LIBRARY_PATH = lib.makeLibraryPath [pkgs.zlib stdenv.cc.cc.lib]; # lib64
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.zlib stdenv.cc.cc.lib ]; # lib64

GOROOT = "${go}/share/go";
CGO_ENABLED = 0;
Expand Down
Loading