Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix file generated with attribute name containing dots #643

Open
yaitskov opened this issue Feb 6, 2025 · 2 comments
Open

nix file generated with attribute name containing dots #643

yaitskov opened this issue Feb 6, 2025 · 2 comments

Comments

@yaitskov
Copy link

yaitskov commented Feb 6, 2025

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
@sternenseemann
Copy link
Member

This is basically #164. With extra-libraries we have the advantage that cabal2nix can already rewrite the names via libNixName (e.g. for supc++ from #164 (comment), the correct fix is probably to add a mapping to the nixpkgs package in libNixName).

However, I find it questionable having HSrts-ghc9.4.7 in extra-libraries. You should basically never need to do anything so that GHC links the underlying shared library of the rts.

@yaitskov
Copy link
Author

yaitskov commented Feb 7, 2025

You should basically never need to do anything so that GHC links the underlying shared library of the rts.

I develop a dynamic module for Emacs to interpret embedded Haskell via hint library.

Also I guess cabal2nix miss all dependencies if instead of library keyword foreign-library is used, though these sections share most of the children attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants