let's make this a haskell project

- I got fed up with Python in a simple project, why use it again?
This commit is contained in:
towards-a-new-leftypol 2023-10-03 15:08:33 -04:00
parent 506a5dea83
commit 30da2a0247
3 changed files with 30 additions and 33 deletions

View File

@ -1,22 +0,0 @@
from setuptools import setup
requires = [
'aiohttp',
'aiofiles',
'aiodns'
]
setup(
name='chandelorean',
version='0.0.1',
description="Imageboard style forum that lets you time travel. Meant to be an archive.",
classifiers=[
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP",
],
author='Zer0-',
author_email='paul_cockshott@protonmail.com',
packages=['chandelorean'],
include_package_data=True,
install_requires=requires,
)

View File

@ -1,15 +1,34 @@
{ pkgs ? import <nixpkgs> {} }:
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
let
shell = pkgs.mkShell {
buildInputs = with pkgs;
[
python3
postgresql
#python3Packages.regex
inherit (nixpkgs) pkgs;
f = { mkDerivation, base, stdenv, cabal-install,
aeson
}:
mkDerivation {
pname = "chan-delorean";
version = "0.0.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
base safe-exceptions aeson
];
testHaskellDepends = [ cabal-install ];
license = "unknown";
};
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
drv = variant (haskellPackages.callPackage f {
req = req;
});
in
shell
if pkgs.lib.inNixShell then drv.env else drv