Closed runeksvendsen closed 1 year ago
The following error was observed after trying to enter a nix-shell from the output generated by cabal2nix:
$ nix-shell shell-tmp.nix error: syntax error, unexpected IF, expecting '}', at /home/runeks/code/haskell-graph/all-hackage-ghc-pkg/shell-tmp.nix:7:23
Content of shell-tmp.nix (output of cabal2nix) :
shell-tmp.nix
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }: let inherit (nixpkgs) pkgs; f = { mkDerivation, if, lib }: mkDerivation { pname = "all-hackage-deps"; version = "0.1.0.0"; src = /run/user/1000/all-hackage-ghc-pkg; libraryHaskellDepends = [ if ]; license = lib.licenses.bsd3; }; haskellPackages = if compiler == "default" then pkgs.haskellPackages else pkgs.haskell.packages.${compiler}; variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; drv = variant (haskellPackages.callPackage f {}); in if pkgs.lib.inNixShell then drv.env else drv
Notice that the reserved if keyword is used as an argument name.
if
.cabal file:
cabal-version: 2.4 name: foo version: 0.1.0.0 license: BSD-3-Clause license-file: LICENSE author: Blah maintainer: blah@blah.com extra-source-files: CHANGELOG.md library exposed-modules: MyLib build-depends: if ==0.1.0.0 hs-source-dirs: src default-language: Haskell2010
@runeksvendsen Thanks for writing this up.
I'm closing in favor of https://github.com/NixOS/cabal2nix/issues/164
The following error was observed after trying to enter a nix-shell from the output generated by cabal2nix:
Content of
shell-tmp.nix
(output of cabal2nix) :Notice that the reserved
if
keyword is used as an argument name..cabal file: