1

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.

gchicote
  • 31
  • 3
  • there is a comment `For backwards compatibility using flake.nix`. Is there any `flake.nix` file? maybe you have to add your dependency there,,, I don't know nix btw – lsmor Jun 27 '23 at 04:43
  • That was a part of the issue, thank you very much! The other part was that I didn't have `devenv` installed so I was unable to run that command. I started over installing `cachix` and `devenv` prior to creating the project with `ihp-new blog` and is working fine for now! Thanks again! – gchicote Jun 27 '23 at 16:37

1 Answers1

2

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.

gchicote
  • 31
  • 3
  • you can contribute by opening an issue in the github repo pointing out these two problems! :) – lsmor Jun 28 '23 at 05:57
  • 1
    IHP is in the middle of updating their boilerplate in anticipation of IHP v1.1.0 which is slated for release soon. The Getting Started guide is unfortunately a bit out of date as a result, as you conjectured. – Chris Schankula Jun 30 '23 at 00:17