digitallyinduced / ihp

šŸ”„ The fastest way to build type safe web apps. IHP is a new batteries-included web framework optimized for longterm productivity and programmer happiness
https://ihp.digitallyinduced.com/
MIT License
4.93k stars 195 forks source link

ihp-new fails to set up direnv and devenv on macOS #2005

Open salomvary opened 2 weeks ago

salomvary commented 2 weeks ago

I am going through the Getting Started Guide and ihp-new seems to fail to install direnv:

$ ihp-new blog

DIRENV MISSING
IHP uses direnv to manage env variables.
Learn more about direnv here: https://direnv.net/

We will install direnv for you now. Continue? (Type y to proceed) 
y
Direnv needs to be hooked into your shell.
Would you like to attempt to do this automatically? (Type y to proceed) 
y
Great!
Adding hook to ~/.zshrc...
We will now create your new IHP project. This may take up to 30 seconds.
Initialized empty Git repository in /Users/mrc/Projects/learn-haskell/blog/.git/
Updating build/Generated/Enums.hs
Updating build/Generated/ActualTypes.hs
Updating build/Generated/Types.hs
* Main.hs (import)
* Main.hs (import)
* Main.hs (AddMountToFrontController)
+ Web/Types.hs
+ Web/Routes.hs
+ Web/FrontController.hs
+ Web/Controller/Prelude.hs
+ Web/View/Layout.hs
+ Web/View/Prelude.hs
+ Web/Controller/Static.hs
+ Web/View/Static/Welcome.hs
/nix/store/q5zbyysl4czhbs8lgvqqg885z7431wlq-ihp-new-1.3.0/bin/.ihp-new-wrapped: line 251: direnv: command not found

I've followed the Guide instructions. Enabled the optional Flakes as recommended by the Guide.

ihp-new version: 1.3.0 nix (Nix) 2.24.9 zsh 5.8.1 (x86_64-apple-darwin21.0) macOS 12.7.6

direnv indeed does not seem to be on the path, even in a new terminal window.

The workaround was to install direnv using brew install direnv.

Once I got past this issue, I got to a successful project creation, devenv was missing too:

šŸš€ Project created, happy coding :)
You can start the server by running:
  cd blog
  devenv up

$ cd blog
$ devenv up
zsh: command not found: devenv

Anyway, as a last desperate attempt, I've removed Nix as described here and re-installed it following the Guide, but skipped the "Optional: Enabling Flakes" step.

Then nix-env --install ihp-new failed with:

$ nix-env --install ihp-new
error: selector 'ihp-new' matches no derivations

At this point I gave up.

mpscholten commented 2 weeks ago

Can you install direnv manually by doing nix profile add nixpkgs#direnv or nix-env --installer ihp-new and after that hook it into your shell manually https://direnv.net/docs/hook.html ?