From 269b1f697eee8efdb2a7c0c6c7e5bd60ffb0ac83 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Fri, 20 Mar 2020 15:23:47 -0400 Subject: [PATCH] [wip] --- PaymentServer.cabal | 2 +- nix/PaymentServer.nix | 16 ++++++++-------- nix/challenge-bypass-ristretto-repo.nix | 9 +++++++++ nix/challenge-bypass-ristretto.nix | 5 +++++ nix/overlay.nix | 2 +- nix/privacypass-repo.nix | 7 ------- nix/ristretto.nix | 5 ----- ristretto.nix | 10 ---------- shell.nix | 20 +++++++++++++++----- stack-shell.nix | 10 +++++----- 10 files changed, 44 insertions(+), 42 deletions(-) create mode 100644 nix/challenge-bypass-ristretto-repo.nix create mode 100644 nix/challenge-bypass-ristretto.nix delete mode 100644 nix/privacypass-repo.nix delete mode 100644 nix/ristretto.nix delete mode 100644 ristretto.nix diff --git a/PaymentServer.cabal b/PaymentServer.cabal index dd51a39..c5a6aef 100644 --- a/PaymentServer.cabal +++ b/PaymentServer.cabal @@ -44,7 +44,7 @@ library , sqlite-simple default-language: Haskell2010 ghc-options: -Wmissing-import-lists -Wunused-imports - pkgconfig-depends: ristretto + pkgconfig-depends: libchallenge_bypass_ristretto executable PaymentServer-exe hs-source-dirs: app diff --git a/nix/PaymentServer.nix b/nix/PaymentServer.nix index 0816f96..98421eb 100644 --- a/nix/PaymentServer.nix +++ b/nix/PaymentServer.nix @@ -2,19 +2,19 @@ let buildDepError = pkg: builtins.throw '' The Haskell package set does not contain the package: ${pkg} (build dependency). - + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. ''; sysDepError = pkg: builtins.throw '' The Nixpkgs package set does not contain the package: ${pkg} (system dependency). - + You may need to augment the system package mapping in haskell.nix so that it can be found. ''; pkgConfDepError = pkg: builtins.throw '' The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency). - + You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found. ''; exeDepError = pkg: @@ -24,16 +24,16 @@ let legacyExeDepError = pkg: builtins.throw '' The Haskell package set does not contain the package: ${pkg} (executable dependency). - + If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. ''; buildToolDepError = pkg: builtins.throw '' Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency). - + If this is a system dependency: You may need to augment the system package mapping in haskell.nix so that it can be found. - + If this is a Haskell dependency: If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix. ''; @@ -78,7 +78,7 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }: (hsPkgs."sqlite-simple" or (buildDepError "sqlite-simple")) ]; pkgconfig = [ - (pkgconfPkgs."ristretto" or (pkgConfDepError "ristretto")) + (pkgconfPkgs."libchallenge_bypass_ristretto" or (pkgConfDepError "libchallenge_bypass_ristretto")) ]; }; exes = { @@ -97,4 +97,4 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }: }; }; }; - } // rec { src = (pkgs.lib).mkDefault ../.; } \ No newline at end of file + } // rec { src = (pkgs.lib).mkDefault ../.; } diff --git a/nix/challenge-bypass-ristretto-repo.nix b/nix/challenge-bypass-ristretto-repo.nix new file mode 100644 index 0000000..c7e246f --- /dev/null +++ b/nix/challenge-bypass-ristretto-repo.nix @@ -0,0 +1,9 @@ +let + pkgs = import <nixpkgs> {}; +in + pkgs.fetchFromGitHub { + owner = "LeastAuthority"; + repo = "python-challenge-bypass-ristretto"; + rev = "f1a7cfab1a7f1bf8b3345c228c2183064889ad83"; + sha256 = "12myak2jwaisljs7bmx1vydgd0fnxvkaisk4zsf0kshwxrlnyh3x"; + } \ No newline at end of file diff --git a/nix/challenge-bypass-ristretto.nix b/nix/challenge-bypass-ristretto.nix new file mode 100644 index 0000000..cded558 --- /dev/null +++ b/nix/challenge-bypass-ristretto.nix @@ -0,0 +1,5 @@ +{ fetchFromGitHub, callPackage }: +let + src = import ./challenge-bypass-ristretto-repo.nix; +in + callPackage "${src}/challenge-bypass-ristretto.nix" { } diff --git a/nix/overlay.nix b/nix/overlay.nix index 2673b39..482cbb0 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,3 +1,3 @@ self: super: { - ristretto = super.callPackage ./ristretto.nix { }; + challenge-bypass-ristretto = super.callPackage ./challenge-bypass-ristretto.nix { }; } diff --git a/nix/privacypass-repo.nix b/nix/privacypass-repo.nix deleted file mode 100644 index 6b0c64c..0000000 --- a/nix/privacypass-repo.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ fetchFromGitHub }: -fetchFromGitHub { - owner = "LeastAuthority"; - repo = "privacypass"; - rev = "45855401e163f8e622bd93a5c5bce13de8c8510a"; - sha256 = "sha256:15wv8vas6x8cdicylp0m632c916p7qxq1k4lnchr8c92lldp0rv7"; -} diff --git a/nix/ristretto.nix b/nix/ristretto.nix deleted file mode 100644 index 4e09128..0000000 --- a/nix/ristretto.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ fetchFromGitHub, callPackage }: -let - src = import ./privacypass-repo.nix { inherit fetchFromGitHub; }; -in - callPackage "${src}/ristretto.nix" { } diff --git a/ristretto.nix b/ristretto.nix deleted file mode 100644 index 8af584c..0000000 --- a/ristretto.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ fetchFromGitHub, callPackage }: -let - src = fetchFromGitHub { - owner = "LeastAuthority"; - repo = "privacypass"; - rev = "45855401e163f8e622bd93a5c5bce13de8c8510a"; - sha256 = "15wv8vas6x8cdicylp0m632c916p7qxq1k4lnchr8c92lldp0rv7"; - }; -in - callPackage "${src}/ristretto.nix" { } diff --git a/shell.nix b/shell.nix index b474e00..5b5500a 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,16 @@ { pkgs ? import <nixpkgs> { } }: -pkgs.mkShell { - buildInputs = [ - pkgs.stack - ]; -} +let + haskellDotNix = pkgs.fetchFromGitHub { + owner = "input-output-hk"; + repo = "haskell.nix"; + rev = "33dc7bce3444f8957dec9dccb484dd4b40ee463d"; + sha256 = "0ffv3sfjkba4b565gpgs0qznd2jh5v60ql03dkc5bgx2sh8yfhsv"; + }; + nix-tools = (import pkgs.path (import haskellDotNix)).haskell-nix.nix-tools; +in + pkgs.mkShell { + buildInputs = [ + pkgs.stack + nix-tools + ]; + } diff --git a/stack-shell.nix b/stack-shell.nix index 8800cbb..bcbca4e 100644 --- a/stack-shell.nix +++ b/stack-shell.nix @@ -3,15 +3,15 @@ { ghc }: let pkgs = import <nixpkgs> { }; - # Get our Ristretto bindings. - ristretto = pkgs.callPackage ./ristretto.nix { }; + # Get our bindings. + challenge-bypass-ristretto = pkgs.callPackage ./nix/challenge-bypass-ristretto.nix { }; in # This is what you're supposed to call in a stack shell-file. I don't # *really* know what it does but I know it works... pkgs.haskell.lib.buildStackProject { inherit ghc; - name = "PrivacyPass"; + name = "challenge-bypass-ristretto"; # zlib is a common dependency of many of our dependencies. and we put our - # ristretto library in as well. - buildInputs = [ pkgs.zlib ristretto ]; + # challenge-bypass-ristretto library in as well. + buildInputs = [ pkgs.zlib challenge-bypass-ristretto ]; } -- GitLab