Consume buildHaskell functions

Use the newly defined `buildHaskell` function for a few of my existing Haskell
projects. So far, it works as intended!
This commit is contained in:
William Carroll 2020-08-12 16:28:39 +01:00
parent 4ea55dd013
commit 2da4b12266
3 changed files with 45 additions and 57 deletions

View file

@ -1,26 +1,16 @@
let let
pkgs = import (builtins.fetchGit { briefcase = import /home/wpcarro/briefcase {};
url = "https://github.com/NixOS/nixpkgs-channels"; in briefcase.buildHaskell.program {
ref = "nixos-20.03";
rev = "afa9ca61924f05aacfe495a7ad0fd84709d236cc";
}) {};
ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [
optparse-applicative
unordered-containers
split
]);
in pkgs.stdenv.mkDerivation {
name = "transform-keyboard"; name = "transform-keyboard";
buildInputs = []; srcs = builtins.path {
src = builtins.path {
path = ./.; path = ./.;
name = "transform-keyboard-src"; name = "transform-keyboard-src";
}; };
buildPhase = '' deps = hpkgs: with hpkgs; [
${ghc}/bin/ghc ./Main.hs optparse-applicative
''; unordered-containers
installPhase = '' split
mkdir -p $out && mv Main $out/transform-keyboard rio
''; ];
ghcExtensions = [];
} }

View file

@ -1,27 +1,27 @@
let let
pkgs = import /home/wpcarro/nixpkgs {}; briefcase = import /home/wpcarro/briefcase {};
ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: [ in briefcase.buildHaskell.program {
hpkgs.servant-server name = "server";
hpkgs.aeson
hpkgs.wai-cors
hpkgs.warp
hpkgs.jwt
hpkgs.unordered-containers
hpkgs.base64
hpkgs.http-conduit
hpkgs.rio
]);
in pkgs.stdenv.mkDerivation {
name = "LearnPianoChords-server";
srcs = builtins.path { srcs = builtins.path {
path = ./.; path = ./.;
name = "LearnPianoChords-server-src"; name = "LearnPianoChords-server-src";
}; };
buildPhase = '' ghcExtensions = [
${ghc} -O Main.hs \ "OverloadedStrings"
-XOverloadedStrings \ "NoImplicitPrelude"
-XNoImplicitPrelude \ "RecordWildCards"
-XRecordWildCards \ "TypeApplications"
-XTypeApplications ];
''; deps = hpkgs: with hpkgs; [
servant-server
aeson
wai-cors
warp
jwt
unordered-containers
base64
http-conduit
rio
envy
];
} }

View file

@ -1,19 +1,17 @@
let let
pkgs = import /home/wpcarro/nixpkgs {}; briefcase = import /home/wpcarro/briefcase {};
in pkgs.mkShell { in briefcase.buildHaskell.shell {
buildInputs = with pkgs; [ deps = hpkgs: with hpkgs; [
(haskellPackages.ghcWithPackages (hpkgs: [ hspec
hpkgs.hspec servant-server
hpkgs.servant-server aeson
hpkgs.aeson wai-cors
hpkgs.wai-cors warp
hpkgs.warp jwt
hpkgs.jwt unordered-containers
hpkgs.unordered-containers base64
hpkgs.base64 http-conduit
hpkgs.http-conduit rio
hpkgs.rio envy
hpkgs.envy
]))
]; ];
} }