Skip to content

Instantly share code, notes, and snippets.

@Rotaerk
Created April 2, 2018 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rotaerk/e3825879bb53ccec06f4c2a1e3b9ab4a to your computer and use it in GitHub Desktop.
Save Rotaerk/e3825879bb53ccec06f4c2a1e3b9ab4a to your computer and use it in GitHub Desktop.
{ refsWithLocalSource ? [] }:
let
project = "vulkanTest";
enableProfiling = true;
refs = import ./refs.nix;
pkgs = (refs { inherit refsWithLocalSource; }).sourceImports.nixpkgs {};
inherit (refs { inherit refsWithLocalSource pkgs; }) sources sourceImports sourceOverrides;
inherit (pkgs.haskell.lib) overrideCabal;
haskellPackages =
pkgs.haskellPackages.override {
overrides = self: super: {
mkDerivation = args: super.mkDerivation (args // {
enableLibraryProfiling = enableProfiling;
enableExecutableProfiling = enableProfiling;
});
HUnit =
# One of HUnit's tests fails when profiling is enabled. This is a workaround.
if enableProfiling then
super.HUnit.overrideAttrs (oldAttrs: { doCheck = false; })
else
super.HUnit;
vulkan-api = overrideCabal super.vulkan-api (drv: {
librarySystemDepends = [ pkgs.vulkan-loader ];
});
bindings-GLFW = sourceOverrides.bindings-GLFW "3.2.1.0" super.bindings-GLFW;
GLFW-b = sourceOverrides.GLFW-b "1.4.9.0" super.GLFW-b;
};
};
in
(
overrideCabal
(haskellPackages.callCabal2nix "${project}" ./. {})
(drv: {
src = builtins.filterSource (path: type: baseNameOf path != ".git") drv.src;
})
)
.overrideAttrs (oldAttrs: rec {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.vulkan-loader ];
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment