From 76233a848ffb8742dc77a3a87c4e897eb135ec38 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 6 Aug 2019 16:22:13 +0200 Subject: [PATCH 1/2] cachix: "0.2.1" -> master For C++ closure fetching --- .../Hercules/Agent/Cachix.hs | 3 +- .../Hercules/Agent/Cachix/Env.hs | 4 +- .../Hercules/Agent/Cachix/Init.hs | 4 ++ nix/cachix-api.nix | 21 +++------ nix/cachix.nix | 44 ++++++++----------- nix/packages.nix | 9 ++-- nix/sources.json | 6 +-- stack.yaml | 2 +- 8 files changed, 44 insertions(+), 49 deletions(-) diff --git a/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix.hs b/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix.hs index ad4488bf..ecd880bf 100644 --- a/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix.hs +++ b/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix.hs @@ -23,7 +23,7 @@ import System.IO ( hClose ) push :: Text -> [Text] -> App () push cache paths = withNamedContext "cache" cache $ do - Agent.Cachix.Env { pushCaches = pushCaches } <- + Agent.Cachix.Env { pushCaches = pushCaches, nixStore = nixStore } <- asks $ Agent.Cachix.getEnv httpManager <- asks $ manager @@ -41,6 +41,7 @@ push cache paths = withNamedContext "cache" cache $ do liftIO $ Cachix.Push.mapConcurrentlyBounded 4 (fmap (unliftIO ul) f) l ) clientEnv + nixStore pushCache (\storePath -> let ctx = withNamedContext "path" storePath diff --git a/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix/Env.hs b/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix/Env.hs index f4870d3e..3ef994d3 100644 --- a/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix/Env.hs +++ b/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix/Env.hs @@ -2,12 +2,14 @@ module Hercules.Agent.Cachix.Env where import Protolude import qualified Cachix.Client.Push as Cachix -import Hercules.Formats.CachixCache ( CachixCache ) +import Hercules.Formats.CachixCache ( CachixCache ) +import Cachix.Client.Store ( Store ) data Env = Env { pushCaches :: Map Text Cachix.PushCache , cacheKeys :: Map Text CachixCache , netrcLines :: [Text] + , nixStore :: Store } class HasEnv env where diff --git a/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix/Init.hs b/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix/Init.hs index 90fc5dc6..8914c44f 100644 --- a/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix/Init.hs +++ b/hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix/Init.hs @@ -4,6 +4,7 @@ import Protolude import qualified Cachix.Client.Push as Cachix.Push import qualified Cachix.Client.Secrets as Cachix.Secrets +import qualified Cachix.Client.Store as Cachix.Store import Hercules.Agent.Cachix.Env as Env import qualified Hercules.Formats.CachixCache as CachixCache import qualified Hercules.Agent.Config as Config @@ -21,9 +22,12 @@ newEnv _config cks = do pcs <- liftIO $ toPushCaches cks + store <- liftIO Cachix.Store.openStore + pure Env.Env { pushCaches = pcs , netrcLines = toNetrcLines cks , cacheKeys = cks + , nixStore = store } toNetrcLines :: Map Text CachixCache.CachixCache -> [Text] diff --git a/nix/cachix-api.nix b/nix/cachix-api.nix index d3f30c55..ae0c8b73 100644 --- a/nix/cachix-api.nix +++ b/nix/cachix-api.nix @@ -1,21 +1,14 @@ { mkDerivation, aeson, base, base16-bytestring, bytestring, conduit -, cookie, cryptonite, deepseq, exceptions, fetchgit, hspec -, hspec-discover, http-api-data, http-media, lens, memory -, protolude, resourcet, servant, servant-auth, servant-auth-server -, servant-auth-swagger, servant-client, servant-swagger -, servant-swagger-ui-core, stdenv, string-conv, swagger2, text -, transformers +, cookie, cryptonite, deepseq, exceptions, hspec, hspec-discover +, http-api-data, http-media, lens, memory, protolude, resourcet +, servant, servant-auth, servant-auth-server, servant-auth-swagger +, servant-client, servant-swagger, servant-swagger-ui-core, stdenv +, string-conv, swagger2, text, transformers }: mkDerivation { pname = "cachix-api"; - version = "0.2.0"; - src = fetchgit { - url = "https://github.com/cachix/cachix"; - sha256 = "046r64n9z1k6l2hndcfz7wawpqxhrvvfr5lwfzq63rqrdf0ja38i"; - rev = "70a8673e15adf50833e5183cc4fd69cab35ba29d"; - fetchSubmodules = true; - }; - postUnpack = "sourceRoot+=/cachix-api; echo source root reset to $sourceRoot"; + version = "0.2.1"; + src = (import ./sources.nix).cachix + "/cachix-api"; isLibrary = true; isExecutable = true; libraryHaskellDepends = [ diff --git a/nix/cachix.nix b/nix/cachix.nix index 2490852a..cd31db31 100644 --- a/nix/cachix.nix +++ b/nix/cachix.nix @@ -1,37 +1,31 @@ { mkDerivation, async, base, base16-bytestring, base64-bytestring -, bytestring, cachix-api, conduit, conduit-extra, cookie -, cryptonite, dhall, directory, ed25519, fetchgit, filepath -, fsnotify, here, hspec, hspec-discover, http-client -, http-client-tls, http-conduit, http-types, lzma-conduit -, megaparsec, memory, mmorph, netrc, optparse-applicative, process -, protolude, resourcet, retry, safe-exceptions, servant -, servant-auth, servant-auth-client, servant-client -, servant-client-core, servant-conduit, stdenv, temporary, text -, unix, uri-bytestring, versions +, bytestring, cachix-api, conduit, conduit-extra, containers +, cookie, cryptonite, dhall, directory, ed25519, filepath, fsnotify +, here, hspec, hspec-discover, http-client, http-client-tls +, http-conduit, http-types, inline-c, inline-c-cpp, lzma-conduit +, megaparsec, memory, mmorph, netrc, nix-main, nix-store +, optparse-applicative, process, protolude, resourcet, retry +, safe-exceptions, servant, servant-auth, servant-auth-client +, servant-client, servant-client-core, servant-conduit, stdenv +, temporary, text, unix, uri-bytestring, versions }: mkDerivation { pname = "cachix"; - version = "0.2.0"; - src = fetchgit { - url = "https://github.com/cachix/cachix"; - sha256 = "046r64n9z1k6l2hndcfz7wawpqxhrvvfr5lwfzq63rqrdf0ja38i"; - rev = "70a8673e15adf50833e5183cc4fd69cab35ba29d"; - fetchSubmodules = true; - }; - postUnpack = "sourceRoot+=/cachix; echo source root reset to $sourceRoot"; + version = "0.2.1"; + src = (import ./sources.nix).cachix + "/cachix"; isLibrary = true; isExecutable = true; - enableSeparateDataOutput = true; libraryHaskellDepends = [ async base base16-bytestring base64-bytestring bytestring - cachix-api conduit conduit-extra cookie cryptonite dhall directory - ed25519 filepath fsnotify here http-client http-client-tls - http-conduit http-types lzma-conduit megaparsec memory mmorph netrc - optparse-applicative process protolude resourcet retry - safe-exceptions servant servant-auth servant-auth-client - servant-client servant-client-core servant-conduit text unix - uri-bytestring versions + cachix-api conduit conduit-extra containers cookie cryptonite dhall + directory ed25519 filepath fsnotify here http-client + http-client-tls http-conduit http-types inline-c inline-c-cpp + lzma-conduit megaparsec memory mmorph netrc optparse-applicative + process protolude resourcet retry safe-exceptions servant + servant-auth servant-auth-client servant-client servant-client-core + servant-conduit text unix uri-bytestring versions ]; + libraryPkgconfigDepends = [ nix-main nix-store ]; executableHaskellDepends = [ base cachix-api ]; executableToolDepends = [ hspec-discover ]; testHaskellDepends = [ diff --git a/nix/packages.nix b/nix/packages.nix index c1424829..0e6b2940 100644 --- a/nix/packages.nix +++ b/nix/packages.nix @@ -9,9 +9,7 @@ let haskellPackages_ = haskellPackages; inherit (pkgs) recurseIntoAttrs lib; inherit (pkgs.lib) cleanSource makeBinPath optionalAttrs; - inherit (haskell.lib) addBuildDepends overrideCabal buildFromSdist doJailbreak; - - inherit (pkgs.haskell.lib) overrideSrc; + inherit (haskell.lib) overrideSrc addBuildDepends overrideCabal buildFromSdist doJailbreak; sources = import ./sources.nix; inherit (import sources.gitignore { inherit lib; }) gitignoreSource; @@ -21,7 +19,10 @@ let # TODO: upstream the overrides haskellPackages = haskellPackages_.extend (self: super: { - cachix = self.callPackage ./cachix.nix {}; + cachix = + addBuildDepends + (self.callPackage ./cachix.nix { nix-main = nix; nix-store = nix; }) + [ pkgs.boost ]; cachix-api = self.callPackage ./cachix-api.nix {}; hercules-ci-api = diff --git a/nix/sources.json b/nix/sources.json index 56641617..7756e06e 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,15 +1,15 @@ { "cachix": { "homepage": "https://cachix.org", - "url": "https://github.com/cachix/cachix/archive/70a8673e15adf50833e5183cc4fd69cab35ba29d.tar.gz", + "url": "https://github.com/cachix/cachix/archive/d4158f70be7f8b9cf01dd885c4adf1c101880f2f.tar.gz", "owner": "cachix", "branch": "master", "url_template": "https://github.com///archive/.tar.gz", "repo": "cachix", "type": "tarball", - "sha256": "046r64n9z1k6l2hndcfz7wawpqxhrvvfr5lwfzq63rqrdf0ja38i", + "sha256": "169cn7airf8kw2275ix0aradpips7cip1ki4qyv0rvarjgszri6k", "description": "Command line client for Nix binary cache hosting:", - "rev": "70a8673e15adf50833e5183cc4fd69cab35ba29d" + "rev": "d4158f70be7f8b9cf01dd885c4adf1c101880f2f" }, "nixos-19.03": { "url": "https://github.com/NixOS/nixpkgs-channels/archive/7b36963e7a7363f1b40ac0a829c4644923dda909.tar.gz", diff --git a/stack.yaml b/stack.yaml index 1cd31956..a419fd29 100644 --- a/stack.yaml +++ b/stack.yaml @@ -11,7 +11,7 @@ extra-deps: - nix-derivation-1.0.2@sha256:dc1f13f89d37d4dcc7a46dbac7f6b4e8cd2877f4af99e35b9cb8255d08179bd4 - tomland-1.0.1.0 - git: https://github.com/cachix/cachix - commit: 91e1b719aa2384b470bda5995f5e38d1abefc924 + commit: d4158f70be7f8b9cf01dd885c4adf1c101880f2f subdirs: - cachix - cachix-api From 5eef62ba01fca6b3872f4d188bad535d357ffcb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 6 Aug 2019 18:15:19 +0200 Subject: [PATCH 2/2] darwin: skip profiling for cachix to avoid compilation errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit cf517d121488e9c8486b6b604356de85e9f2f64f) Signed-off-by: Domen Kožar --- nix/packages.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nix/packages.nix b/nix/packages.nix index 0e6b2940..df1276da 100644 --- a/nix/packages.nix +++ b/nix/packages.nix @@ -20,9 +20,11 @@ let # TODO: upstream the overrides haskellPackages = haskellPackages_.extend (self: super: { cachix = - addBuildDepends - (self.callPackage ./cachix.nix { nix-main = nix; nix-store = nix; }) - [ pkgs.boost ]; + # avoid https://gitlab.haskell.org/ghc/ghc/issues/16477 + haskell.lib.disableLibraryProfiling ( + addBuildDepends + (self.callPackage ./cachix.nix { nix-main = nix; nix-store = nix; }) + [ pkgs.boost ]); cachix-api = self.callPackage ./cachix-api.nix {}; hercules-ci-api =