diff --git a/fetch-nixpkgs.nix b/fetch-nixpkgs.nix deleted file mode 100644 index bf12e8b..0000000 --- a/fetch-nixpkgs.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ rev # The Git revision of nixpkgs to fetch -, sha256 # The SHA256 of the downloaded data -, outputSha256 ? null # The SHA256 output hash -, system ? builtins.currentSystem # This is overridable if necessary -}: - -with { - ifThenElse = { bool, thenValue, elseValue }: ( - if bool then thenValue else elseValue); -}; - -ifThenElse { - bool = (0 <= builtins.compareVersions builtins.nixVersion "1.12"); - - # In Nix 1.12, we can just give a `sha256` to `builtins.fetchTarball`. - thenValue = ( - builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; - - # builtins.fetchTarball does not need the sha256 hash of the - # packed and compressed tarball but it _does_ need the - # fixed-output sha256 hash. - sha256 = outputSha256; - }); - - # This hack should at least work for Nix 1.11 - elseValue = ( - (rec { - tarball = import { - url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; - inherit sha256; - }; - - builtin-paths = import ; - - script = builtins.toFile "nixpkgs-unpacker" '' - "$coreutils/mkdir" "$out" - cd "$out" - "$gzip" --decompress < "$tarball" | "$tar" -x --strip-components=1 - ''; - - nixpkgs = builtins.derivation ({ - name = "nixpkgs-${builtins.substring 0 6 rev}"; - - builder = builtins.storePath builtin-paths.shell; - - args = [ script ]; - - inherit tarball system; - - tar = builtins.storePath builtin-paths.tar; - gzip = builtins.storePath builtin-paths.gzip; - coreutils = builtins.storePath builtin-paths.coreutils; - } // (if null == outputSha256 then { } else { - outputHashMode = "recursive"; - outputHashAlgo = "sha256"; - outputHash = outputSha256; - })); - }).nixpkgs); -} diff --git a/grpc-haskell.cabal b/grpc-haskell.cabal index 50e5d27..d0f91f1 100644 --- a/grpc-haskell.cabal +++ b/grpc-haskell.cabal @@ -199,7 +199,7 @@ test-suite tests , transformers , safe , clock >=0.6.0 && <0.8.0 - , turtle >= 1.2.0 + , turtle >= 1.5.0 , text , QuickCheck >=2.8 && <3.0 other-modules: diff --git a/nix/base-compat-batteries.nix b/nix/base-compat-batteries.nix new file mode 100644 index 0000000..a31c6c0 --- /dev/null +++ b/nix/base-compat-batteries.nix @@ -0,0 +1,14 @@ +{ mkDerivation, base, base-compat, bifunctors, contravariant, hspec +, QuickCheck, stdenv +}: +mkDerivation { + pname = "base-compat-batteries"; + version = "0.10.5"; + sha256 = "175dcfd1453bd02ec955c05181cbf4278af145183b5899c62d3be29d866170ee"; + libraryHaskellDepends = [ + base base-compat bifunctors contravariant + ]; + testHaskellDepends = [ base hspec QuickCheck ]; + description = "base-compat with extra batteries"; + license = stdenv.lib.licenses.mit; +} diff --git a/nix/base-compat.nix b/nix/base-compat.nix new file mode 100644 index 0000000..2debdf8 --- /dev/null +++ b/nix/base-compat.nix @@ -0,0 +1,9 @@ +{ mkDerivation, base, stdenv, unix }: +mkDerivation { + pname = "base-compat"; + version = "0.10.5"; + sha256 = "990aea21568956d44ab018c5dbfbaea014b9a0d5295d29ca7550149419a6fb41"; + libraryHaskellDepends = [ base unix ]; + description = "A compatibility layer for base"; + license = stdenv.lib.licenses.mit; +} diff --git a/nix/contravariant.nix b/nix/contravariant.nix new file mode 100644 index 0000000..f929b4c --- /dev/null +++ b/nix/contravariant.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, StateVar, stdenv, transformers }: +mkDerivation { + pname = "contravariant"; + version = "1.5"; + sha256 = "6ef067b692ad69ffff294b953aa85f3ded459d4ae133c37896222a09280fc3c2"; + libraryHaskellDepends = [ base StateVar transformers ]; + homepage = "http://github.com/ekmett/contravariant/"; + description = "Contravariant functors"; + license = stdenv.lib.licenses.bsd3; +} diff --git a/nix/fetchNixpkgs.nix b/nix/fetchNixpkgs.nix new file mode 100644 index 0000000..478c25d --- /dev/null +++ b/nix/fetchNixpkgs.nix @@ -0,0 +1,49 @@ +{ rev # The Git revision of nixpkgs to fetch +, sha256 # The SHA256 of the downloaded data +, outputSha256 ? null # The SHA256 fixed-output hash +, system ? builtins.currentSystem # This is overridable if necessary +}: + +if (0 <= builtins.compareVersions builtins.nixVersion "1.12") + +# In Nix 1.12, we can just give a `sha256` to `builtins.fetchTarball`. +then ( + builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; + sha256 = outputSha256; + }) + +# This hack should at least work for Nix 1.11 +else ( + (rec { + tarball = import { + url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; + inherit sha256; + }; + + builtin-paths = import ; + + script = builtins.toFile "nixpkgs-unpacker" '' + "$coreutils/mkdir" "$out" + cd "$out" + "$gzip" --decompress < "$tarball" | "$tar" -x --strip-components=1 + ''; + + nixpkgs = builtins.derivation ({ + name = "nixpkgs-${builtins.substring 0 6 rev}"; + + builder = builtins.storePath builtin-paths.shell; + + args = [ script ]; + + inherit tarball system; + + tar = builtins.storePath builtin-paths.tar; + gzip = builtins.storePath builtin-paths.gzip; + coreutils = builtins.storePath builtin-paths.coreutils; + } // (if null == outputSha256 then { } else { + outputHashMode = "recursive"; + outputHashAlgo = "sha256"; + outputHash = outputSha256; + })); + }).nixpkgs) diff --git a/nix/optparse-applicative.nix b/nix/optparse-applicative.nix index bdfc252..bff5f8c 100644 --- a/nix/optparse-applicative.nix +++ b/nix/optparse-applicative.nix @@ -3,8 +3,8 @@ }: mkDerivation { pname = "optparse-applicative"; - version = "0.14.0.0"; - sha256 = "06iwp1qsq0gjhnhxwyhdhldwvhlgcik6lx5jxpbb40fispyk4nxm"; + version = "0.14.3.0"; + sha256 = "72476302fe555a508917b2d7d6121c7b58ea5434cdc08aeb5d4b652e8f0e7663"; libraryHaskellDepends = [ ansi-wl-pprint base process transformers transformers-compat ]; diff --git a/nix/optparse-generic.nix b/nix/optparse-generic.nix index 42bc130..91814de 100644 --- a/nix/optparse-generic.nix +++ b/nix/optparse-generic.nix @@ -1,13 +1,14 @@ -{ mkDerivation, base, bytestring, optparse-applicative, semigroups -, stdenv, system-filepath, text, time, transformers, void +{ mkDerivation, base, bytestring, Only, optparse-applicative +, semigroups, stdenv, system-filepath, text, time, transformers +, void }: mkDerivation { pname = "optparse-generic"; - version = "1.2.1"; - sha256 = "1dk945dp98mwk1v4y0cky3z0ngmd29nbg6fbaaxnigcrgpbvkjml"; + version = "1.3.0"; + sha256 = "80929958606e4a73672b570ba1a23493fbf46268666d14ab5af53623301c398f"; libraryHaskellDepends = [ - base bytestring optparse-applicative semigroups system-filepath - text time transformers void + base bytestring Only optparse-applicative semigroups + system-filepath text time transformers void ]; description = "Auto-generate a command-line parser for your datatype"; license = stdenv.lib.licenses.bsd3; diff --git a/nix/proto3-wire.nix b/nix/proto3-wire.nix index b0b85ee..f33755b 100644 --- a/nix/proto3-wire.nix +++ b/nix/proto3-wire.nix @@ -6,9 +6,9 @@ mkDerivation { pname = "proto3-wire"; version = "1.0.0"; src = fetchgit { - url = "https://github.com/awakenetworks/proto3-wire.git"; - sha256 = "14n0d16an782ayipirm5v2mvp58jgf65xvffqzp08p50sksil3gi"; - rev = "a938330bf794cf3fa05591d03906915df98d157c"; + url = "git@github.com:awakesecurity/proto3-wire.git"; + sha256 = "1ps1lijjbwzps2axr94r4k9c6cw9c9s5cy2izf2867hgavxrjs6k"; + rev = "4f715b29031566878333d81ff0845be766a5d381"; }; libraryHaskellDepends = [ base bytestring cereal containers deepseq hashable QuickCheck safe diff --git a/nix/swagger2.nix b/nix/swagger2.nix index f98db58..4ff2414 100644 --- a/nix/swagger2.nix +++ b/nix/swagger2.nix @@ -1,25 +1,29 @@ -{ mkDerivation, aeson, aeson-qq, base, base-compat, bytestring +{ mkDerivation, aeson, base, base-compat-batteries, bytestring , Cabal, cabal-doctest, containers, doctest, generics-sop, Glob , hashable, hspec, http-media, HUnit, insert-ordered-containers -, lens, mtl, network, QuickCheck, scientific, stdenv -, template-haskell, text, time, transformers, transformers-compat -, unordered-containers, uuid-types, vector +, lens, mtl, network, QuickCheck, quickcheck-instances, scientific +, stdenv, template-haskell, text, time, transformers +, transformers-compat, unordered-containers, utf8-string +, uuid-types, vector }: mkDerivation { pname = "swagger2"; - version = "2.1.6"; - sha256 = "01a29h56vfyw0ilij1pn6qwy50ca90kyj884vs1q52vvh572758j"; + version = "2.3.0.1"; + sha256 = "2ee44e05a953c5a25f0e948a89bfdac9940550a31c29fbf2c0135178c58e17d1"; + revision = "2"; + editedCabalFile = "0dfxf47mzzb5rmln2smsk0qx53kj1lc3a087r52g2rzz6971zivb"; setupHaskellDepends = [ base Cabal cabal-doctest ]; libraryHaskellDepends = [ - aeson base base-compat bytestring containers generics-sop hashable - http-media insert-ordered-containers lens mtl network scientific - template-haskell text time transformers transformers-compat - unordered-containers uuid-types vector + aeson base base-compat-batteries bytestring containers generics-sop + hashable http-media insert-ordered-containers lens mtl network + scientific template-haskell text time transformers + transformers-compat unordered-containers uuid-types vector ]; testHaskellDepends = [ - aeson aeson-qq base base-compat bytestring containers doctest Glob + aeson base base-compat-batteries bytestring containers doctest Glob hashable hspec HUnit insert-ordered-containers lens mtl QuickCheck - text time unordered-containers vector + quickcheck-instances template-haskell text time + unordered-containers utf8-string vector ]; homepage = "https://github.com/GetShopTV/swagger2"; description = "Swagger 2.0 data model"; diff --git a/release.nix b/release.nix index b957772..f055daf 100644 --- a/release.nix +++ b/release.nix @@ -58,13 +58,24 @@ # run: # # $ cabal2nix path/to/dependency/repo > nix/${package-name}.nix + let - nixpkgs = import ./nixpkgs.nix; + fetchNixpkgs = import ./nix/fetchNixpkgs.nix; + + nixpkgs = fetchNixpkgs { + rev = "a8ff2616603a6ff6bfb060368c12a973c8e007f6"; + sha256 = "15l57ra62w9imqv3cfx9qp1fag3mqp95x0hdh81cqjb663qxihlg"; + outputSha256 = "1nkpbwdx1jgr2pv5arllk6k56h3xc61jal7qi66g21qsx6daf0g3"; + }; + config = { packageOverrides = pkgs: rec { protobuf3_2NoCheck = pkgs.stdenv.lib.overrideDerivation - pkgs.pythonPackages.protobuf3_2 + (pkgs.pythonPackages.callPackage "${nixpkgs}/pkgs/development/python-modules/protobuf" { + disabled = false; + protobuf = pkgs.protobuf3_4; + }) (oldAttrs : {doCheck = false; doInstallCheck = false;}); cython = pkgs.pythonPackages.buildPythonPackage rec { @@ -189,21 +200,15 @@ let haskellPackages = pkgs.haskellPackages.override { overrides = haskellPackagesNew: haskellPackagesOld: rec { - aeson = - pkgs.haskell.lib.dontCheck - (haskellPackagesNew.callPackage ./nix/aeson.nix {}); - cabal-doctest = - haskellPackagesNew.callPackage ./nix/cabal-doctest.nix { }; + base-compat-batteries = + haskellPackagesNew.callPackage ./nix/base-compat-batteries.nix { }; - insert-ordered-containers = - haskellPackagesNew.callPackage ./nix/insert-ordered-containers.nix { }; + base-compat = + haskellPackagesNew.callPackage ./nix/base-compat.nix { }; - optparse-applicative = - haskellPackagesNew.callPackage ./nix/optparse-applicative.nix { }; - - optparse-generic = - haskellPackagesNew.callPackage ./nix/optparse-generic.nix { }; + contravariant = + haskellPackagesNew.callPackage ./nix/contravariant.nix { }; proto3-wire = haskellPackagesNew.callPackage ./nix/proto3-wire.nix { }; @@ -240,7 +245,6 @@ let ]); python = pkgs.python.withPackages (pkgs: [ - # pkgs.protobuf3_0 grpcio-tools ]); @@ -290,10 +294,6 @@ let swagger2 = pkgs.haskell.lib.dontCheck (pkgs.haskell.lib.dontHaddock (haskellPackagesNew.callPackage ./nix/swagger2.nix { })); - - turtle = - haskellPackagesNew.callPackage ./nix/turtle.nix { }; - }; }; }; diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..39b5c83 --- /dev/null +++ b/shell.nix @@ -0,0 +1 @@ +(import ./release.nix).grpc-haskell.env