Haven’t used pkgconfig-depends before, doesn’t using extra-libraries work?
here’s an example cabal and nix configuration respectively, might be helpful:
https://github.com/juspay/superposition/blob/5b8410ea776a1758309b927ff2ab8b5370774431/clients/haskell/hs-exp-client/hs-exp-client.cabal#L114-L115
https://github.com/juspay/superposition/blob/5b8410ea776a1758309b927ff2ab8b5370774431/clients/haskell/default.nix#L8
yeah just addinglibavcodec.custom = _: pkgs.ffmpeg.lib;
to settings
worked
Perigord has marked this topic as resolved.
Hello cool nix people : )
I'm trying to use a non-haskell dependency and failing. To make it simpler I'm using pkgs.cowsay
as the executable I want to run on my haskell code with:
cowsay :: IO String
cowsay = do
(_, mhout, _, _) <- createProcess (shell ("cowsay hola")) { std_out = CreatePipe }
case mhout of
Just hout -> hGetContents hout
Nothing -> pure "mhout failed"
I've added to the corresponding cabal executable stanza build-tools: cowsay
(also tried with extra-libraries
but that just complained of not being a good C library)
This is my whole flake:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
hvm.url = "github:hhefesto/HVM";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = inputs@{ self, nixpkgs, flake-compat, hvm, flake-parts, haskell-flake, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
imports = [ inputs.haskell-flake.flakeModule ];
perSystem = { self', system, pkgs, ... }: {
haskellProjects.default = {
basePackages = pkgs.haskell.packages.ghc92;
settings = {
cowsay.custom = _: pkgs.cowsay;
telomare = {
extraBuildDepends = [ pkgs.cowsay
];
};
};
devShell = {
enable = true;
};
};
packages.default = self'.packages.telomare;
apps.default = {
type = "app";
program = self.packages.${system}.telomare + "/bin/telomare";
};
apps.repl = {
type = "app";
program = self.packages.${system}.telomare + "/bin/telomare-repl";
};
};
};
}
n.b. in settings
I've added cowsay.custom = _: pkgs.cowsay;
and also triedsettings.telomare.extraBuildDepends = [ pkgs.cowsay ];
To test it you just have to nix run .
for the flake-parts
branch in https://github.com/hhefesto/stand-in-language/tree/flake-parts
Am I doing something wrong?
Forgot to add the error:
$ nix run .
/bin/sh: line 1: cowsay: command not found
Last updated: Jan 13 2025 at 23:14 UTC