Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
TAGS
dist-newstyle
result
result-*
tags
22 changes: 22 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ mkDerivation, base, bytestring, containers, exceptions, inline-c
, lib, primitive, process, python3-embed, quickcheck-instances, stm
, tasty, tasty-bench, tasty-hunit, tasty-quickcheck
, template-haskell, text, transformers, vector
}:
mkDerivation {
pname = "inline-python";
version = "0.1.1.1";
sha256 = "169f3xa2v53h5pqkc6h34wswyl0y3311xq66jwshxh80ynp37nj3";
libraryHaskellDepends = [
base bytestring containers exceptions inline-c primitive process
quickcheck-instances stm tasty tasty-hunit tasty-quickcheck
template-haskell text transformers vector
];
libraryPkgconfigDepends = [ python3-embed ];
testHaskellDepends = [ base tasty ];
benchmarkHaskellDepends = [ base tasty tasty-bench ];
doHaddock = false;
homepage = "https://github.com/Shimuuar/inline-python";
description = "Python interpreter embedded into haskell";
license = lib.licenses.bsd3;
}
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 113 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
description = "Embedding of python interpreter into haskell programs";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};

outputs = inputs @ {
self,
nixpkgs,
flake-parts,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = builtins.attrNames nixpkgs.legacyPackages;
perSystem = attrs @ {
system,
pkgs,
...
}: let
pkgs = attrs.pkgs.extend self.overlays.default;

py = pkgs.python3.withPackages (py_pkg: with py_pkg;
[ numpy
matplotlib
]);
in {
devShells.default = pkgs.haskellPackages.shellFor {
name = "inline-python-devShell";
packages = p: [p.inline-python];
nativeBuildInputs = with pkgs.haskellPackages; [
pkgs.cabal-install
cabal2nix
haskell-language-server
];
buildInputs = with pkgs; [
py
pkg-config
];

shellHook = ''
export PYTHONHOME=${py}
'';
};

packages = rec {
default = inline-python;
inherit
(pkgs.haskellPackages)
inline-python
;
};

};
flake = {
overlays = {
default = final: prev:
with final.haskell.lib;
with final.lib; let
# NOTE: haskellPackages' so that we don't rebuild the world in the devShell
# due to the overrides
haskellPackages' = prev.haskellPackages.override (old: {
overrides = prev.lib.composeExtensions (old.overrides or (_: _: {})) (
hself: hsuper: {
vector = dontCheck hsuper.vector_0_13_2_0;
primitive = hsuper.primitive_0_9_0_0;
scientific = hsuper.scientific_0_3_8_0;
uuid-types = hsuper.uuid-types_1_0_6;
quickcheck-instances = hsuper.quickcheck-instances_0_3_32;

inline-python = (buildFromSdist (
overrideCabal (hsuper.callPackage ./default.nix {
python3-embed = final.python3;
})
(old: {
configureFlags =
(old.configureFlags or [])
++ [
"--ghc-options=-O2"
"--ghc-options=-j"
"--ghc-options=+RTS"
"--ghc-options=-A256m"
"--ghc-options=-n4m"
"--ghc-options=-RTS"
"--ghc-options=-Wall"
# "--ghc-options=-Werror" # the current version has a bunch of warnings
"--ghc-options=-Wincomplete-uni-patterns"
"--ghc-options=-Wincomplete-record-updates"
"--ghc-options=-Wpartial-fields"
"--ghc-options=-Widentities"
"--ghc-options=-Wredundant-constraints"
"--ghc-options=-Wcpp-undef"
"--ghc-options=-Wunused-packages"
"--ghc-options=-Wno-deprecations"
];
})
));
}
);
});
in {
haskellPackages = prev.haskellPackages.override (old: {
overrides = prev.lib.composeExtensions (old.overrides or (_: _: {})) (
hself: hsuper: {
inline-python = haskellPackages'.inline-python;
});
});
};
};
};
};
}
22 changes: 22 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ mkDerivation, base, bytestring, containers, exceptions, inline-c
, lib, primitive, process, python3-embed, quickcheck-instances, stm
, tasty, tasty-bench, tasty-hunit, tasty-quickcheck
, template-haskell, text, transformers, vector
}:
mkDerivation {
pname = "inline-python";
version = "0.1.1.1";
sha256 = "169f3xa2v53h5pqkc6h34wswyl0y3311xq66jwshxh80ynp37nj3";
libraryHaskellDepends = [
base bytestring containers exceptions inline-c primitive process
quickcheck-instances stm tasty tasty-hunit tasty-quickcheck
template-haskell text transformers vector
];
libraryPkgconfigDepends = [ python3-embed ];
testHaskellDepends = [ base tasty ];
benchmarkHaskellDepends = [ base tasty tasty-bench ];
doHaddock = false;
homepage = "https://github.com/Shimuuar/inline-python";
description = "Python interpreter embedded into haskell";
license = lib.licenses.bsd3;
}
17 changes: 0 additions & 17 deletions shell.nix

This file was deleted.

Loading