diff --git a/nix/PaymentServer.nix b/nix/PaymentServer.nix index af085ed41911cae1c49807f6b15ab00d013372dd..846f1c154ce298dbd260aace8830642e29e17484 100644 --- a/nix/PaymentServer.nix +++ b/nix/PaymentServer.nix @@ -77,6 +77,8 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }: (hsPkgs."cryptonite" or (buildDepError "cryptonite")) (hsPkgs."sqlite-simple" or (buildDepError "sqlite-simple")) (hsPkgs."retry" or (buildDepError "retry")) + (hsPkgs."prometheus-client" or (buildDepError "prometheus-client")) + (hsPkgs."servant-prometheus" or (buildDepError "servant-prometheus")) ]; pkgconfig = [ (pkgconfPkgs."libchallenge_bypass_ristretto_ffi" or (pkgConfDepError "libchallenge_bypass_ristretto_ffi")) diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 8997dd1f9c75453787358677081b314ae4262e3a..24d76f5e99175d041360587d5739c7e23a509211 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -5,7 +5,10 @@ "stripe-core" = (((hackage.stripe-core)."2.5.0").revisions).default; "stripe-haskell" = (((hackage.stripe-haskell)."2.5.0").revisions).default; "stripe-http-client" = (((hackage.stripe-http-client)."2.5.0").revisions).default; - } // { PaymentServer = ./PaymentServer.nix; }) // {}; + } // { + PaymentServer = ./PaymentServer.nix; + servant-prometheus = ./servant-prometheus.nix; + }) // {}; }; resolver = "lts-14.1"; } \ No newline at end of file diff --git a/nix/servant-prometheus.nix b/nix/servant-prometheus.nix new file mode 100644 index 0000000000000000000000000000000000000000..fb013289ac659a8bad420e5ef170d2a26517febe --- /dev/null +++ b/nix/servant-prometheus.nix @@ -0,0 +1,112 @@ +let + buildDepError = pkg: + builtins.throw '' + The Haskell package set does not contain the package: ${pkg} (build dependency). + + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; + sysDepError = pkg: + builtins.throw '' + The Nixpkgs package set does not contain the package: ${pkg} (system dependency). + + You may need to augment the system package mapping in haskell.nix so that it can be found. + ''; + pkgConfDepError = pkg: + builtins.throw '' + The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency). + + You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found. + ''; + exeDepError = pkg: + builtins.throw '' + The local executable components do not include the component: ${pkg} (executable dependency). + ''; + legacyExeDepError = pkg: + builtins.throw '' + The Haskell package set does not contain the package: ${pkg} (executable dependency). + + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; + buildToolDepError = pkg: + builtins.throw '' + Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency). + + If this is a system dependency: + You may need to augment the system package mapping in haskell.nix so that it can be found. + + If this is a Haskell dependency: + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. + ''; +in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }: + { + flags = {}; + package = { + specVersion = "1.10"; + identifier = { name = "servant-prometheus"; version = "0.1.0.0"; }; + license = "BSD-3-Clause"; + copyright = ""; + maintainer = "Alex Mason <axman6@gmail.com>, Jack Kelly <jack.kelly@data61.csiro.au>"; + author = "Alex Mason <axman6@gmail.com>, Anchor Engineering <engineering@lists.anchor.net.au>, Servant Contributors"; + homepage = ""; + url = ""; + synopsis = "Helpers for using prometheus with servant"; + description = "Helpers for using prometheus with servant. Each endpoint has its own metrics allowing more detailed monitoring than wai-middleware-prometheus allows"; + buildType = "Simple"; + }; + components = { + "library" = { + depends = [ + (hsPkgs."base" or (buildDepError "base")) + (hsPkgs."prometheus-client" or (buildDepError "prometheus-client")) + (hsPkgs."servant" or (buildDepError "servant")) + (hsPkgs."http-types" or (buildDepError "http-types")) + (hsPkgs."text" or (buildDepError "text")) + (hsPkgs."time" or (buildDepError "time")) + (hsPkgs."unordered-containers" or (buildDepError "unordered-containers")) + (hsPkgs."wai" or (buildDepError "wai")) + (hsPkgs."bytestring" or (buildDepError "bytestring")) + ]; + }; + exes = { + "bench" = { + depends = [ + (hsPkgs."base" or (buildDepError "base")) + (hsPkgs."aeson" or (buildDepError "aeson")) + (hsPkgs."servant-prometheus" or (buildDepError "servant-prometheus")) + (hsPkgs."servant-server" or (buildDepError "servant-server")) + (hsPkgs."prometheus-client" or (buildDepError "prometheus-client")) + (hsPkgs."text" or (buildDepError "text")) + (hsPkgs."wai" or (buildDepError "wai")) + (hsPkgs."warp" or (buildDepError "warp")) + (hsPkgs."process" or (buildDepError "process")) + ]; + }; + }; + tests = { + "spec" = { + depends = [ + (hsPkgs."base" or (buildDepError "base")) + (hsPkgs."aeson" or (buildDepError "aeson")) + (hsPkgs."servant-prometheus" or (buildDepError "servant-prometheus")) + (hsPkgs."servant-server" or (buildDepError "servant-server")) + (hsPkgs."servant-client" or (buildDepError "servant-client")) + (hsPkgs."servant" or (buildDepError "servant")) + (hsPkgs."prometheus-client" or (buildDepError "prometheus-client")) + (hsPkgs."http-client" or (buildDepError "http-client")) + (hsPkgs."text" or (buildDepError "text")) + (hsPkgs."wai" or (buildDepError "wai")) + (hsPkgs."warp" or (buildDepError "warp")) + (hsPkgs."hspec" or (buildDepError "hspec")) + (hsPkgs."unordered-containers" or (buildDepError "unordered-containers")) + (hsPkgs."transformers" or (buildDepError "transformers")) + ]; + }; + }; + }; + } // { + src = (pkgs.lib).mkDefault (pkgs.fetchgit { + url = "https://github.com/PrivateStorageio/servant-prometheus.git"; + rev = "ec21c5ed50e6f6f8e52916ce71cd68fcd0166cad"; + sha256 = "0lswszfs52x5rpf7lj46iv77zghcbr4d05dwssi63yzjll1ixizd"; + }); + } \ No newline at end of file