Skip to content

Commit

Permalink
Setting up nix is optional for example apps (#138)
Browse files Browse the repository at this point in the history
* Setting up nix is optional

* refactor nix set up

---------

Co-authored-by: Collins Muriuki <[email protected]>
  • Loading branch information
emhoracek and c12i committed Jun 28, 2024
1 parent 2846ec8 commit d01bacc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ pub enum HcScaffoldCommand {
/// Name of the example to scaffold. One of ['hello-world', 'forum'].
example: Option<Example>,

#[structopt(long)]
/// Whether to setup the holonix development environment for this web-app
setup_nix: Option<bool>,

/// The package manager to use with the example
/// Can be one of the following: "bun", "npm", "pnpm", or "yarn".
/// When a lockfile is detected, the respective package manager will be used as the default value;
Expand Down Expand Up @@ -660,6 +664,7 @@ Add new collections for that entry type with:
example,
package_manager,
holo_enabled,
setup_nix,
} => {
let example = match example {
Some(e) => e,
Expand Down Expand Up @@ -880,10 +885,12 @@ Add new collections for that entry type with:
build_file_tree(file_tree, &app_dir)?;

// set up nix
if let Err(err) = setup_nix_developer_environment(&app_dir) {
fs::remove_dir_all(&app_dir)?;
return Err(err)?;
}
if let Some(true) | None = setup_nix {
if let Err(err) = setup_nix_developer_environment(&app_dir) {
fs::remove_dir_all(&app_dir)?;
return Err(err)?;
}
};

setup_git_environment(&app_dir)?;

Expand Down

0 comments on commit d01bacc

Please sign in to comment.