{ # nix flake update or nix flake lock --update-input nixpkgs inputs = { nixpkgs.url = "github:NixOS/nixpkgs/release-23.05"; # Or use the the user's/global registry: #nixpkgs.url = "flake:nixpkgs"; pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs-stable.follows = "nixpkgs"; }; # FIXME: err404 #gargantext-prelude.url = "gitlab:gargantext/haskell-gargantext-prelude?host=git.iscpif.fr"; gargantext-prelude = { url = "git+https://gitlab.iscpif.fr/cgenie/haskell-gargantext-prelude.git"; flake = false; }; # WARNING: using the debugNaN branch gargantext-graph = { url = "git+https://gitlab.iscpif.fr/gargantext/gargantext-graph.git?ref=debugNaN"; flake = false; }; hlcm = { url = "git+https://gitlab.iscpif.fr/gargantext/hlcm.git"; flake = false; }; rdf4h = { url = "github:robstewart57/rdf4h"; flake = false; }; ekg-json = { url = "github:alpmestan/ekg-json"; flake = false; }; # External Data API connectors crawlerArxiv = { url = "git+https://gitlab.iscpif.fr/gargantext/crawlers/arxiv-api.git?ref=master"; flake = false; }; crawlerHAL = { url = "git+https://gitlab.iscpif.fr/gargantext/crawlers/hal.git"; flake = false; }; crawlerIsidore = { url = "git+https://gitlab.iscpif.fr/gargantext/crawlers/isidore.git"; flake = false; }; crawlerISTEX = { url = "git+https://gitlab.iscpif.fr/gargantext/crawlers/istex.git"; flake = false; }; crawlerPubMed = { url = "git+https://gitlab.iscpif.fr/gargantext/crawlers/pubmed.git"; flake = false; }; openalex = { url = "git+https://gitlab.iscpif.fr/gargantext/crawlers/openalex.git"; flake = false; }; # Data Mining Libs data-time-segment = { url = "github:delanoe/data-time-segment"; flake = false; }; # Graph libs haskell-igraph = { url = "git+https://gitlab.iscpif.fr/gargantext/haskell-igraph.git"; flake = false; }; hsinfomap = { url = "git+https://gitlab.iscpif.fr/gargantext/haskell-infomap.git"; flake = false; }; # NP libs # WARNING: using the 163-fix-transform-with branch patches-class = { url = "git+https://gitlab.iscpif.fr/cgenie/patches-class.git?ref=163-fix-transform-with"; flake = false; }; patches-map = { url = "github:delanoe/patches-map"; flake = false; }; # Accelerate Linear Algebra and specific instances # WARNING: using the dbg branch accelerate = { url = "github:alpmestan/accelerate/dbg"; flake = false; }; accelerate-arithmetic = { url = "github:alpmestan/accelerate-arithmetic"; flake = false; }; # WARNING: using the fix-error branch accelerate-utility = { url = "git+https://gitlab.iscpif.fr/amestanogullari/accelerate-utility.git?ref=fix-error"; flake = false; }; # WARNING: using the dbg branch accelerate-llvm = { url = "github:alpmestan/accelerate-llvm/dbg"; flake = false; }; # WARNING: using the alp/imap-static branch hmatrix = { url = "github:alpmestan/hmatrix/alp/imap-static"; flake = false; }; # WARNING: using the alp/static branch sparse-linear = { url = "github:alpmestan/sparse-linear/alp/static"; flake = false; }; wikiparsec = { url = "github:rspeer/wikiparsec"; flake = false; }; boolexpr = { url = "github:boolexpr/boolexpr"; flake = false; }; # NOTE: Alternative: using flake = true for boolexpr, but quite useless # and painful to configure to avoid downloading/storing extra nixpkgs. # boolexpr = { # url = "github:boolexpr/boolexpr"; # inputs.nixpkgs.follows = "nixpkgs"; # inputs.flake-parts.follows = "flake-parts"; # }; # flake-parts = { # url = "github:hercules-ci/flake-parts"; # inputs.nixpkgs-lib.follows = "nixpkgs"; # }; # WARNING: using the more-exports branch servant-job = { url = "github:alpmestan/servant-job/more-exports"; flake = false; }; }; outputs = inputs: let pkg = "gargantext"; lib = inputs.nixpkgs.lib; forAllSystems = f: lib.genAttrs lib.systems.flakeExposed (system: f rec { inherit system; pkgs = inputs.nixpkgs.legacyPackages.${system}.extend (finalPkgs: prevPkgs: { # Any overlay for Nixpkgs' pkgs can go here }); ghcVersion = "ghc8107"; configureFlagsGraphClustering = map (x: "--ghc-option=" + x) [ "-O2" "-fsimpl-tick-factor=10000" "-fdicts-cheap" "-fdicts-strict" "-flate-dmd-anal" "-fno-state-hack" ]; haskellPackages = pkgs.haskell.packages.${ghcVersion}.extend (with pkgs.haskell.lib; finalHP: prevHP: { ${pkg} = disableExecutableProfiling (disableLibraryProfiling (overrideCabal (buildFromSdist (finalHP.callCabal2nix pkg inputs.self { # Because haskell-igraph needs that old singletons singletons = finalHP.callHackage "singletons" "2.7" { th-desugar = finalHP.callHackage "th-desugar" "1.11" { }; }; })) (drv: { testFlags = [ "--pattern" (lib.concatStringsSep " && " [ # FIXME: FAIL # src-test/Offline/JSON.hs:47: # JSON instance will break frontend! "!/WithQuery frontend compliance/" # FIXME: FAIL (non-deterministic) # expected: ["Job #3","Job #4"] # but got: [] "!/respects max runners limit/" # FIXME: FAIL (non-deterministic) # Starting 1 job runners. # Starting 1 job runners. # expected: [Nothing,Just 10,Just 5] # but got: [Nothing,Nothing,Nothing] "!/can fetch the latest job status/" # FIXME: FAIL (non-deterministic) # Starting 1 job runners. # expected: [Just 100] # but got: [Nothing] "!/can spin two separate jobs and track their status separately/" ]) ]; }))); accelerate = finalHP.callCabal2nix "accelerate" inputs.accelerate { }; # Setup: Encountered missing or private dependencies: # accelerate >=1.0 && <1.2 accelerate-arithmetic = appendPatch (doJailbreak (finalHP.callCabal2nix "accelerate-arithmetic" inputs.accelerate-arithmetic { })) patches/accelerate-arithmetic/0001-remove-test-using-removed-realBandedGramian.patch; accelerate-llvm = overrideCabal (finalHP.callCabal2nix "accelerate-llvm" "${inputs.accelerate-llvm}/accelerate-llvm" { }) (drv: { # Give access to accelerate-llvm/LICENSE -> ../LICENSE src = inputs.accelerate-llvm; postUnpack = "sourceRoot=$sourceRoot/accelerate-llvm"; }); accelerate-llvm-native = # nofib-llvm-native: Data.Array.Accelerate: the nofib test-suite has been disabled. # Reinstall package 'accelerate' with '-fnofib' to enable it. dontCheck ((overrideCabal (finalHP.callCabal2nix "accelerate-llvm-native" "${inputs.accelerate-llvm}/accelerate-llvm-native" { }) (drv: { # Give access to accelerate-llvm-native/LICENSE -> ../LICENSE src = inputs.accelerate-llvm; postUnpack = "sourceRoot=$sourceRoot/accelerate-llvm-native"; patches = [ # WARNING: see https://github.com/remiturk/libffi/issues/13 patches/accelerate-llvm-native/0001-fix-removed-argInt-by-using-argInt64.patch ]; })).overrideAttrs (prevAttrs: { # pkgs/development/haskell-modules/generic-builder.nix # does not pass through patchFlags to mkDerivation... patchFlags = [ "-p2" ]; })); # Setup: Encountered missing or private dependencies: # accelerate >=1.0 && <1.2 accelerate-utility = doJailbreak (finalHP.callCabal2nix "accelerate-utility" inputs.accelerate-utility { }); boolexpr = finalHP.callCabal2nix "boolexpr" inputs.boolexpr { }; #boolexpr = inputs.boolexpr.packages.${system}.default; bytestring-csv = unmarkBroken prevHP.bytestring-csv; crawlerArxiv = finalHP.callCabal2nix "crawlerArxiv" (pkgs.applyPatches { name = "crawlerArxiv-patched"; src = inputs.crawlerArxiv; patches = [ patches/arxiv-api/0001-build-fix-license.patch ]; }) { }; crawlerHAL = finalHP.callCabal2nix "crawlerHAL" (pkgs.applyPatches { name = "crawlerHAL-patched"; src = inputs.crawlerHAL; patches = [ patches/hal/0001-build-fix-halCrawler-crawlerHAL.patch ]; }) { }; crawlerISTEX = finalHP.callCabal2nix "crawlerISTEX" inputs.crawlerISTEX { }; crawlerIsidore = finalHP.callCabal2nix "crawlerIsidore" inputs.crawlerIsidore { }; crawlerPubMed = finalHP.callCabal2nix "crawlerHAL" (pkgs.applyPatches { name = "crawlerPubMed-patched"; src = inputs.crawlerPubMed; patches = [ patches/crawlerPubMed/0001-fix-test-suite-build-dependencies.patch ]; }) { }; data-time-segment = finalHP.callCabal2nix "data-time-segment" inputs.data-time-segment { }; duckling = overrideCabal (doJailbreak (appendPatches (unmarkBroken prevHP.duckling) [ patches/duckling/0001-fix-missing-Eq-Dimension-a-needed-by-recent-hashable.patch patches/duckling/0002-support-and-require-aeson-2.0.patch ])) (drv: { testFlags = [ # https://github.com/facebook/duckling/issues/572 "--pattern" "!/AF Tests.Corpus Tests/" ]; }); eigen = doJailbreak (unmarkBroken prevHP.eigen); # Because of ekg-json # https://github.com/tibbe/ekg/issues/90 ekg = doJailbreak (unmarkBroken prevHP.ekg); ekg-json = appendPatch (finalHP.callCabal2nix "ekg-json" inputs.ekg-json { }) patches/ekg-json/0001-support-and-require-aeson-2.0.patch; # Needed for wikiparsec fast-tagsoup-utf8-only = unmarkBroken prevHP.fast-tagsoup-utf8-only; gargantext-graph = appendConfigureFlags ( (finalHP.callCabal2nix "gargantext-graph" inputs.gargantext-graph { # Because haskell-igraph needs that old singletons singletons = finalHP.callHackage "singletons" "2.7" { th-desugar = finalHP.callHackage "th-desugar" "1.11" { }; }; }) ) configureFlagsGraphClustering; # test/Spec.hs:1:9: error: # Not in scope: type constructor or class ‘IO’ gargantext-prelude = dontCheck (finalHP.callCabal2nix "gargantext-prelude" inputs.gargantext-prelude { }); ghc-clippy-plugin = doJailbreak (unmarkBroken prevHP.ghc-clippy-plugin); haskell-igraph = appendConfigureFlags ( (finalHP.callCabal2nix "haskell-igraph" inputs.haskell-igraph { # Avoid cabal2nix to depend on Hackage's igraph (an homonym), # and use instead the C++ igraph. # Also, use the dev output to include the C headers. igraph = pkgs.igraph.dev; # nixpkgs is using singletons-3.0.1 singletons = finalHP.callHackage "singletons" "2.7" { th-desugar = finalHP.callHackage "th-desugar" "1.11" { }; }; }) ) # Extra include needed because haskell-igraph's cbits # use: #include # not: #include [ "--extra-include-dirs=${pkgs.igraph.dev}/include/igraph" ]; haskell98 = unmarkBroken prevHP.haskell98; hlcm = finalHP.callCabal2nix "hlcm" inputs.hlcm { }; hmatrix = appendConfigureFlags (finalHP.callCabal2nix "hmatrix" "${inputs.hmatrix}/packages/base" { }) configureFlagsGraphClustering; hsinfomap = finalHP.callCabal2nix "hsinfomap" inputs.hsinfomap { }; # tests/Database/HSparql/QueryGeneratorTest.hs:19:10: error: # • Illegal instance declaration for # ‘CreateQuery (Query SelectQuery)’ # (All instance types must be of the form (T t1 ... tn) # where T is not a synonym. # Use TypeSynonymInstances if you want to disable this.) hsparql = dontCheck (unmarkBroken prevHP.hsparql); llvm-hs = unmarkBroken prevHP.llvm-hs; # Dropped support for older GHC, this is the LTS-18.28 version modern-uri = doJailbreak (finalHP.callHackage "modern-uri" "0.3.4.3" { }); morpheus-graphql-core = unmarkBroken prevHP.morpheus-graphql-core; opaleye = appendPatch prevHP.opaleye # [FTS] full text search implementation patches/opaleye/PR-563.patch; # Setup: Encountered missing or private dependencies: # aeson >=2.1.2 && <2.2, # conduit >=1.3.5 && <1.4, # http-client-tls >=0.3.6.2 && <0.4, # http-conduit >=2.3.8.2 && <2.4 openalex = doJailbreak (finalHP.callCabal2nix "openalex" inputs.openalex { }); patches-class = appendPatch (finalHP.callCabal2nix "patches-class" inputs.patches-class { }) patches/patches-class/0001-fix-comment-that-confused-GHC-because-of-haddock-syn.patch; # Setup: Encountered missing or private dependencies: # QuickCheck >=2.7 && <2.14, # doctest >=0.9 && <0.17, # hspec >=2.1 && <2.8 # Disable checks because they take too much time and resources patches-map = dontCheck (doJailbreak (finalHP.callCabal2nix "patches-map" inputs.patches-map { })); servant-ekg = appendPatch prevHP.servant-ekg patches/servant-ekg/0001-fix-missing-instance-HasEndpoint.patch; servant-job = appendPatch (doJailbreak (finalHP.callCabal2nix "servant-job" inputs.servant-job { })) patches/servant-job/0001-fix-comment-breaking-haddock.patch; servant-xml = unmarkBroken prevHP.servant-xml; # tests/Sparse.hs:195:11: error: # • Expected kind ‘* -> *’, but ‘St.Matrix n p Vector’ has kind ‘*’ sparse-linear = dontCheck (appendConfigureFlags (finalHP.callCabal2nix "sparse-linear" (inputs.sparse-linear + "/sparse-linear") { }) configureFlagsGraphClustering); # Setup: Encountered missing or private dependencies: # base >=4.0 && <4.10 stemmer = doJailbreak (unmarkBroken prevHP.stemmer); taggy-lens = unmarkBroken prevHP.taggy-lens; # Setup: Encountered missing or private dependencies: # attoparsec ==0.13.*, classy-prelude ==1.4.*, text-icu ==0.7.* wikiparsec = doJailbreak (finalHP.callCabal2nix "wikiparsec" inputs.wikiparsec { }); # Setup: Encountered missing or private dependencies: # base >=4.16.0 && <4.19, bytestring >=0.11.3 && <0.12 wuss = doJailbreak prevHP.wuss; }); }); in rec { # nix -L build defaultPackage = forAllSystems ({ haskellPackages, ... }: haskellPackages.${pkg}); # For debugging a specific dependency, eg: # nix -L build .#haskellPackages.boolexpr # nix -L develop .#haskellPackages.servant-job # genericBuild packages = forAllSystems ({ pkgs, haskellPackages, ... }: pkgs // { inherit haskellPackages; }); # nix -L develop or direnv allow devShell = forAllSystems ({ pkgs, haskellPackages, system, ... }: haskellPackages.shellFor { packages = ps: [ ps.${pkg} ]; nativeBuildInputs = [ haskellPackages.cabal-install haskellPackages.ghcid haskellPackages.haskell-language-server haskellPackages.hlint #haskellPackages.markdown-unlit #haskellPackages.tasty-discover #pkgs.git-chglog pkgs.reuse ]; withHoogle = false; inherit (checks.${system}.pre-commit-check) shellHook; }); # nix flake check checks = forAllSystems (args: with args; { pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { src = inputs.self; #settings.ormolu.cabalDefaultExtensions = true; settings.ormolu.defaultExtensions = [ "ImportQualifiedPost" "TypeApplications" ]; hooks = { #hlint.enable = true; nixpkgs-fmt.enable = true; #fourmolu.enable = true; #cabal-fmt.enable = true; }; }; }); }; }