From 00aacb3a4c90633d69a45ba72260cb84c53cc87d Mon Sep 17 00:00:00 2001 From: Andrew McMiddlin Date: Wed, 5 Jun 2019 14:46:11 +1000 Subject: [PATCH 1/6] Attempt at nix with pinned nixpkgs. Suffers infinite recursion due to the QuickCheck override. --- default.nix | 40 +++++++++++++++------------------------- shell.nix | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 shell.nix diff --git a/default.nix b/default.nix index 4b04872b..aa03a9e4 100644 --- a/default.nix +++ b/default.nix @@ -1,26 +1,16 @@ -{ mkDerivation, aeson, attoparsec, base, base16-bytestring -, byteable, bytestring, case-insensitive, conduit, containers -, cryptohash, data-default, failure, hashable, hspec, HTTP -, http-conduit, http-types, network, old-locale, stdenv, text, time -, unordered-containers, vector +{ nixpkgs ? import ./nix/nixpkgs.nix +, dev ? false }: -mkDerivation { - pname = "github"; - version = "0.14.0"; - src = ./.; - buildDepends = [ - aeson attoparsec base base16-bytestring byteable bytestring - case-insensitive conduit containers cryptohash data-default failure - hashable HTTP http-conduit http-types network old-locale text time - unordered-containers vector - ]; - testDepends = [ - aeson attoparsec base base16-bytestring byteable bytestring - case-insensitive conduit containers cryptohash data-default failure - hashable hspec HTTP http-conduit http-types network old-locale text - time unordered-containers vector - ]; - homepage = "https://github.com/fpco/github"; - description = "Access to the Github API, v3"; - license = stdenv.lib.licenses.bsd3; -} +let + pkgs = import nixpkgs { config.allowBroken = true; }; + hp = pkgs.haskellPackages.override (old: { + overrides = pkgs.lib.composeExtensions (old.overrides or (_: _: {})) (self: super: with pkgs.haskell.lib; { + binary-instances-1 = doJailbreak self.binary-instances-1; + QuickCheck = self.QuickCheck_2_13_1; + quickcheck-instances = super.quickcheck-instances_0_3_21; + binary-orphans = self.binary-orphans_1_0_1; + github = super.callCabal2nix "github" ./github.cabal {}; + }); + }); +in + hp.github diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..5f1751ab --- /dev/null +++ b/shell.nix @@ -0,0 +1,14 @@ +{nixpkgs ? import ./nix/nixpkgs.nix}: + +(import ./. {inherit nixpkgs;}).env +# let +# pkgs = import nixpkgs {}; +# ghcWithP = pkgs.haskellPackages.ghcWithPackages (hp: with hp; [ +# pkgs.cabal-install +# ghcid +# zlib +# ]); +# in +# pkgs.mkShell { +# buildInputs = [ghcWithP]; +# } From 09d81d7fd7ca99216c30a2ec0dc52c5c96749f01 Mon Sep 17 00:00:00 2001 From: Andrew McMiddlin Date: Wed, 5 Jun 2019 14:49:43 +1000 Subject: [PATCH 2/6] Add nixpkgs pin I forgot. --- nix/nixpkgs.nix | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 nix/nixpkgs.nix diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix new file mode 100644 index 00000000..ca8d22a5 --- /dev/null +++ b/nix/nixpkgs.nix @@ -0,0 +1,7 @@ +builtins.fetchGit { + # Descriptive name to make the store path easier to identify + name = "nixos-unstable-2019-05-30"; + url = https://github.com/nixos/nixpkgs/; + # `git ls-remote https://github.com/nixos/nixpkgs-channels nixos-unstable` + rev = "eccb90a2d997d65dc514253b441e515d8e0241c3"; +} From 5aba76f286ef75352562b964d2cab869fc6c6e36 Mon Sep 17 00:00:00 2001 From: Andrew McMiddlin Date: Wed, 5 Jun 2019 20:48:13 +1000 Subject: [PATCH 3/6] Working nix (at least nix-build). --- default.nix | 38 +++++++++++++++++++++++++++++--------- shell.nix | 11 ----------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/default.nix b/default.nix index aa03a9e4..831f3e73 100644 --- a/default.nix +++ b/default.nix @@ -2,15 +2,35 @@ , dev ? false }: let - pkgs = import nixpkgs { config.allowBroken = true; }; - hp = pkgs.haskellPackages.override (old: { - overrides = pkgs.lib.composeExtensions (old.overrides or (_: _: {})) (self: super: with pkgs.haskell.lib; { - binary-instances-1 = doJailbreak self.binary-instances-1; - QuickCheck = self.QuickCheck_2_13_1; + pkgs = import nixpkgs {}; + hp = pkgs.haskellPackages.override (with pkgs.haskell.lib; { + overrides = self: super: { + # Newer versions of things we need + ansi-terminal = super.ansi-terminal_0_9_1; + binary-orphans = super.binary-orphans_1_0_1; + QuickCheck = super.QuickCheck_2_13_1; quickcheck-instances = super.quickcheck-instances_0_3_21; - binary-orphans = self.binary-orphans_1_0_1; - github = super.callCabal2nix "github" ./github.cabal {}; - }); + tasty = super.tasty_1_2_2; + time-compat = super.time-compat_1_9_2_2; + unordered-containers = super.unordered-containers_0_2_10_0; + + # Things that work with our newer versions but don't know it yet + # hspec test failure looks like it relies on some RNG to be just + # right, not critical + ChasingBottoms = doJailbreak super.ChasingBottoms; + hspec-core = dontCheck (doJailbreak super.hspec-core); + optparse-applicative = doJailbreak super.optparse-applicative; + + # We subbed in the correct versions of things it needs to work + binary-instances = overrideCabal super.binary-instances (drv: { + broken = false; + }); + + # Break infinite recursion through QuickCheck test dep + splitmix = dontCheck super.splitmix; + + }; }); + github = hp.callCabal2nix "github" ./. {}; in - hp.github + github diff --git a/shell.nix b/shell.nix index 5f1751ab..feed7035 100644 --- a/shell.nix +++ b/shell.nix @@ -1,14 +1,3 @@ {nixpkgs ? import ./nix/nixpkgs.nix}: (import ./. {inherit nixpkgs;}).env -# let -# pkgs = import nixpkgs {}; -# ghcWithP = pkgs.haskellPackages.ghcWithPackages (hp: with hp; [ -# pkgs.cabal-install -# ghcid -# zlib -# ]); -# in -# pkgs.mkShell { -# buildInputs = [ghcWithP]; -# } From 7b94cd17fc374a793842953c49812cd90ab6163d Mon Sep 17 00:00:00 2001 From: Andrew McMiddlin Date: Thu, 6 Jun 2019 09:24:20 +1000 Subject: [PATCH 4/6] Add cabal-v2 overrides to default.nix. The cabal.project file has constraints on hashable and semigroups that mean we need newer versions when doing `cabal v2-*` builds. This commit adds those constraints, as well as a flag to disable them when not using `cabal v2-*`. --- default.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 831f3e73..1bf8f95a 100644 --- a/default.nix +++ b/default.nix @@ -1,8 +1,19 @@ { nixpkgs ? import ./nix/nixpkgs.nix -, dev ? false +, cabal-v2 ? true }: let pkgs = import nixpkgs {}; + + # Newer versions to meet `constraints` in `cabal.project` for v2 builds + v2-overrides = super: if cabal-v2 then + { + hashable = super.hashable_1_3_0_0; + semigroups = super.semigroups_0_19; + } + else + { + }; + hp = pkgs.haskellPackages.override (with pkgs.haskell.lib; { overrides = self: super: { # Newer versions of things we need @@ -29,7 +40,7 @@ let # Break infinite recursion through QuickCheck test dep splitmix = dontCheck super.splitmix; - }; + } // (v2-overrides super); }); github = hp.callCabal2nix "github" ./. {}; in From 69a8fd10dc0d37990dbc47409fd7f6b2a8bc5ef8 Mon Sep 17 00:00:00 2001 From: Andrew McMiddlin Date: Thu, 6 Jun 2019 09:28:49 +1000 Subject: [PATCH 5/6] Relax aeson-1.4.2.0's upper bounds on hashable and semigroup. This is already being done for `aeson-1.4.3.0` and saves us bumping the aeson version in our nix. --- cabal.project | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cabal.project b/cabal.project index 2f1a8084..6c2f2036 100644 --- a/cabal.project +++ b/cabal.project @@ -8,5 +8,8 @@ tests: True constraints: hashable ^>=1.3 constraints: semigroups ^>=0.19 +allow-newer: aeson-1.4.2.0:hashable +allow-newer: aeson-1.4.2.0:semigroups + allow-newer: aeson-1.4.3.0:hashable allow-newer: aeson-1.4.3.0:semigroups From 859c7261b41e5b24b24236d7fda0c01c698a02a6 Mon Sep 17 00:00:00 2001 From: Andrew McMiddlin Date: Thu, 6 Jun 2019 09:48:04 +1000 Subject: [PATCH 6/6] Add cabal-v2 argument to shell.nix. --- shell.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell.nix b/shell.nix index feed7035..9e3741f2 100644 --- a/shell.nix +++ b/shell.nix @@ -1,3 +1,5 @@ -{nixpkgs ? import ./nix/nixpkgs.nix}: +{ nixpkgs ? import ./nix/nixpkgs.nix +, cabal-v2 ? true +}: -(import ./. {inherit nixpkgs;}).env +(import ./. {inherit nixpkgs cabal-v2;}).env pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy