modernize shell.nix

This commit is contained in:
nek0 2022-02-03 17:14:13 +01:00
parent c8b4531513
commit 4fbae96e16

View file

@ -1,83 +1,15 @@
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }: { pkgs ? import <nixpkgs> {}}:
let let
# create a modified haskell package set with my package inside it and broken dependencies
inherit (nixpkgs) pkgs; # jailbroken.
hpkgs = pkgs.haskellPackages.override {
pg-transact = with haskellPackages; callPackage( overrides = hself: hsuper: {
{ mkDerivation, async, base, bytestring, exceptions, hspec mateamt = hself.callCabal2nix "mateamt" (gitignore ./.) {};
, hspec-expectations-lifted, lib, monad-control, postgresql-libpq pg-transact = with pkgs.haskell.lib;
, postgresql-simple, tmp-postgres, transformers doJailbreak (unmarkBroken (dontCheck hsuper.pg-transact));
}: };
mkDerivation { };
pname = "pg-transact"; gitignore = dir: pkgs.nix-gitignore.gitignoreSource [] dir;
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 {});
in in
hpkgs.mateamt.env
if pkgs.lib.inNixShell then drv.env else drv