From 5577eb28c4b8ddd759da5b37254cd1f354a61fac Mon Sep 17 00:00:00 2001 From: Vaibhav Sagar Date: Mon, 29 Jan 2024 01:35:14 +1100 Subject: [PATCH] Add overrides for `opentelemetry-plugin` --- flake.lock | 84 ++++++++++++++++++++++++++++- flake.nix | 28 ++++++++-- ghc-parser/ghc-parser.cabal | 5 +- ihaskell.cabal | 5 +- ipython-kernel/ipython-kernel.cabal | 4 +- 5 files changed, 119 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 34ffbc4a..7bf1ff26 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,17 @@ { "nodes": { + "all-cabal-hashes": { + "flake": false, + "locked": { + "narHash": "sha256-gEL/53v6/8oU2beexEAKFkZFDoTSbMKia7JZBmE+okM=", + "type": "file", + "url": "https://api.github.com/repos/commercialhaskell/all-cabal-hashes/tarball/c314b1bfabd37d30d2f315a5a322323ebbd98acb" + }, + "original": { + "type": "file", + "url": "https://api.github.com/repos/commercialhaskell/all-cabal-hashes/tarball/c314b1bfabd37d30d2f315a5a322323ebbd98acb" + } + }, "flake-compat": { "flake": false, "locked": { @@ -135,13 +147,50 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1685566663, + "narHash": "sha256-btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4ecab3273592f27479a583fb6d975d4aba3486fe", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "opentelemetry-plugin": { + "inputs": { + "all-cabal-hashes": "all-cabal-hashes", + "nixpkgs": "nixpkgs_2", + "utils": "utils" + }, + "locked": { + "lastModified": 1702939471, + "narHash": "sha256-pBWyFh6gjtJvrLUoCNMpy0EARUPynUZNrGGLPDvKjQE=", + "owner": "MercuryTechnologies", + "repo": "opentelemetry-plugin", + "rev": "f820961fbf148c4191b9f73fd6c5662ee9392d63", + "type": "github" + }, + "original": { + "owner": "MercuryTechnologies", + "repo": "opentelemetry-plugin", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", "hls": "hls", "nix-filter": "nix-filter", "nixpkgs23_11": "nixpkgs23_11", - "nixpkgsMaster": "nixpkgsMaster" + "nixpkgsMaster": "nixpkgsMaster", + "opentelemetry-plugin": "opentelemetry-plugin" } }, "systems": { @@ -173,6 +222,39 @@ "repo": "default", "type": "github" } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 591d70d7..23495e20 100644 --- a/flake.nix +++ b/flake.nix @@ -6,18 +6,40 @@ inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.hls.url = "github:haskell/haskell-language-server"; inputs.nix-filter.url = "github:numtide/nix-filter"; + inputs.opentelemetry-plugin.url = "github:MercuryTechnologies/opentelemetry-plugin"; nixConfig = { extra-substituters = [ "https://ihaskell.cachix.org" ]; extra-trusted-public-keys = [ "ihaskell.cachix.org-1:WoIvex/Ft/++sjYW3ntqPUL3jDGXIKDpX60pC8d5VLM="]; }; - outputs = { self, nixpkgs23_11, nixpkgsMaster, flake-utils, hls, nix-filter, ... }: + outputs = { self, nixpkgs23_11, nixpkgsMaster, flake-utils, hls, nix-filter, opentelemetry-plugin, ... }: # "x86_64-darwin" "aarch64-darwin" flake-utils.lib.eachSystem ["x86_64-linux"] (system: let baseOverlay = self: super: { inherit nix-filter; }; - pkgs23_11 = import nixpkgs23_11 { inherit system; overlays = [baseOverlay]; }; - pkgsMaster = import nixpkgsMaster { inherit system; overlays = [baseOverlay]; }; + opentelemetryPluginOverlay = sel: sup: { + haskell = sup.haskell // { + packages = sup.haskell.packages // { + ghc94 = sup.haskell.packages.ghc94.override { + overrides = self: super: { + opentelemetry-plugin = self.callCabal2nix "opentelemetry-plugin" opentelemetry-plugin {}; + }; + }; + ghc96 = sup.haskell.packages.ghc96.override { + overrides = self: super: { + opentelemetry-plugin = self.callCabal2nix "opentelemetry-plugin" opentelemetry-plugin {}; + }; + }; + ghc98 = sup.haskell.packages.ghc98.override { + overrides = self: super: { + opentelemetry-plugin = self.callCabal2nix "opentelemetry-plugin" opentelemetry-plugin {}; + }; + }; + }; + }; + }; + pkgs23_11 = import nixpkgs23_11 { inherit system; overlays = [baseOverlay opentelemetryPluginOverlay]; }; + pkgsMaster = import nixpkgsMaster { inherit system; overlays = [baseOverlay opentelemetryPluginOverlay]; }; jupyterlab = pkgsMaster.python3.withPackages (ps: [ ps.jupyterlab ps.notebook ]); diff --git a/ghc-parser/ghc-parser.cabal b/ghc-parser/ghc-parser.cabal index 92738c7c..4b581048 100644 --- a/ghc-parser/ghc-parser.cabal +++ b/ghc-parser/ghc-parser.cabal @@ -18,12 +18,15 @@ cabal-version: 1.16 library ghc-options: -Wall + -fplugin OpenTelemetry.Plugin exposed-modules: Language.Haskell.GHC.Parser, Language.Haskell.GHC.HappyParser -- other-modules: -- other-extensions: build-depends: base >=4.9 && < 5, - ghc >=8.0 && <9.9 + ghc >=8.0 && <9.9, + + opentelemetry-plugin -any if impl(ghc >= 8.0) && impl(ghc < 8.4) hs-source-dirs: generic-src src-8.0 diff --git a/ihaskell.cabal b/ihaskell.cabal index e012eb4f..f291aacf 100644 --- a/ihaskell.cabal +++ b/ihaskell.cabal @@ -58,6 +58,7 @@ library hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall + -fplugin OpenTelemetry.Plugin if impl (ghc >= 8.4) ghc-options: -Wpartial-fields @@ -96,7 +97,9 @@ library unordered-containers -any, utf8-string -any, vector -any, - ipython-kernel >=0.11.0.0 + ipython-kernel >=0.11.0.0, + + opentelemetry-plugin -any exposed-modules: IHaskell.Display IHaskell.Convert diff --git a/ipython-kernel/ipython-kernel.cabal b/ipython-kernel/ipython-kernel.cabal index 13c0ce5e..ea3f3d68 100644 --- a/ipython-kernel/ipython-kernel.cabal +++ b/ipython-kernel/ipython-kernel.cabal @@ -25,6 +25,7 @@ flag examples library ghc-options: -Wall + -fplugin OpenTelemetry.Plugin exposed-modules: IHaskell.IPython.Kernel IHaskell.IPython.Types @@ -51,7 +52,8 @@ library unordered-containers, uuid , zeromq4-haskell , - parsec + parsec , + opentelemetry-plugin -any -- Example program executable simple-calc-example