mirror of
https://github.com/input-output-hk/devx.git
synced 2024-09-11 04:15:30 +03:00
Expose CABAL_PROJECT_LOCAL_TEMPLATE
as a /nix/store/
file (#97)
This commit is contained in:
parent
91cba01b90
commit
3fef25f46e
11
cross-js.nix
11
cross-js.nix
@ -35,6 +35,7 @@ let tool-version-map = import ./tool-map.nix;
|
||||
${compiler}/bin/${compiler.targetPrefix}hsc2hs --cross-compile "$@"
|
||||
'';
|
||||
};
|
||||
quirks = (import ./quirks.nix { inherit pkgs; });
|
||||
in
|
||||
pkgs.mkShell ({
|
||||
# Note [cabal override]:
|
||||
@ -58,13 +59,7 @@ pkgs.mkShell ({
|
||||
];
|
||||
# hardeningDisable = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isMusl [ "format" "pie" ];
|
||||
|
||||
CABAL_PROJECT_LOCAL_TEMPLATE = with pkgs; ''
|
||||
package digest
|
||||
constraints:
|
||||
HsOpenSSL +use-pkg-config,
|
||||
zlib +pkg-config
|
||||
pcre-lite +pkg-config
|
||||
'';
|
||||
inherit (quirks) CABAL_PROJECT_LOCAL_TEMPLATE;
|
||||
|
||||
shellHook = with pkgs; ''
|
||||
export PS1="\[\033[01;33m\][\w]$\[\033[00m\] "
|
||||
@ -73,7 +68,7 @@ pkgs.mkShell ({
|
||||
echo "Revision (input-output-hk/devx): ${if self ? rev then self.rev else "unknown/dirty checkout"}."
|
||||
export CABAL_DIR=$HOME/.cabal-js
|
||||
echo "CABAL_DIR set to $CABAL_DIR"
|
||||
'';
|
||||
'' + quirks.shellHook;
|
||||
buildInputs = [];
|
||||
|
||||
nativeBuildInputs = [ wrapped-hsc2hs wrapped-cabal compiler ] ++ (with pkgs; [
|
||||
|
@ -115,7 +115,7 @@ let tool-version-map = import ./tool-map.nix;
|
||||
)
|
||||
WINEPATH=$DLLS WINEDLLOVERRIDES="winemac.drv=d" WINEDEBUG=warn-all,fixme-all,-menubuilder,-mscoree,-ole,-secur32,-winediag WINEPREFIX=$TMP ${pkgs.pkgsBuildBuild.winePackages.minimal}/bin/wine64 "$@"
|
||||
'';
|
||||
|
||||
quirks = (import ./quirks.nix { inherit pkgs; });
|
||||
in
|
||||
pkgs.pkgsBuildBuild.mkShell ({
|
||||
# Note [cabal override]:
|
||||
@ -141,12 +141,7 @@ pkgs.pkgsBuildBuild.mkShell ({
|
||||
# "--enable-executable-static"
|
||||
];
|
||||
|
||||
CABAL_PROJECT_LOCAL_TEMPLATE = ''
|
||||
constraints:
|
||||
HsOpenSSL +use-pkg-config,
|
||||
zlib +pkg-config,
|
||||
pcre-lite +pkg-config
|
||||
'';
|
||||
inherit (quirks) CABAL_PROJECT_LOCAL_TEMPLATE;
|
||||
|
||||
shellHook = with pkgs; ''
|
||||
export PS1="\[\033[01;33m\][\w]$\[\033[00m\] "
|
||||
@ -155,7 +150,7 @@ pkgs.pkgsBuildBuild.mkShell ({
|
||||
echo "Revision (input-output-hk/devx): ${if self ? rev then self.rev else "unknown/dirty checkout"}."
|
||||
export CABAL_DIR=$HOME/.cabal-windows
|
||||
echo "CABAL_DIR set to $CABAL_DIR"
|
||||
'';
|
||||
'' + quirks.shellHook;
|
||||
buildInputs = [];
|
||||
|
||||
nativeBuildInputs = [ wrapped-ghc wrapped-hsc2hs wrapped-cabal wine-test-wrapper compiler ] ++ (with pkgs; [
|
||||
|
17
flake.nix
17
flake.nix
@ -61,6 +61,13 @@
|
||||
#
|
||||
# nix develop github:input-output-hk/devx#ghc924 --no-write-lock-file -c cabal build
|
||||
#
|
||||
static-pkgs = if pkgs.stdenv.hostPlatform.isLinux
|
||||
then if pkgs.stdenv.hostPlatform.isAarch64
|
||||
then pkgs.pkgsCross.aarch64-multiplatform-musl
|
||||
else pkgs.pkgsCross.musl64
|
||||
else pkgs;
|
||||
js-pkgs = pkgs.pkgsCross.ghcjs;
|
||||
windows-pkgs = pkgs.pkgsCross.mingwW64;
|
||||
devShellsWithToolsModule = toolsModule:
|
||||
let compilers = pkgs: builtins.removeAttrs pkgs.haskell-nix.compiler
|
||||
# Exclude old versions of GHC to speed up `nix flake check`
|
||||
@ -85,13 +92,6 @@
|
||||
(builtins.removeAttrs (compilers pkgs)
|
||||
[
|
||||
]);
|
||||
static-pkgs = if pkgs.stdenv.hostPlatform.isLinux
|
||||
then if pkgs.stdenv.hostPlatform.isAarch64
|
||||
then pkgs.pkgsCross.aarch64-multiplatform-musl
|
||||
else pkgs.pkgsCross.musl64
|
||||
else pkgs;
|
||||
js-pkgs = pkgs.pkgsCross.ghcjs;
|
||||
windows-pkgs = pkgs.pkgsCross.mingwW64;
|
||||
in (builtins.mapAttrs (compiler-nix-name: compiler:
|
||||
import ./dynamic.nix { inherit pkgs self compiler compiler-nix-name toolsModule; withIOG = false; }
|
||||
) (compilers pkgs)
|
||||
@ -202,6 +202,9 @@
|
||||
};
|
||||
})) devShellsWithEvalOnLinux) // {
|
||||
};
|
||||
packages.cabalProjectLocal.static = (import ./quirks.nix { pkgs = static-pkgs; static = true; }).template;
|
||||
packages.cabalProjectLocal.cross-js = (import ./quirks.nix { pkgs = js-pkgs; }).template;
|
||||
packages.cabalProjectLocal.cross-windows = (import ./quirks.nix { pkgs = windows-pkgs; }).template;
|
||||
});
|
||||
|
||||
# --- Flake Local Nix Configuration ----------------------------
|
||||
|
22
quirks.nix
Normal file
22
quirks.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ pkgs, static ? false }: rec {
|
||||
CABAL_PROJECT_LOCAL_TEMPLATE = with pkgs; ''
|
||||
package digest
|
||||
${if static then "extra-lib-dirs: ${zlib}/lib ${pcre}/lib" else ""}
|
||||
constraints:
|
||||
HsOpenSSL +use-pkg-config,
|
||||
zlib +pkg-config,
|
||||
pcre-lite +pkg-config
|
||||
'';
|
||||
template = pkgs.writeTextFile {
|
||||
name = "cabal.project.local";
|
||||
text = CABAL_PROJECT_LOCAL_TEMPLATE;
|
||||
};
|
||||
shellHook = ''
|
||||
echo "Quirks:"
|
||||
echo -e "\tif you have the zlib, HsOpenSSL, or digest package in your dependency tree, please make sure to"
|
||||
echo -e "\tcat ${template} >> cabal.project.local"
|
||||
function patchProjectLocal() {
|
||||
cat ${template} >> "$1"
|
||||
}
|
||||
'';
|
||||
}
|
16
static.nix
16
static.nix
@ -50,6 +50,7 @@ let tool-version-map = import ./tool-map.nix;
|
||||
esac
|
||||
'';
|
||||
};
|
||||
quirks = (import ./quirks.nix { inherit pkgs; static = true; });
|
||||
in
|
||||
pkgs.mkShell (rec {
|
||||
# Note [cabal override]:
|
||||
@ -73,14 +74,7 @@ pkgs.mkShell (rec {
|
||||
];
|
||||
hardeningDisable = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isMusl [ "format" "pie" ];
|
||||
|
||||
CABAL_PROJECT_LOCAL_TEMPLATE = with pkgs; ''
|
||||
package digest
|
||||
extra-lib-dirs: ${zlib}/lib ${pcre}/lib
|
||||
constraints:
|
||||
HsOpenSSL +use-pkg-config,
|
||||
zlib +pkg-config,
|
||||
pcre-lite +pkg-config
|
||||
'';
|
||||
inherit (quirks) CABAL_PROJECT_LOCAL_TEMPLATE;
|
||||
|
||||
# This is required to prevent
|
||||
#
|
||||
@ -102,11 +96,7 @@ pkgs.mkShell (rec {
|
||||
export CABAL_DIR=$HOME/.cabal-static
|
||||
echo "CABAL_DIR set to $CABAL_DIR"
|
||||
echo "DYLD_LIBRARY_PATH set to $DYLD_LIBRARY_PATH"
|
||||
echo "Quirks:"
|
||||
echo -e "\tif you have the zlib, HsOpenSSL, or digest package in your dependency tree, please make sure to"
|
||||
echo -e "\techo \"\$CABAL_PROJECT_LOCAL_TEMPLATE\" > cabal.project.local"
|
||||
'';
|
||||
|
||||
'' + quirks.shellHook;
|
||||
# these are _target_ libs, e.g. ones we want to link the build
|
||||
# product against. These are also the ones that showup in the
|
||||
# PKG_CONFIG_PATH.
|
||||
|
Loading…
Reference in New Issue
Block a user