0

I am trying to learn nix package manager and I wanted to build a flask app using nix package manager using --pure especially. When I run nix-shell --pure default.nix, I get the error syntax error, unexpected $end, expecting ';', at /Users/USER/Desktop/NixRank/flask-hello/default.nix:23:2 where line 23 corresponds to closing curly braces. I assume the error message is somehow is not helpful and any help is highly appreciated :)

here is my default.nix

let
    name = "learnnix";
    src= ./.;
    version = "0.1";
    pkgs=import<nixpkgs>{allowUnfree=true;};
in
with pkgs
stdenv.mkDerivation{
    name = "${name}";
    inherit src;
    buildInputs = [
        bash
        python3
        python38Packages.flask
    ];

    buildPhase = ''
        flask run
    '';
    installPhase =''
        open "http://localhost:5000/"
    '';
}

1 Answers1

3

Solved! the problem was on the line with with pkgs where semicolon was missing. Error message was not helpful in this case. I opt for leaving the post here so maybe someone can benefit later on.

  • I agree that the error message is not especially helpful. I would recommend against using the `with` keyword especially while learning. I think the code would be easier to grok without it because it would be more clear where `stdenv`, `bash`, `python3`, and `python38Packages.flask` come from. – emory Jul 04 '21 at 02:32