modernize shell.nix

This commit is contained in:
nek0 2022-02-03 17:14:13 +01:00
parent c8b4531513
commit 4fbae96e16
1 changed files with 12 additions and 80 deletions

View File

@ -1,83 +1,15 @@
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
{ pkgs ? import <nixpkgs> {}}:
let
inherit (nixpkgs) pkgs;
pg-transact = with haskellPackages; callPackage(
{ mkDerivation, async, base, bytestring, exceptions, hspec
, hspec-expectations-lifted, lib, monad-control, postgresql-libpq
, postgresql-simple, tmp-postgres, transformers
}:
mkDerivation {
pname = "pg-transact";
version = "0.3.1.1";
sha256 = "8d5d61ebafdcb8e94d563e74bc9646519e45a2fddf327a708b0a59e5160c20fc";
libraryHaskellDepends = [
base bytestring exceptions monad-control postgresql-simple
transformers
];
testHaskellDepends = [
async base bytestring exceptions hspec hspec-expectations-lifted
postgresql-libpq postgresql-simple tmp-postgres
];
doCheck = false;
homepage = "https://github.com/jfischoff/pg-transact#readme";
description = "A postgresql-simple transaction monad";
license = lib.licenses.bsd3;
}) {};
f = { mkDerivation, aeson, base, base16-bytestring
, base64-bytestring, bytestring, case-insensitive, clock
, containers, directory, extra, haskell-gettext, hspec
, hspec-discover, hspec-wai, hspec-wai-json, http-api-data
, http-types, iproute, lib, libyaml, mime-mail, mtl, network, opaleye
, optparse-applicative, postgresql-simple
, postgresql-simple-migration, product-profunctors, profunctors
, pureMD5, random-bytestring, resource-pool, servant, servant-rawm
, servant-rawm-server, servant-server, stm, text, time
, tmp-postgres, wai, wai-logger, wai-middleware-throttle, warp
, yaml
}:
mkDerivation {
pname = "mateamt";
version = "0.0.0.0";
src = ./.;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson base base16-bytestring base64-bytestring bytestring
containers directory extra haskell-gettext http-api-data http-types
libyaml mime-mail mtl opaleye postgresql-simple product-profunctors
profunctors pureMD5 random-bytestring servant servant-rawm
servant-rawm-server servant-server stm text time wai wai-logger
warp
];
executableHaskellDepends = [
base base16-bytestring bytestring case-insensitive clock containers
iproute mtl network opaleye optparse-applicative postgresql-simple
postgresql-simple-migration servant servant-server stm text time
wai wai-logger wai-middleware-throttle warp yaml
];
testHaskellDepends = [
base bytestring containers hspec hspec-wai hspec-wai-json mtl
pg-transact postgresql-simple resource-pool text time tmp-postgres
wai warp
];
testToolDepends = [ hspec-discover ];
homepage = "https://gitea.nek0.eu/nek0/mateamt/";
description = "A whole new matemat";
license = lib.licenses.agpl3Plus;
};
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 {});
# create a modified haskell package set with my package inside it and broken dependencies
# jailbroken.
hpkgs = pkgs.haskellPackages.override {
overrides = hself: hsuper: {
mateamt = hself.callCabal2nix "mateamt" (gitignore ./.) {};
pg-transact = with pkgs.haskell.lib;
doJailbreak (unmarkBroken (dontCheck hsuper.pg-transact));
};
};
gitignore = dir: pkgs.nix-gitignore.gitignoreSource [] dir;
in
if pkgs.lib.inNixShell then drv.env else drv
hpkgs.mateamt.env