Skip to content

Commit

Permalink
Scaffold-remote-zome default.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed Jul 5, 2024
1 parent 607c4c2 commit a1f87c4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
33 changes: 33 additions & 0 deletions crates/scaffold_remote_zome/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ inputs, self, ... }:

{
perSystem = { inputs', pkgs, self', lib, ... }: {

packages.scaffold-remote-zome = let
craneLib = inputs.crane.mkLib pkgs;

cratePath = ./.;

cargoToml =
builtins.fromTOML (builtins.readFile "${cratePath}/Cargo.toml");
crate = cargoToml.package.name;

commonArgs = {
src = craneLib.cleanCargoSource (craneLib.path ../../.);
doCheck = false;
buildInputs =
self.lib.holochainAppDeps.buildInputs { inherit pkgs lib; };
nativeBuildInputs =
self.lib.holochainAppDeps.nativeBuildInputs { inherit pkgs lib; };
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "workspace";
version = "workspace";
});
in craneLib.buildPackage (commonArgs // {
pname = crate;
version = cargoToml.package.version;
inherit cargoArtifacts;
});
};
}
32 changes: 3 additions & 29 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,11 @@
};
};

imports = [ ./crates/scaffold_remote_zome/default.nix ];

systems = builtins.attrNames inputs.holochain.devShells;
perSystem = { inputs', config, pkgs, system, lib, ... }: rec {

perSystem = { inputs', config, pkgs, system, lib, ... }: rec {
devShells.default = pkgs.mkShell {
inputsFrom = [ inputs'.holochain.devShells.holonix ];
packages = with pkgs;
Expand Down Expand Up @@ -312,34 +314,6 @@
inherit cargoArtifacts;
});

packages.scaffold-remote-zome = let
craneLib = inputs.crane.mkLib pkgs;

cratePath = ./crates/scaffold_remote_zome;

cargoToml =
builtins.fromTOML (builtins.readFile "${cratePath}/Cargo.toml");
crate = cargoToml.package.name;

commonArgs = {
src = craneLib.cleanCargoSource (craneLib.path ./.);
doCheck = false;
buildInputs =
flake.lib.holochainAppDeps.buildInputs { inherit pkgs lib; };
nativeBuildInputs = flake.lib.holochainAppDeps.nativeBuildInputs {
inherit pkgs lib;
};
};
cargoArtifacts = craneLib.buildDepsOnly (commonArgs // {
pname = "workspace";
version = "workspace";
});
in craneLib.buildPackage (commonArgs // {
pname = crate;
version = cargoToml.package.version;
inherit cargoArtifacts;
});

packages.pnpm = pkgs.writeShellScriptBin "pnpm" ''
#!${pkgs.bash}/bin/bash
exec ${pkgs.nodejs_20}/bin/node ${pkgs.nodejs_20}/bin/corepack [email protected] "$@"
Expand Down

0 comments on commit a1f87c4

Please sign in to comment.