Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
salomvary opened this issue Oct 13, 2024 · 1 comment
Open

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

salomvary opened this issue Oct 13, 2024 · 1 comment

Comments

@salomvary
Copy link

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
Copy link
Member

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants