Skip to content

Commit

Permalink
Fix build dna and happ on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed Apr 24, 2024
1 parent c971b93 commit e04d1eb
Show file tree
Hide file tree
Showing 7 changed files with 4,633 additions and 26,021 deletions.
50 changes: 35 additions & 15 deletions nix/dna.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

let
zomeSrcs = builtins.attrValues zomes;

# Recurse over the zomes, and add the correct bundled zome package by name


# Recurse over the zomes, and add the correct bundled zome package by name
manifest = (callPackage ./import-yaml.nix {}) dnaManifest;
zomeToBundled = zome: zome // {
bundled = zomes.${zome.name};
Expand All @@ -31,19 +30,40 @@ let
dnaManifestJson = writeText "dna.json" (builtins.toJSON manifest');
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";
''; # Recurse over the zomes, and add the correct bundled zome package by name

# Debug package
debug = let
manifest = (callPackage ./import-yaml.nix {}) dnaManifest;
zomeToBundled = zome: zome // {
bundled = zomes.${zome.name}.meta.debug;
};
} ''
mkdir workdir
cp ${dnaManifestYaml} workdir/dna.yaml
${holochain.packages.holochain}/bin/hc dna pack workdir
mv workdir/${manifest.name}.dna $out
'';
coordinatorZomes = builtins.map zomeToBundled manifest.coordinator.zomes;
integrityZomes = builtins.map zomeToBundled manifest.integrity.zomes;

manifest' = manifest // {
coordinator.zomes = coordinatorZomes;
integrity = manifest.integrity // {
zomes = integrityZomes;
};
};

dnaManifestJson = writeText "dna.json" (builtins.toJSON manifest');
dnaManifestYaml = runCommandLocal "json-to-yaml" {} ''
${json2yaml}/bin/json2yaml ${dnaManifestJson} $out
'';
in
runCommandLocal manifest.name {
srcs = builtins.map (zome: zome.meta.debug) zomeSrcs;
meta = {
holochainPackageType = "dna";
};
} ''
mkdir workdir
cp ${dnaManifestYaml} workdir/dna.yaml
${holochain.packages.holochain}/bin/hc dna pack workdir
mv workdir/${manifest.name}.dna $out
'';
in
runCommandLocal manifest.name {
srcs = zomeSrcs;
Expand Down
Loading

0 comments on commit e04d1eb

Please sign in to comment.