Skip to content

"nix: True" in .cabal/config causes parsing error #8452

Closed
@mhwombat

Description

@mhwombat

Describe the bug

Nix integration not working as expected in cabal 3.8.1.0.

To Reproduce

~/.cabal 
❯ cabal user-config init
Writing default configuration to /home/amy/.cabal/config

~/.cabal 
❯ cabal v2-update
Downloading the latest package list from hackage.haskell.org
Package list of hackage.haskell.org is up to date.
The index-state is set to 2022-09-04T17:19:43Z.

Now edit ~/.cabal/config, changing line 24 to:

nix: True

This used to work (e.g. in Cabal library and cabal-install version: 3.4.0.0), and it's what the documentation says to do.

~/.cabal 
✦ ❯ cabal v2-update
Error: cabal: Error parsing config file /home/amy/.cabal/config:24:
True

Please use version-prefixed commands (e.g. v2-build or v1-build) to avoid ambiguity.

Expected behavior

cabal v2-update should handle this setting, or if something has changed and this is no longer correct, the docs should be updated and cabal should warn me.

System information

❯ uname -a
Linux wombat11k 5.15.63 #1-NixOS SMP Thu Aug 25 09:40:49 UTC 2022 x86_64 GNU/Linux

❯ cabal --version
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library 

❯ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.0.2

Additional context

I'm running NixOS.

✦ ❯ cat ~/.cabal/config
-- This is the configuration file for the 'cabal' command line tool.
--
-- The available configuration options are listed below.
-- Some of them have default values listed.
--
-- Lines (like this one) beginning with '--' are comments.
-- Be careful with spaces and indentation because they are
-- used to indicate layout for nested sections.
--
-- This config file was generated using the following versions
-- of Cabal and cabal-install:
-- Cabal library version: 3.8.1.0
-- cabal-install version: 3.8.1.0


repository hackage.haskell.org
  url: http://hackage.haskell.org/
  -- secure: True
  -- root-keys:
  -- key-threshold: 3

-- ignore-expiry: False
-- http-transport:
nix: True
-- store-dir:
-- active-repositories:
-- local-no-index-repo:
remote-repo-cache: /home/amy/.cabal/packages
-- logs-dir: /home/amy/.cabal/logs
-- default-user-config:
-- verbose: 1
-- compiler: ghc
-- cabal-file:
-- with-compiler:
-- with-hc-pkg:
-- program-prefix:
-- program-suffix:
-- library-vanilla: True
-- library-profiling:
-- shared:
-- static:
-- executable-dynamic: False
-- executable-static: False
-- profiling:
-- executable-profiling:
-- profiling-detail:
-- library-profiling-detail:
-- optimization: True
-- debug-info: False
-- build-info:
-- library-for-ghci:
-- split-sections: False
-- split-objs: False
-- executable-stripping:
-- library-stripping:
-- configure-option:
-- user-install: True
-- package-db:
-- flags:
-- extra-include-dirs:
-- deterministic:
-- cid:
-- extra-lib-dirs:
-- extra-lib-dirs-static:
-- extra-framework-dirs:
extra-prog-path: /home/amy/.cabal/bin
-- instantiate-with:
-- tests: False
-- coverage: False
-- library-coverage:
-- exact-configuration: False
-- benchmarks: False
-- relocatable: False
-- response-files:
-- allow-depending-on-private-libs:
-- cabal-lib-version:
-- append:
-- backup:
-- constraint:
-- preference:
-- solver: modular
-- allow-older: False
-- allow-newer: False
-- write-ghc-environment-files:
-- documentation: False
-- doc-index-file: $datadir/doc/$arch-$os-$compiler/index.html
-- only-download: False
-- target-package-db:
-- max-backjumps: 4000
-- reorder-goals: False
-- count-conflicts: True
-- fine-grained-conflicts: True
-- minimize-conflict-set: False
-- independent-goals: False
-- shadow-installed-packages: False
-- strong-flags: False
-- allow-boot-library-installs: False
-- reject-unconstrained-dependencies: none
-- reinstall: False
-- avoid-reinstalls: False
-- force-reinstalls: False
-- upgrade-dependencies: False
-- index-state:
-- root-cmd:
-- symlink-bindir:
build-summary: /home/amy/.cabal/logs/build.log
-- build-log:
remote-build-reporting: none
-- report-planning-failure: False
-- per-component: True
-- run-tests:
jobs: $ncpus
-- keep-going: False
-- offline: False
-- lib: False
-- package-env:
-- overwrite-policy:
-- install-method:
installdir: /home/amy/.cabal/bin
-- username:
-- password:
-- password-command:
-- builddir:

haddock
  -- keep-temp-files: False
  -- hoogle: False
  -- html: False
  -- html-location:
  -- executables: False
  -- tests: False
  -- benchmarks: False
  -- foreign-libraries: False
  -- all:
  -- internal: False
  -- css:
  -- hyperlink-source: False
  -- quickjump: False
  -- hscolour-css:
  -- contents-location:

init
  -- interactive: False
  -- cabal-version: 3.0
  -- license:
  -- extra-doc-file:
  -- tests:
  -- test-dir:
  -- language: Haskell2010
  -- application-dir: app
  -- source-dir: src

install-dirs user
  -- prefix: /home/amy/.cabal
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $abi/$libname
  -- dynlibdir: $libdir/$abi
  -- libexecdir: $prefix/libexec
  -- libexecsubdir: $abi/$pkgid
  -- datadir: $prefix/share
  -- datasubdir: $abi/$pkgid
  -- docdir: $datadir/doc/$abi/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc

install-dirs global
  -- prefix: /usr/local
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $abi/$libname
  -- dynlibdir: $libdir/$abi
  -- libexecdir: $prefix/libexec
  -- libexecsubdir: $abi/$pkgid
  -- datadir: $prefix/share
  -- datasubdir: $abi/$pkgid
  -- docdir: $datadir/doc/$abi/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc

program-locations
  -- alex-location:
  -- ar-location:
  -- c2hs-location:
  -- cpphs-location:
  -- doctest-location:
  -- gcc-location:
  -- ghc-location:
  -- ghc-pkg-location:
  -- ghcjs-location:
  -- ghcjs-pkg-location:
  -- greencard-location:
  -- haddock-location:
  -- happy-location:
  -- haskell-suite-location:
  -- haskell-suite-pkg-location:
  -- hmake-location:
  -- hpc-location:
  -- hsc2hs-location:
  -- hscolour-location:
  -- jhc-location:
  -- ld-location:
  -- pkg-config-location:
  -- runghc-location:
  -- strip-location:
  -- tar-location:
  -- uhc-location:

program-default-options
  -- alex-options:
  -- ar-options:
  -- c2hs-options:
  -- cpphs-options:
  -- doctest-options:
  -- gcc-options:
  -- ghc-options:
  -- ghc-pkg-options:
  -- ghcjs-options:
  -- ghcjs-pkg-options:
  -- greencard-options:
  -- haddock-options:
  -- happy-options:
  -- haskell-suite-options:
  -- haskell-suite-pkg-options:
  -- hmake-options:
  -- hpc-options:
  -- hsc2hs-options:
  -- hscolour-options:
  -- jhc-options:
  -- ld-options:
  -- pkg-config-options:
  -- runghc-options:
  -- strip-options:
  -- tar-options:
  -- uhc-options:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions