Skip to content

Adds staticWhich and python3.WithPackages to ensure python at runtime #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 27 additions & 24 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
{ mkDerivation, ad, aeson, base, bytestring, containers
, deepseq, directory, filepath, lib, process, random
, raw-strings-qq, split, tasty, tasty-expected-failure
, tasty-golden, tasty-hunit, temporary, which, pkgs
}:
let
sources = import nix/sources.nix {};
haskell-nix = (import sources."haskell.nix" {});
nixpkgs = haskell-nix.pkgs;
gitignore = (import sources."gitignore.nix" {
inherit (nixpkgs) lib;
}).gitignoreSource;

src = nixpkgs.lib.cleanSourceWith {
name = "matplotlib";
src = gitignore ./.;
};
python = pkgs.python3.withPackages (p: with p; [
matplotlib
numpy
scipy
]);
in
nixpkgs.haskell-nix.stackProject {
inherit src;
modules = [({pkgs, ...}: {
packages.matplotlib.components.library.build-tools =
[ pkgs.buildPackages.python39Packages.matplotlib
pkgs.buildPackages.python39Packages.scipy
pkgs.buildPackages.texlive.combined.scheme-small ];
packages.matplotlib.components.tests.matplotlib-test.build-tools =
[ pkgs.buildPackages.python39Packages.matplotlib
pkgs.buildPackages.python39Packages.scipy
pkgs.buildPackages.texlive.combined.scheme-small ];
doHaddock = false;
})];
mkDerivation {
pname = "matplotlib";
version = "0.7.7";
src = ./.;
libraryHaskellDepends = [
aeson base bytestring containers deepseq filepath process split
temporary which
];
testHaskellDepends = [
ad base bytestring directory process random raw-strings-qq split
tasty tasty-expected-failure tasty-golden tasty-hunit temporary
];
librarySystemDepends = [ python which ];
testSystemDepends = [ python which ];
homepage = "https://github.com/abarbu/matplotlib-haskell";
description = "Bindings to Matplotlib; a Python plotting library";
license = lib.licenses.bsd3;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module Paths_matplotlib (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where


import qualified Control.Exception as Exception
import qualified Data.List as List
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude


#if defined(VERSION_base)

#if MIN_VERSION_base(4,0,0)
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#else
catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
#endif

#else
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#endif
catchIO = Exception.catch

version :: Version
version = Version [0,7,7] []

getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir `joinFileName` name)

getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath



bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "/home/lazylambda/.cabal/bin"
libdir = "/home/lazylambda/.cabal/lib/x86_64-linux-ghc-8.10.7/matplotlib-0.7.7-inplace"
dynlibdir = "/home/lazylambda/.cabal/lib/x86_64-linux-ghc-8.10.7"
datadir = "/home/lazylambda/.cabal/share/x86_64-linux-ghc-8.10.7/matplotlib-0.7.7"
libexecdir = "/home/lazylambda/.cabal/libexec/x86_64-linux-ghc-8.10.7/matplotlib-0.7.7"
sysconfdir = "/home/lazylambda/.cabal/etc"

getBinDir = catchIO (getEnv "matplotlib_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "matplotlib_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "matplotlib_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "matplotlib_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "matplotlib_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "matplotlib_sysconfdir") (\_ -> return sysconfdir)




joinFileName :: String -> String -> FilePath
joinFileName "" fname = fname
joinFileName "." fname = fname
joinFileName dir "" = dir
joinFileName dir fname
| isPathSeparator (List.last dir) = dir ++ fname
| otherwise = dir ++ pathSeparator : fname

pathSeparator :: Char
pathSeparator = '/'

isPathSeparator :: Char -> Bool
isPathSeparator c = c == '/'
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */

/* package matplotlib-0.7.7 */
#ifndef VERSION_matplotlib
#define VERSION_matplotlib "0.7.7"
#endif /* VERSION_matplotlib */
#ifndef MIN_VERSION_matplotlib
#define MIN_VERSION_matplotlib(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 7 || \
(major1) == 0 && (major2) == 7 && (minor) <= 7)
#endif /* MIN_VERSION_matplotlib */
/* package aeson-1.5.6.0 */
#ifndef VERSION_aeson
#define VERSION_aeson "1.5.6.0"
#endif /* VERSION_aeson */
#ifndef MIN_VERSION_aeson
#define MIN_VERSION_aeson(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 5 || \
(major1) == 1 && (major2) == 5 && (minor) <= 6)
#endif /* MIN_VERSION_aeson */
/* package base-4.14.3.0 */
#ifndef VERSION_base
#define VERSION_base "4.14.3.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 14 || \
(major1) == 4 && (major2) == 14 && (minor) <= 3)
#endif /* MIN_VERSION_base */
/* package bytestring-0.10.12.0 */
#ifndef VERSION_bytestring
#define VERSION_bytestring "0.10.12.0"
#endif /* VERSION_bytestring */
#ifndef MIN_VERSION_bytestring
#define MIN_VERSION_bytestring(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 10 || \
(major1) == 0 && (major2) == 10 && (minor) <= 12)
#endif /* MIN_VERSION_bytestring */
/* package containers-0.6.5.1 */
#ifndef VERSION_containers
#define VERSION_containers "0.6.5.1"
#endif /* VERSION_containers */
#ifndef MIN_VERSION_containers
#define MIN_VERSION_containers(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 6 || \
(major1) == 0 && (major2) == 6 && (minor) <= 5)
#endif /* MIN_VERSION_containers */
/* package deepseq-1.4.4.0 */
#ifndef VERSION_deepseq
#define VERSION_deepseq "1.4.4.0"
#endif /* VERSION_deepseq */
#ifndef MIN_VERSION_deepseq
#define MIN_VERSION_deepseq(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 4 || \
(major1) == 1 && (major2) == 4 && (minor) <= 4)
#endif /* MIN_VERSION_deepseq */
/* package filepath-1.4.2.1 */
#ifndef VERSION_filepath
#define VERSION_filepath "1.4.2.1"
#endif /* VERSION_filepath */
#ifndef MIN_VERSION_filepath
#define MIN_VERSION_filepath(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 4 || \
(major1) == 1 && (major2) == 4 && (minor) <= 2)
#endif /* MIN_VERSION_filepath */
/* package process-1.6.13.2 */
#ifndef VERSION_process
#define VERSION_process "1.6.13.2"
#endif /* VERSION_process */
#ifndef MIN_VERSION_process
#define MIN_VERSION_process(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 13)
#endif /* MIN_VERSION_process */
/* package split-0.2.3.4 */
#ifndef VERSION_split
#define VERSION_split "0.2.3.4"
#endif /* VERSION_split */
#ifndef MIN_VERSION_split
#define MIN_VERSION_split(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 2 || \
(major1) == 0 && (major2) == 2 && (minor) <= 3)
#endif /* MIN_VERSION_split */
/* package temporary-1.3 */
#ifndef VERSION_temporary
#define VERSION_temporary "1.3"
#endif /* VERSION_temporary */
#ifndef MIN_VERSION_temporary
#define MIN_VERSION_temporary(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 3 || \
(major1) == 1 && (major2) == 3 && (minor) <= 0)
#endif /* MIN_VERSION_temporary */
/* package which-0.2.0.1 */
#ifndef VERSION_which
#define VERSION_which "0.2.0.1"
#endif /* VERSION_which */
#ifndef MIN_VERSION_which
#define MIN_VERSION_which(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 2 || \
(major1) == 0 && (major2) == 2 && (minor) <= 0)
#endif /* MIN_VERSION_which */

/* tool gcc-10.3.0 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "10.3.0"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 10 || \
(major1) == 10 && (major2) < 3 || \
(major1) == 10 && (major2) == 3 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-8.10.7 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "8.10.7"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 10 || \
(major1) == 8 && (major2) == 10 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-8.10.7 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "8.10.7"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 10 || \
(major1) == 8 && (major2) == 10 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.24.2 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.24.2"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 24 || \
(major1) == 2 && (major2) == 24 && (minor) <= 2)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool hpc-0.68 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.68"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.7 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.7"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool runghc-8.10.7 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "8.10.7"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 10 || \
(major1) == 8 && (major2) == 10 && (minor) <= 7)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.35 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.35"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 35 || \
(major1) == 2 && (major2) == 35 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */

#ifndef CURRENT_PACKAGE_KEY
#define CURRENT_PACKAGE_KEY "matplotlib-0.7.7-inplace"
#endif /* CURRENT_packageKey */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "matplotlib-0.7.7-inplace"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.7.7"
#endif /* CURRENT_PACKAGE_VERSION */
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added dist-newstyle/cache/compiler
Binary file not shown.
Binary file added dist-newstyle/cache/config
Binary file not shown.
Binary file added dist-newstyle/cache/elaborated-plan
Binary file not shown.
Binary file added dist-newstyle/cache/improved-plan
Binary file not shown.
1 change: 1 addition & 0 deletions dist-newstyle/cache/plan.json

Large diffs are not rendered by default.

Binary file added dist-newstyle/cache/solver-plan
Binary file not shown.
Binary file added dist-newstyle/cache/source-hashes
Binary file not shown.
Binary file added dist-newstyle/cache/up-to-date
Binary file not shown.
Binary file added dist-newstyle/packagedb/ghc-8.10.7/package.cache
Binary file not shown.
Empty file.
2 changes: 2 additions & 0 deletions matplotlib.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ library
, temporary
, containers
, split
, which
, filepath
default-language: Haskell2010

Expand All @@ -53,6 +54,7 @@ test-suite matplotlib-test
, raw-strings-qq
, split
, ad
, which
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010

Expand Down
27 changes: 15 additions & 12 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
(import ./default.nix).shellFor {
tools = {
cabal = "latest";
hpack = "latest";
hlint = "latest";
ormolu = "latest";
haskell-language-server = "latest";
};
{ nixpkgs ? import <nixpkgs> {}
, compiler ? "default"
, doBenchmark ? false }:

# Prevents cabal from choosing alternate plans, so that
# *all* dependencies are provided by Nix.
exactDeps = true;
}
let
inherit (nixpkgs) pkgs;
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};

variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
matplotlib = import ./default.nix;
drv = variant (haskellPackages.callPackage matplotlib {});

in
if pkgs.lib.inNixShell then drv.env else drv
Loading