From fd0b60610d581f4be31f438355e3da59440f5091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20C=C3=B3rdoba?= Date: Fri, 9 Feb 2024 13:28:29 +0100 Subject: [PATCH] WIP --- flake.nix | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/flake.nix b/flake.nix index 0bd2bce..ebd52e5 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ ]; }; - packages.hc-scaffold = pkgs.runCommand "hc-scaffold" { + packages.hc-scaffold-template-app = pkgs.runCommand "hc-scaffold" { buildInputs = [ pkgs.makeWrapper ]; src = ./.; } '' @@ -51,29 +51,32 @@ # Except the hello binary rm $out/bin/hc-scaffold cp $src/.templates/app -R $out/.templates - cp $src/.templates/module -R $out/.templates # Because we create this ourself, by creating a wrapper makeWrapper ${holochain-flake.packages.${system}.hc-scaffold}/bin/hc-scaffold $out/bin/hc-scaffold \ - --append-flags " --templates-path $out/.templates" + --append-flags "--template app --templates-path $out/.templates" ''; - # packages.hc-scaffold = pkgs.symlinkJoin { - # name = "hc-scaffold"; - # paths = [ holochain-flake.packages.${system}.hc-scaffold ]; - # buildInputs = [ pkgs.makeWrapper ]; - # installPhase = '' - - # ''; - # postBuild = '' - # wrapProgram $out/bin/hc-scaffold \ - # --append-flags "--template app" - # ''; - # }; + packages.hc-scaffold-template-module= pkgs.runCommand "hc-scaffold" { + buildInputs = [ pkgs.makeWrapper ]; + src = ./.; + } '' + mkdir $out + mkdir $out/.templates + # Link every top-level folder from pkgs.hello to our new target + ln -s ${holochain-flake.packages.${system}.hc-scaffold}/* $out + # Except the bin folder + rm $out/bin + mkdir $out/bin + # We create the bin folder ourselves and link every binary in it + ln -s ${holochain-flake.packages.${system}.hc-scaffold}/bin/* $out/bin + # Except the hello binary + rm $out/bin/hc-scaffold + cp $src/.templates/module -R $out/.templates + # Because we create this ourself, by creating a wrapper + makeWrapper ${holochain-flake.packages.${system}.hc-scaffold}/bin/hc-scaffold $out/bin/hc-scaffold \ + --append-flags "--template module --templates-path $out/.templates" + ''; - # apps.hc-scaffold = { - # type = "app"; - # program = "${pkgs.nodejs-18_x}/bin/npm"; - # }; }; }; }