Skip to content

Commit

Permalink
fix haskell and bump 19.09
Browse files Browse the repository at this point in the history
  • Loading branch information
disassembler committed Nov 6, 2019
1 parent e18e70e commit 5f14f40
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 70 deletions.
2 changes: 1 addition & 1 deletion default.nix
Expand Up @@ -204,7 +204,7 @@ let

## TODO: move to installers/nix
hsDaedalusPkgs = import ./installers {
inherit (cardanoSL) daedalus-bridge;
#inherit (cardanoSL) daedalus-bridge;
inherit localLib system;
};
daedalus-installer = pkgs.haskell.lib.justStaticExecutables self.hsDaedalusPkgs.daedalus-installer;
Expand Down
9 changes: 9 additions & 0 deletions installers/cabal.project
@@ -0,0 +1,9 @@
packages: .

write-ghc-environment-files: never

source-repository-package
type: git
location: https://github.com/input-output-hk/haskell-nsis
tag: 016a122d845849b14711e0f86805a4748ec44584
--sha256: 14phxmmzncq63aahpw6f4sfmkf3cy075zjfyzhv2689csjwivm8y
6 changes: 2 additions & 4 deletions installers/common/Config.hs
Expand Up @@ -26,13 +26,11 @@ import qualified Control.Exception as Ex

import Data.Bool (bool)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
import qualified Data.Map as Map
import Data.Maybe
import Data.Optional (Optional)
import Data.Semigroup ((<>))
import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
import qualified Data.Yaml as YAML

import qualified Dhall.JSON as Dhall
Expand Down Expand Up @@ -149,7 +147,7 @@ dhallTopExpr dhallRoot cfg os cluster
where comp x = dhallRoot <>"/"<> lshowText x <>".dhall"

getInstallerConfig :: Text -> OS -> Cluster -> IO InstallerConfig
getInstallerConfig dhallRoot os cluster = Dhall.input Dhall.auto (LT.fromStrict topexpr)
getInstallerConfig dhallRoot os cluster = Dhall.input Dhall.auto topexpr
where
topexpr = format (s%" "%s%" ("%s%" "%s%")") (dhallRoot <> "/installer.dhall") (comp cluster) (comp os) (comp cluster)
comp x = dhallRoot <>"/"<> lshowText x <>".dhall"
Expand All @@ -159,7 +157,7 @@ forConfigValues :: Text -> OS -> Cluster -> (Config -> YAML.Value -> IO a) -> IO
forConfigValues dhallRoot os cluster action = do
sequence_ [ let topExpr = dhallTopExpr dhallRoot cfg os cluster
in action cfg =<<
(handle $ Dhall.codeToValue (BS8.pack $ T.unpack topExpr) topExpr)
(handle $ Dhall.codeToValue Dhall.NoConversion Dhall.ForbidWithinJSON Nothing topExpr)
| cfg <- enumFromTo minBound maxBound ]

checkAllConfigs :: Text -> IO ()
Expand Down
13 changes: 5 additions & 8 deletions installers/common/RewriteLibs.hs
@@ -1,6 +1,3 @@
#!/usr/bin/env nix-shell
#! nix-shell -j 4 -i runhaskell -p 'pkgs.haskellPackages.ghcWithPackages (hp: with hp; [ turtle megaparsec text directory universum ])'

{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}

Expand All @@ -13,8 +10,8 @@ import Universum hiding (isPrefixOf, last)
import Data.List (last)
import Data.Text (isPrefixOf, isSuffixOf, splitOn)
import System.Directory (copyFile, getPermissions, setOwnerWritable, setPermissions)
import Text.Megaparsec (Parsec, eof, manyTill, parse, someTill)
import Text.Megaparsec.Char (anyChar, eol, spaceChar)
import Text.Megaparsec (Parsec, anySingle, eof, manyTill, parse, someTill)
import Text.Megaparsec.Char (eol, spaceChar)
import Turtle (procStrict, procs)


Expand Down Expand Up @@ -78,12 +75,12 @@ type Parser = Parsec Void Text
parseLibLine :: Parser Text
parseLibLine = do
_ <- many spaceChar
path <- someTill anyChar spaceChar
_ <- someTill anyChar eol
path <- someTill anySingle spaceChar
_ <- someTill anySingle eol
return (toText path)


parseOTool :: Parser [Text]
parseOTool = do
_ <- manyTill anyChar eol
_ <- manyTill anySingle eol
manyTill parseLibLine eof
8 changes: 4 additions & 4 deletions installers/daedalus-installer.cabal
Expand Up @@ -2,10 +2,10 @@ name: daedalus-installer
version: 0.1.0.0
synopsis: Daedalus Installer Builder
description: Please see README.md
license: MIT
author: Serokell
maintainer: Serokell <hi@serokell.io>
copyright: 2016 IOHK
license: Apache-2.0
author: IOHK
maintainer: DevOps <devops@iohk.io>
copyright: 2019 IOHK
build-type: Simple
extra-source-files: README.md
cabal-version: >=1.10
Expand Down
52 changes: 5 additions & 47 deletions installers/default.nix
@@ -1,54 +1,12 @@
{ system ? builtins.currentSystem
, config ? {}
, pkgs ? localLib.iohkNix.getPkgs { inherit system config; }

# Disable running of tests for all local packages.
, forceDontCheck ? false

# Enable profiling for all haskell packages.
# Profiling slows down performance by 50% so we don't enable it by default.
, enableProfiling ? false

# Enable separation of build/check derivations.
, enableSplitCheck ? false

# Keeps the debug information for all haskell packages.
, enableDebugging ? false

# Build (but don't run) benchmarks for all local packages.
, enableBenchmarks ? false

# Overrides all nix derivations to add build timing information in
# their build output.
, enablePhaseMetrics ? true

# Overrides all nix derivations to add haddock hydra output.
, enableHaddockHydra ? false

# Disables optimization in the build for all local packages.
, fasterBuild ? false
, daedalus-bridge
, localLib
, localLib ? import ../lib.nix {}
, pkgs ? import localLib.sources.nixpkgs { inherit system config; }
}:

with pkgs;
with haskell.lib;

let
inherit daedalus-bridge;
addTestStubsOverlay = import ./overlays/add-test-stubs.nix {
inherit pkgs daedalus-bridge;
haskellPackages = pkgs.haskellPackages.override {
overrides = import ./overlays/required.nix { inherit pkgs; };
};
# We use GHC 8.2.2 because too many changes are needed to get to build with 8.4.3
haskellPackages = callPackage localLib.iohkNix.haskellPackages {
inherit forceDontCheck enableProfiling enablePhaseMetrics enableHaddockHydra
enableBenchmarks fasterBuild enableDebugging enableSplitCheck;
pkgsGenerated = haskell.packages.ghc822;
ghc = haskell.compiler.ghc822;
filter = localLib.isDaedalus;
requiredOverlay = ./overlays/required.nix;
customOverlays = [ addTestStubsOverlay ];
};


in haskellPackages
in haskellPackages // { inherit pkgs; }
9 changes: 6 additions & 3 deletions installers/overlays/required.nix
Expand Up @@ -4,10 +4,13 @@ with import ../../lib.nix;

with pkgs.haskell.lib;

self: super: rec {
dhall-json = doJailbreak (self.callPackage ../../installers/dhall-json.nix {});
dhall = doJailbreak (self.callPackage ../../installers/dhall-haskell.nix {});
self: super: {
dhall-json = self.callHackageDirect { pkg = "dhall-json"; ver = "1.4.1"; sha256 = "0b20p09vz6z8a8iyf832xscjvkcc68rrhr54pwdsbzikp9mdxx74"; } {};
dhall = doJailbreak (self.callHackageDirect { pkg = "dhall"; ver = "1.26.1"; sha256 = "12js4mgrmy4vral00x3a0w06rpgz0yy1p45k2xv64gg7gx8qp46y"; } {});

#dhall = self.callPackage ../../installers/dhall-haskell.nix {});
daedalus-installer = self.callPackage ../../installers/daedalus-installer.nix {};
universum = dontCheck (self.callHackage "universum" "1.5.0" {});
nsis = self.callCabal2nix "nsis" (pkgs.fetchFromGitHub {
owner = "input-output-hk";
repo = "haskell-nsis";
Expand Down
2 changes: 1 addition & 1 deletion lib.nix
Expand Up @@ -2,7 +2,7 @@

let
sources = import ./nix/sources.nix;
iohkNix = import sources.iohk-nix { application = "daedalus"; };
iohkNix = import sources.iohk-nix { sourcesOverride = sources; };
# TODO: can we use the filter in iohk-nix instead?
cleanSourceFilter = with pkgs.stdenv;
name: type: let baseName = baseNameOf (toString name); in ! (
Expand Down
12 changes: 12 additions & 0 deletions nix/sources.json
Expand Up @@ -36,6 +36,18 @@
"url": "https://github.com/hercules-ci/gitignore/archive/f9e996052b5af4032fe6150bba4a6fe4f7b9d698.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"haskell.nix": {
"branch": "master",
"description": "Alternative Haskell Infrastructure for Nixpkgs",
"homepage": "https://input-output-hk.github.io/haskell.nix",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "6260dcb06b7d2855cbcd0a0f36483453c311248e",
"sha256": "1q9bqgf41ch3dpghsvh74xqnj98h3khj4gxk9n2kq9qai12720yv",
"type": "tarball",
"url": "https://github.com/input-output-hk/haskell.nix/archive/6260dcb06b7d2855cbcd0a0f36483453c311248e.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"iohk-nix": {
"branch": "niv-snappy-choco",
"description": "nix scripts shared across projects",
Expand Down
4 changes: 2 additions & 2 deletions yarn2nix.nix
@@ -1,6 +1,6 @@
{ lib, pkgs, nodejs-8_x, python, api, apiVersion, cluster, buildNum, nukeReferences, fetchzip, daedalus, stdenv, win64 ? false, wine, runCommand, fetchurl }:
{ lib, pkgs, nodejs-12_x, python, api, apiVersion, cluster, buildNum, nukeReferences, fetchzip, daedalus, stdenv, win64 ? false, wine, runCommand, fetchurl }:
let
nodejs = nodejs-8_x;
nodejs = nodejs-12_x;
yarn2nix = import (fetchzip {
url = "https://github.com/moretea/yarn2nix/archive/v1.0.0.tar.gz";
sha256 = "02bzr9j83i1064r1r34cn74z7ccb84qb5iaivwdplaykyyydl1k8";
Expand Down

0 comments on commit 5f14f40

Please sign in to comment.