Unable to install dependencies in IHP blog demo project

148 Views Asked by At

I'm new to IHP so I'm following the getting started guide.

I'm now stuck in the last part of Section 5 (extending with markdown).

When explaining how to install the required package, this are the instructions:


Adding a Markdown Library

To deal with Markdown, instead of implementing a custom Markdown parser, let’s just use an existing package. There’s the excellent mmark package we can use.

To install this package, open the default.nix file and append mmark to the haskellDeps list. The file will now look like this:


let
    ihp = builtins.fetchGit {
        url = "https://github.com/digitallyinduced/ihp.git";
        ref = "refs/tags/v0.10.0";
    };
    haskellEnv = import "${ihp}/NixSupport/default.nix" {
        ihp = ihp;
        haskellDeps = p: with p; [
            cabal-install
            base
            wai
            text
            hlint
            p.ihp
            mmark # <--------- OUR NEW PACKAGE ADDED HERE
        ];
        otherDeps = p: with p; [
            # Native dependencies, e.g. imagemagick
        ];
        projectPath = ./.;
    };
in
    haskellEnv

Stop the development server by pressing CTRL+C. Then update the local development environment by running make -B .envrc. This will download and install the mmark package. Now restart the development server by typing ./start again.


Here I have a couple of problems.

Firstly, my default.nix looks completely different, like this:

# For backwards compatibility using flake.nix
(import
    (
        fetchTarball {
            url = "https://github.com/edolstra/flake-compat/archive/12c64ca55c1014cdc1b16ed5a804aa8576601ff2.tar.gz";
            sha256 = "0jm6nzb83wa6ai17ly9fzpqc40wg1viib8klq8lby54agpl213w5";
        }
    )
{ src = ./.; }).defaultNix

Did I miss some initial configuration? Or is it supposed to look like that and I have to manually add all of that?

Secondly, when I try to run the command make -B .envrc I get the following error:

$ make -B .envrc
echo "This command is deprecated. Please use 'devenv up' instead"
This command is deprecated. Please use 'devenv up' instead

But I don't know how to run devenv up. I tried a couple of options I though could work like running it through the nix-shell but same error was raised.

1

There are 1 best solutions below

2
gchicote On

Solved

There were two problems:

First, as Ismor suggested in the first comment, I had to add the dependencies inside the flake.nix file.

And second, I didn't have devenv installed so I was unable to run that command. I started over installing cachix (recommended before installing devenv) and devenv prior to creating the project with ihp-new blog. Then I was able to run devenv up, packages got installed and everything is working fine now.

I'm using the latest IHP version, so maybe the IHP Guide is a bit outdated.