Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed Mar 5, 2024
1 parent 0803c6d commit 0355e29
Show file tree
Hide file tree
Showing 16 changed files with 3,829 additions and 61 deletions.
4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
filterDnas = filterByHolochainPackageType "dna";
filterHapps = filterByHolochainPackageType "happ";

rustZome = { cratePath, holochain, workspacePath, optimizeWasm ? true, excludedCrates ? [] }:
rustZome = { cratePath, holochain, workspacePath, excludedCrates ? [] }:
let
system = holochain.devShells.holonix.system;
pkgs = import inputs.nixpkgs {
Expand All @@ -50,7 +50,7 @@

in
pkgs.callPackage ./nix/zome.nix {
inherit craneLib cratePath excludedCrates workspacePath optimizeWasm;
inherit craneLib cratePath excludedCrates workspacePath;
};
dna = { holochain, dnaManifest, zomes }:
let
Expand Down
39 changes: 23 additions & 16 deletions nix/dna.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Build a DNA
{
dnaManifest,
stdenv,
json2yaml,
runCommandNoCC,
runCommandLocal,
writeText,
holochain,
zomes ? {}
Expand All @@ -29,23 +28,31 @@ let
};

dnaManifestJson = writeText "dna.json" (builtins.toJSON manifest');
dnaManifestYaml = runCommandNoCC "json-to-yaml" {} ''
dnaManifestYaml = runCommandLocal "json-to-yaml" {} ''
${json2yaml}/bin/json2yaml ${dnaManifestJson} $out
'';

debug = runCommandLocal manifest.name {
srcs = builtins.map (zome: zome.meta.debug) zomeSrcs;
meta = {
inherit debug;
holochainPackageType = "dna";
};
} ''
mkdir workdir
cp ${dnaManifestYaml} workdir/dna.yaml
${holochain.packages.holochain}/bin/hc dna pack workdir
mv workdir/${manifest.name}.dna $out
'';
in
stdenv.mkDerivation {
name = manifest.name;
srcs = [ zomeSrcs dnaManifestYaml ];
nativeBuildInputs = [ holochain.packages.holochain ];
phases = [ "buildPhase" ];
buildPhase = ''
mkdir workdir
cp ${dnaManifestYaml} workdir/dna.yaml
hc dna pack workdir
mv workdir/${manifest.name}.dna $out
'';
runCommandLocal manifest.name {
srcs = zomeSrcs;
meta = {
inherit debug;
holochainPackageType = "dna";
};
}
} ''
mkdir workdir
cp ${dnaManifestYaml} workdir/dna.yaml
${holochain.packages.holochain}/bin/hc dna pack workdir
mv workdir/${manifest.name}.dna $out
''
Loading

0 comments on commit 0355e29

Please sign in to comment.