From bb104abf63657ad485a5fff68962b80fbe8d57d5 Mon Sep 17 00:00:00 2001 From: "(cdep)illabout" Date: Fri, 29 Nov 2019 10:13:35 +0900 Subject: [PATCH] spago: init at 0.12.1.0 This commit adds the spago package, a PureScript package manager and build tool. https://github.com/spacchetti/spago --- .../configuration-hackage2nix.yaml | 1 + .../haskell-modules/configuration-nix.nix | 56 +++++++++++++++++++ .../haskell-modules/non-hackage-packages.nix | 3 + .../tools/purescript/spago/default.nix | 47 ++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 5 files changed, 109 insertions(+) create mode 100644 pkgs/development/tools/purescript/spago/default.nix diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml index f57768ecb773..088af0d0805d 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml @@ -2594,6 +2594,7 @@ package-maintainers: cdepillabout: - pretty-simple - purescript + - spago - termonad unsupported-platforms: diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index dbdad1ddf1d0..4ebfa2322a8a 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -636,4 +636,60 @@ self: super: builtins.intersectAttrs super { # need it during the build itself, too. cairo = addBuildTool super.cairo self.buildHaskellPackages.gtk2hs-buildtools; pango = disableHardening (addBuildTool super.pango self.buildHaskellPackages.gtk2hs-buildtools) ["fortify"]; + + spago = + let + # Spago basically compiles with LTS-14, but it requires a newer version + # of directory. This is to work around a bug only present on windows, so + # we can safely jailbreak spago and use the older directory package from + # LTS-14. + spagoWithOverrides = doJailbreak (super.spago.override { + # spago requires the latest version of dhall. + directory = self.dhall_1_27_0; + }); + + docsSearchAppJsFile = pkgs.fetchurl { + url = "https://github.com/spacchetti/purescript-docs-search/releases/download/v0.0.5/docs-search-app.js"; + sha256 = "11721x455qzh40vzfmralaynn9v8b5wix86r107hhs08vhryjib2"; + }; + + purescriptDocsSearchFile = pkgs.fetchurl { + url = "https://github.com/spacchetti/purescript-docs-search/releases/download/v0.0.5/purescript-docs-search"; + sha256 = "16p1fmdvpwz1yswav8qjsd26c9airb22xncqw1rjnbd8lcpqx0p5"; + }; + + spagoFixHpack = overrideCabal spagoWithOverrides (drv: { + postUnpack = (drv.postUnpack or "") + '' + # The source for spago is pulled directly from GitHub. It uses a + # package.yaml file with hpack, not a .cabal file. In the package.yaml file, + # it uses defaults from the master branch of the hspec repo. It will try to + # fetch these at build-time (but it will fail if running in the sandbox). + # + # The following line modifies the package.yaml to not pull in + # defaults from the hspec repo. + substituteInPlace "$sourceRoot/package.yaml" --replace 'defaults: hspec/hspec@master' "" + + # Spago includes the following two files directly into the binary + # with Template Haskell. They are fetched at build-time from the + # `purescript-docs-search` repo above. If they cannot be fetched at + # build-time, they are pulled in from the `templates/` directory in + # the spago source. + # + # However, they are not actually available in the spago source, so they + # need to fetched with nix and put in the correct place. + # https://github.com/spacchetti/spago/issues/510 + cp ${docsSearchAppJsFile} "$sourceRoot/templates/docs-search-app.js" + cp ${purescriptDocsSearchFile} "$sourceRoot/templates/purescript-docs-search" + ''; + }); + + # Haddock generation is broken for spago. + # https://github.com/spacchetti/spago/issues/511 + spagoWithoutHaddocks = dontHaddock spagoFixHpack; + + # Because of the problem above with pulling in hspec defaults to the + # package.yaml file, the tests are disabled. + spagoWithoutChecks = dontCheck spagoWithoutHaddocks; + in + spagoWithoutChecks; } diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix index 8b667a1e6693..c292eeec128f 100644 --- a/pkgs/development/haskell-modules/non-hackage-packages.nix +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -13,4 +13,7 @@ self: super: { # https://github.com/channable/vaultenv/issues/1 vaultenv = self.callPackage ../tools/haskell/vaultenv { }; + # spago is not released to Hackage. + # https://github.com/spacchetti/spago/issues/512 + spago = self.callPackage ../tools/purescript/spago { }; } diff --git a/pkgs/development/tools/purescript/spago/default.nix b/pkgs/development/tools/purescript/spago/default.nix new file mode 100644 index 000000000000..6879d6875cc4 --- /dev/null +++ b/pkgs/development/tools/purescript/spago/default.nix @@ -0,0 +1,47 @@ +{ mkDerivation, aeson, aeson-pretty, ansi-terminal, async-pool +, base, bower-json, bytestring, Cabal, containers, dhall, directory +, either, exceptions, extra, fetchgit, file-embed, filepath, foldl +, fsnotify, github, Glob, hpack, hspec, hspec-discover +, hspec-megaparsec, http-client, http-conduit, lens-family-core +, megaparsec, mtl, network-uri, open-browser, optparse-applicative +, prettyprinter, process, QuickCheck, retry, rio, rio-orphans, safe +, semver-range, stdenv, stm, tar, template-haskell, temporary, text +, time, transformers, turtle, unliftio, unordered-containers +, vector, versions, zlib +}: +mkDerivation { + pname = "spago"; + version = "0.12.1.0"; + src = fetchgit { + url = "https://github.com/spacchetti/spago"; + sha256 = "17xgp75yxangmb65sv3raysad31kmc109c4q4aj9dgcdqz23fcn2"; + rev = "a4679880402ead320f8be2f091b25d30e27b62df"; + fetchSubmodules = true; + }; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + aeson aeson-pretty ansi-terminal async-pool base bower-json + bytestring Cabal containers dhall directory either exceptions + file-embed filepath foldl fsnotify github Glob http-client + http-conduit lens-family-core megaparsec mtl network-uri + open-browser prettyprinter process retry rio rio-orphans safe + semver-range stm tar template-haskell temporary text time + transformers turtle unliftio unordered-containers vector versions + zlib + ]; + libraryToolDepends = [ hpack ]; + executableHaskellDepends = [ + aeson-pretty async-pool base bytestring containers dhall filepath + github lens-family-core megaparsec optparse-applicative process + retry stm temporary text time turtle vector + ]; + testHaskellDepends = [ + base containers directory extra hspec hspec-megaparsec megaparsec + process QuickCheck temporary text turtle versions + ]; + testToolDepends = [ hspec-discover ]; + prePatch = "hpack"; + homepage = "https://github.com/spacchetti/spago#readme"; + license = stdenv.lib.licenses.bsd3; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3675ac57736d..c0e9f50a3430 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8111,6 +8111,8 @@ in psc-package = haskell.lib.justStaticExecutables (haskellPackages.callPackage ../development/compilers/purescript/psc-package { }); + spago = haskell.lib.justStaticExecutables haskellPackages.spago; + tacacsplus = callPackage ../servers/tacacsplus { }; tamarin-prover =