How to include packages from pkgs?
I have project with stack.yaml:
resolver: lts-14.7
packages:
- '.'
nix:
packages: [
bzip2
icu
libcxx
lzma
mysql80
pcre
pkg-config
postgresql
zlib
]
When I use stack-to-nix, it does not consider for the nix section of stack.yaml, so the build fails with mysql_config not found error. How I can add this packages to default.nix?
@miuirussia I assume you figure out how to fix this? It is true that stack-to-nix ignores the nix section. stack-to-nix just translates the lts + packages into a build plan. Haskell.nix pulls system packages from nixpkgs by default.
Anyway if you figured out how to fix this in a way that works for you, and could let us know that would be great!
I added packages manually with modules section in default.nix, maybe it would be great if stack-to-nix do it automatically.
@miuirussia patches welcome! stack-to-nix lives in github.com/input-output-hk/nix-tools, the binaries are all pretty simple haskell programs.
I added packages manually with
modulessection indefault.nix, maybe it would be great ifstack-to-nixdo it automatically.
@miuirussia can you tell me how exactly you added it to modules? I'm running into the same issue and cannot figure out how to add it properly. thanks
I have the same problem with mysql_config, did you ever figure it out @JorisM ? I tried all of the below options I could find in the documentation but no luck:
packages.mysql.components.library.libs = [pkgs.mysql];
packages.mysql.components.setup.libs = [pkgs.mysql];
packages.mysql.components.library.build-tools = [pkgs.mysql];
packages.mysql.components.setup.build-tools = [pkgs.mysql];
packages.mysql.components.foreignlibs.build-tools = [pkgs.mysql];
packages.mysql.components.sublibs.build-tools = [pkgs.mysql];
Never mind, I was just having confusion from using a nixpkgs version where mysql didn't provide the mysql_config binary. The modules command that worked was
packages.mysql.components.library.build-tools = [pkgs.mysql];
@thomasjm awesome!
(Also, if you are on newer nixpkgs, you might need pkgs.libmysqlclient instead.)
IMO this issue can be closed, but it would be great if there were a page in the documentation about this. There are a bewildering number of options in the "Module options" section of the docs, and it's not always obvious how they map to the final Nix expressions. I had to go digging into the haskell.nix code to confirm my understanding that build-tools options end up turning into nativeBuildInputs.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
So we need to add docs that indicate that if you need to add to a components buildInputs use .libs and if you need to add to nativeBuildInputs use .build-tools.