Skip to content

nix file generated with attribute name containing dots #643

@yaitskov

Description

@yaitskov

Hi,

if cabal contains line:

   extra-libraries:  HSrts-ghc9.4.7

cabal2nix generates following nix:

     error: syntax error, unexpected FLOAT_LIT, expecting '}'
       at /nix/store/3hxh6fwnqhbkgghf77gr3l5ibss5rrki-cabal2nix-foo/default.nix:1:45:
            1| { mkDerivation, base, containers, HSrts-ghc9.4.7, lib, mtl
             |                                             ^

Is it possible to replace dots with underbar or exclude form pattern matching problematic name?

cabal build resolves rts dependency somehow even when nix-shell is called with commented extra-libraries line and uncommented before cabal run.

Current workaround:

cabal:

extra-source-files:  configure
extra-tmp-files:      eval.buildinfo
build-type:              Configure

configure:

#!/bin/sh

while [ $# -ne 0 ]; do
    case $1 in
        --with-compiler=*)
            v=`${1#--with-compiler=} --numeric-version`
            cat > eval.buildinfo <<EOF
extra-libraries: HSrts-ghc$v
EOF
            break
        ;;
        *)
            shift
    esac
done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions