Skip to content

Commit

Permalink
Merge pull request #112 from hercules-ci/bump-cachix-c++
Browse files Browse the repository at this point in the history
cachix: "0.2.1" -> master
  • Loading branch information
roberth authored Aug 6, 2019
2 parents 7fd7a14 + a08fce8 commit eb8e4cc
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 49 deletions.
3 changes: 2 additions & 1 deletion hercules-ci-agent/hercules-ci-agent/Hercules/Agent/Cachix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
21 changes: 7 additions & 14 deletions nix/cachix-api.nix
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
44 changes: 19 additions & 25 deletions nix/cachix.nix
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
11 changes: 7 additions & 4 deletions nix/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,7 +19,12 @@ let

# TODO: upstream the overrides
haskellPackages = haskellPackages_.extend (self: super: {
cachix = self.callPackage ./cachix.nix {};
cachix =
# 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 =
Expand Down
6 changes: 3 additions & 3 deletions nix/sources.json
Original file line number Diff line number Diff line change
@@ -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/<owner>/<repo>/archive/<rev>.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",
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb8e4cc

Please sign in to comment.