Skip to content

Commit 2611a66

Browse files
committed
Explicit pkg-config
1 parent a17863c commit 2611a66

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

lib/call-cabal-project-to-nix.nix

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ in
6666
# any plutus-apps input being used for a
6767
# package.
6868
, evalPackages
69+
, pkgconfSelector ? (_: [])
6970
, ...
7071
}@args:
7172

@@ -167,6 +168,8 @@ let
167168

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

171+
pkgconfPkgs = import ./pkgconf-nixpkgs-map.nix pkgs;
172+
170173
in
171174
assert (if index-state-found == null
172175
then throw "No index state passed and none found in ${cabalProjectFileName}" else true);
@@ -463,7 +466,8 @@ let
463466
} // pkgs.lib.optionalAttrs (checkMaterialization != null) {
464467
inherit checkMaterialization;
465468
}) (evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
466-
nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal ];
469+
nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal evalPackages.pkgconfig ];
470+
buildInputs = pkgconfSelector pkgconfPkgs;
467471
# Needed or stack-to-nix will die on unicode inputs
468472
LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
469473
LANG = "en_US.UTF-8";

lib/pkgconf-nixpkgs-map.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ pkgs:
143143
"sctp" = [ pkgs."lksctp-tools" ]; # This is linux-specific, we should create a common attribute if we ever add sctp support for other systems.
144144
"sdl2" = [ pkgs."SDL2" ];
145145
"sndfile" = [ pkgs."libsndfile" ];
146-
"sodium" = [ pkgs."libsodium" ];
146+
"sodium" = [ pkgs."libsodium".dev ];
147+
"libsodium" = [ pkgs."libsodium".dev ];
147148
"sqlite3" = [ pkgs."sqlite" ];
148149
"ssh2" = [ pkgs."libssh2" ];
149150
"statgrab" = [ pkgs."libstatgrab" ];

modules/cabal-project.nix

+4
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,9 @@ in {
130130
type = nullOr (listOf unspecified);
131131
default = [];
132132
};
133+
pkgconfSelector = mkOption {
134+
type = unspecified;
135+
default = (_: []);
136+
};
133137
};
134138
}

test/exe-dlls/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let
77
project = project' {
88
inherit compiler-nix-name evalPackages;
99
src = testSrc "exe-dlls";
10+
pkgconfSelector = p: [p.libsodium];
1011
};
1112

1213
packages = project.hsPkgs;

test/exe-lib-dlls/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let
77
project = project' {
88
inherit compiler-nix-name evalPackages;
99
src = testSrc "exe-lib-dlls";
10+
pkgconfSelector = p: [p.libsodium];
1011
};
1112

1213
packages = project.hsPkgs;

test/th-dlls/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let
77
project = project' {
88
inherit compiler-nix-name evalPackages;
99
src = testSrc "th-dlls";
10+
pkgconfSelector = p: [p.libsodium];
1011
};
1112

1213
packages = project.hsPkgs;

0 commit comments

Comments
 (0)