Last active
August 12, 2020 22:27
-
-
Save wpcarro/8f578488d7c0e87d1795fc8d2341422f to your computer and use it in GitHub Desktop.
Troubleshooting broken stripe-haskell in <nixpkgs>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { pkgs, ... }: | |
| { | |
| # Build a Haskell executable. This assumes a project directory with a | |
| # top-level Main.hs. It also applies a few commonly used language extensions. | |
| # Here is an overview of the arguments: | |
| # - `name`: You can find the result at ./result/$name | |
| # - `srcs`: Will be passed to `srcs` field of `pkgs.stdenv.mkDerivation`. | |
| # - `deps`: A function that accepts `hpkgs` and returns a list of Haskell | |
| # dependencies. | |
| program = { name, srcs, deps, ghcExtensions }: let | |
| ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: deps hpkgs); | |
| in pkgs.stdenv.mkDerivation { | |
| name = name; | |
| buildInputs = []; | |
| srcs = srcs; | |
| buildPhase = '' | |
| ${ghc}/bin/ghc -Wall Main.hs ${pkgs.lib.concatMapStrings (x: "-X${x} ") ghcExtensions} | |
| ''; | |
| installPhase = '' | |
| mkdir -p $out && mv Main $out/${name} | |
| ''; | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let | |
| briefcase = import /home/wpcarro/briefcase {}; | |
| pkgs = briefcase.third_party.pkgs; | |
| stripe-src = pkgs.fetchFromGitHub { | |
| owner = "dmjio"; | |
| repo = "stripe"; | |
| rev = "4da0eb9f0d7fd05027108d95766eed10174014fc"; | |
| sha256 = "1pjpx519yf96y5gb155lk6yaljbppjndkb4507xyl8qlblf4dn5a"; | |
| }; | |
| stripe-pkgs = import stripe-src { nixpkgs = pkgs; }; | |
| in briefcase.buildHaskell.program { | |
| name = "server"; | |
| srcs = builtins.path { | |
| path = ./.; | |
| name = "LearnPianoChords-server-src"; | |
| }; | |
| ghcExtensions = [ | |
| "OverloadedStrings" | |
| "NoImplicitPrelude" | |
| "RecordWildCards" | |
| "TypeApplications" | |
| ]; | |
| deps = hpkgs: with hpkgs; [ | |
| servant-server | |
| aeson | |
| wai-cors | |
| warp | |
| jwt | |
| unordered-containers | |
| base64 | |
| http-conduit | |
| rio | |
| envy | |
| stripe-pkgs.stripe-haskell | |
| ]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment