Skip to content

Commit

Permalink
Explicit pkg-config
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishmack committed Sep 4, 2022
1 parent a17863c commit 2611a66
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ in
# any plutus-apps input being used for a
# package.
, evalPackages
, pkgconfSelector ? (_: [])
, ...
}@args:

Expand Down Expand Up @@ -167,6 +168,8 @@ let

index-state-pinned = index-state != null || cabalProjectIndexState != null;

pkgconfPkgs = import ./pkgconf-nixpkgs-map.nix pkgs;

in
assert (if index-state-found == null
then throw "No index state passed and none found in ${cabalProjectFileName}" else true);
Expand Down Expand Up @@ -463,7 +466,8 @@ let
} // pkgs.lib.optionalAttrs (checkMaterialization != null) {
inherit checkMaterialization;
}) (evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal ];
nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal evalPackages.pkgconfig ];
buildInputs = pkgconfSelector pkgconfPkgs;
# Needed or stack-to-nix will die on unicode inputs
LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
LANG = "en_US.UTF-8";
Expand Down
3 changes: 2 additions & 1 deletion lib/pkgconf-nixpkgs-map.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ pkgs:
"sctp" = [ pkgs."lksctp-tools" ]; # This is linux-specific, we should create a common attribute if we ever add sctp support for other systems.
"sdl2" = [ pkgs."SDL2" ];
"sndfile" = [ pkgs."libsndfile" ];
"sodium" = [ pkgs."libsodium" ];
"sodium" = [ pkgs."libsodium".dev ];
"libsodium" = [ pkgs."libsodium".dev ];
"sqlite3" = [ pkgs."sqlite" ];
"ssh2" = [ pkgs."libssh2" ];
"statgrab" = [ pkgs."libstatgrab" ];
Expand Down
4 changes: 4 additions & 0 deletions modules/cabal-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,9 @@ in {
type = nullOr (listOf unspecified);
default = [];
};
pkgconfSelector = mkOption {
type = unspecified;
default = (_: []);
};
};
}
1 change: 1 addition & 0 deletions test/exe-dlls/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let
project = project' {
inherit compiler-nix-name evalPackages;
src = testSrc "exe-dlls";
pkgconfSelector = p: [p.libsodium];
};

packages = project.hsPkgs;
Expand Down
1 change: 1 addition & 0 deletions test/exe-lib-dlls/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let
project = project' {
inherit compiler-nix-name evalPackages;
src = testSrc "exe-lib-dlls";
pkgconfSelector = p: [p.libsodium];
};

packages = project.hsPkgs;
Expand Down
1 change: 1 addition & 0 deletions test/th-dlls/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let
project = project' {
inherit compiler-nix-name evalPackages;
src = testSrc "th-dlls";
pkgconfSelector = p: [p.libsodium];
};

packages = project.hsPkgs;
Expand Down

0 comments on commit 2611a66

Please sign in to comment.