diff --git a/flake.nix b/flake.nix index 390143b4..e9f27e56 100644 --- a/flake.nix +++ b/flake.nix @@ -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; diff --git a/ops/scripts/default.nix b/ops/scripts/default.nix deleted file mode 100644 index 2b883707..00000000 --- a/ops/scripts/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - pkgs ? import {} -}: - let - inherit (pkgs) stdenv; - in - stdenv.mkDerivation { - name = "starknet-devnet-hardhat-scripts"; - src = ./.; - - buildInputs = with pkgs; [ - docker - bash - ]; - - installPhase = '' - mkdir -p $out/ops/scripts - cp -rv $src/* $out/ops/scripts - ''; - } - diff --git a/shell.nix b/shell.nix index 1f4fe23d..ff471f28 100644 --- a/shell.nix +++ b/shell.nix @@ -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 @@ -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;