Skip to content

Commit

Permalink
add scripts as package to enable importing from other flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
willyrgf committed Jul 11, 2024
1 parent 6da1e3f commit 783f1be
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 35 deletions.
37 changes: 25 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +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}
'';
};

apps.starknet-devnet-down = {
type = "app";
program = "${devnet-hardhat}/ops/scripts/devnet-hardhat-down.sh";
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

0 comments on commit 783f1be

Please sign in to comment.