Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed Apr 4, 2024
1 parent aa72a59 commit 8596fb9
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 57 deletions.
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
inherit pkgs system;
customTemplatePath = ./templates/module;
};

};
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{#merge previous_file_content}}
{{#match_scope "zomes = {"}}
{{previous_scope_content}}
{{zome_manifest.name}} = self'.packages.{{zome_manifest.name}};
{{/match_scope}}
{{/merge}}
7 changes: 4 additions & 3 deletions templates/app/dna/dnas/{{dna_name}}/dna.nix.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ inputs, allZomes, ... }:
{ inputs, ... }:

{
# Import all ./zomes/coordinator/*/zome.nix and ./zomes/integrity/*/zome.nix
Expand All @@ -21,9 +21,10 @@
packages.{{dna_name}} = inputs.hc-infra.outputs.lib.dna {
dnaManifest = ./workdir/dna.yaml;
holochain = inputs'.holochain;
zomes = (allZomes { inherit inputs' self'; }) // {
# Override specific zomes here, e.g.:
zomes = {
# Include here the zome packages for this DNA, e.g.:
# profiles_integrity = inputs'.profiles.packages.profiles_integrity;
# This overrides all the "bundled" properties for the DNA manifest
};
};
};
Expand Down
6 changes: 6 additions & 0 deletions templates/app/dna/happ.nix.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{#merge previous_file_content}}
{{#match_scope "dnas = {"}}
{{previous_scope_content}}
{{dna_name}} = self'.packages.{{dna_name}};
{{/match_scope}}
{{/merge}}
21 changes: 2 additions & 19 deletions templates/app/web-app/flake.nix.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
flake-parts.follows = "holochain/flake-parts";

scaffolding.url = "github:holochain-open-dev/templates";
hc-infra.url = "github:holochain-open-dev/infrastructure";
hc-infra.url = "github:holochain-open-dev/infrastructure/0.300.0-dev";

# Holochain dependencies (zomes, DNAs and hApps)
profiles.url = "github:holochain-open-dev/profiles/nixify";
Expand All @@ -24,26 +24,9 @@
{
inherit inputs;
specialArgs = rec {
# All the upstream repositories that output zomes, dnas or happs packages
holochainSources = inputs': with inputs'; [
profiles
file-storage
# ... and add the name of the repository here as well
];

## Special arguments for the flake parts of this repository

rootPath = ./.;

# Aggregators: take all the packages from this repository and the upstream
# holochain sources and merge them
allHolochainPackages = { inputs', self' }: inputs.nixpkgs.lib.attrsets.mergeAttrsList (
[ self'.packages ]
++ builtins.map (s: s.packages) (holochainSources inputs')
);
allZomes = { inputs', self' }: inputs.hc-infra.outputs.lib.filterZomes (allHolochainPackages { inherit inputs' self'; });
allDnas = { inputs', self' }: inputs.hc-infra.outputs.lib.filterDnas (allHolochainPackages { inherit inputs' self'; });
allHapps = { inputs', self' }: inputs.hc-infra.outputs.lib.filterHapps (allHolochainPackages { inherit inputs' self'; });
};
}
{
Expand All @@ -61,8 +44,8 @@
}: {
devShells.default = pkgs.mkShell {
inputsFrom = [
inputs'.hc-infra.devShells.synchronized-pnpm
inputs'.holochain.devShells.holonix
inputs'.hc-infra-synchronized-pnpm
];
packages = [
inputs'.scaffolding.packages.hc-scaffold-app-template
Expand Down
7 changes: 4 additions & 3 deletions templates/app/web-app/happ.nix.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ inputs, allDnas, ... }:
{ inputs, ... }:

{
# Import all `dnas/*/dna.nix` files
Expand All @@ -16,9 +16,10 @@
packages.{{app_name}} = inputs.hc-infra.outputs.lib.happ {
holochain = inputs'.holochain;
happManifest = ./workdir/happ.yaml;
dnas = (allDnas { inherit self' inputs'; }) // {
# Override specific dnas here, e.g.:
dnas = {
# Include here the DNA packages for this hApp, e.g.:
# my_dna = inputs'.some_input.packages.my_dna;
# This overrides all the "bundled" properties for the hApp manifest
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion templates/app/web-app/tests/vitest.config.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export default defineConfig({
},
testTimeout: 60*1000*3 // 3 mins
},
})
});

17 changes: 0 additions & 17 deletions templates/module/web-app/flake.nix.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,9 @@
{
inherit inputs;
specialArgs = rec {
# All the upstream repositories that output zomes, dnas or happs packages
holochainSources = inputs': with inputs'; [
profiles
file-storage
# ... and add the name of the repository here as well
];

## Special arguments for the flake parts of this repository

rootPath = ./.;

# Aggregators: take all the packages from this repository and the upstream
# holochain sources and merge them
allHolochainPackages = { inputs', self' }: inputs.nixpkgs.lib.attrsets.mergeAttrsList (
[ self'.packages ]
++ builtins.map (s: s.packages) (holochainSources inputs')
);
allZomes = { inputs', self' }: inputs.hc-infra.outputs.lib.filterZomes (allHolochainPackages { inherit inputs' self'; });
allDnas = { inputs', self' }: inputs.hc-infra.outputs.lib.filterDnas (allHolochainPackages { inherit inputs' self'; });
allHapps = { inputs', self' }: inputs.hc-infra.outputs.lib.filterHapps (allHolochainPackages { inherit inputs' self'; });
};
}
{
Expand Down
7 changes: 4 additions & 3 deletions templates/module/web-app/workdir/dna.nix.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ inputs, allZomes, ... }:
{ inputs, ... }:

{
perSystem =
Expand All @@ -10,9 +10,10 @@
packages.{{dna_name}}_test = inputs.hc-infra.outputs.lib.dna {
dnaManifest = ./dna.yaml;
holochain = inputs'.holochain;
zomes = (allZomes { inherit inputs' self'; }) // {
# Override specific zomes here, e.g.:
zomes = {
# Include here the zome packages for this DNA, e.g.:
# profiles_integrity = inputs'.profiles.packages.profiles_integrity;
# This overrides all the "bundled" properties for the DNA manifest
};
};
};
Expand Down
7 changes: 4 additions & 3 deletions templates/module/web-app/workdir/happ.nix.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ inputs, allDnas, ... }:
{ inputs, ... }:

{
perSystem =
Expand All @@ -11,9 +11,10 @@
holochain = inputs'.holochain;
happManifest = ./happ.yaml;

dnas = (allDnas { inherit self' inputs'; }) // {
# Override specific dnas here, e.g.:
dnas = {
# Include here the DNA packages for this hApp, e.g.:
# my_dna = inputs'.some_input.packages.my_dna;
# This overrides all the "bundled" properties for the hApp manifest
};
};
};
Expand Down

0 comments on commit 8596fb9

Please sign in to comment.