From ee131c489621ae2ab6f6455cdb51e0e6e54cf1cd Mon Sep 17 00:00:00 2001 From: michael bishop Date: Fri, 30 Jun 2017 02:03:15 -0300 Subject: [PATCH] ensure pkgs/default.nix is up to date --- .travis.yml | 1 + default.nix | 10 +++++++-- jobsets/cardano.nix | 5 ++--- pkgs/default.nix | 45 +++++++++++++++++--------------------- pkgs/generate.sh | 14 +++++++----- pkgs/stack2nix.nix | 22 +++++++++---------- scripts/check-stack2nix.sh | 10 +++++++++ shell.nix | 5 +---- 8 files changed, 62 insertions(+), 50 deletions(-) create mode 100755 scripts/check-stack2nix.sh diff --git a/.travis.yml b/.travis.yml index 1976526941b..09faaa92ee8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ install: - touch keys/key{0,1,2,3,4,5,6,7,8,9,10,11,12,13,41}.sk script: - ./scripts/find-all-revisions.sh + - nix-shell -p cabal2nix stack cabal-install ghc -Q -j 4 --run scripts/check-stack2nix.sh - nixops --version # check all scripts compile - iohk-ops --help diff --git a/default.nix b/default.nix index 4d6a31ad583..65baf173d83 100644 --- a/default.nix +++ b/default.nix @@ -12,7 +12,7 @@ let }); socket-io-src = pkgs.fetchgit (removeAttrs (importJSON ./pkgs/engine-io.json) ["date"]); -in (import pkgs/default.nix { inherit pkgs compiler; }).override { + iohkpkgs = ((import pkgs/default.nix { inherit pkgs compiler; }).override { overrides = self: super: { cardano-sl-core = prodMode super.cardano-sl-core; cardano-sl = overrideCabal super.cardano-sl (drv: { @@ -55,4 +55,10 @@ in (import pkgs/default.nix { inherit pkgs compiler; }).override { #enableLibraryProfiling = false; #}); }; -} +}); + cabal2nixpkgs = rec { + # extra packages to expose, that have no relation to pkgs/default.nix + stack2nix = compiler.callPackage ./pkgs/stack2nix.nix {}; + iohk-ops = compiler.callPackage (import ./iohk) {}; + }; +in iohkpkgs // cabal2nixpkgs diff --git a/jobsets/cardano.nix b/jobsets/cardano.nix index caaf46fec65..3e9d1743968 100644 --- a/jobsets/cardano.nix +++ b/jobsets/cardano.nix @@ -6,8 +6,7 @@ in { pkgs ? (import fixedNixpkgs {}), supportedSystems ? [ "x86_64-linux" ] }: let iohkpkgs = import ./../default.nix { inherit pkgs; }; in with pkgs; rec { - inherit (iohkpkgs) cardano-report-server-static cardano-sl-static cardano-sl-explorer-static cardano-sl iohk-ops; - stack2nix = iohkpkgs.callPackage ./../pkgs/stack2nix.nix {}; + inherit (iohkpkgs) cardano-report-server-static cardano-sl-static cardano-sl-explorer-static cardano-sl iohk-ops stack2nix; tests = import ./../tests { inherit pkgs supportedSystems; }; - iohk-shell-env = import ./../shell.nix { inherit pkgs iohkpkgs stack2nix; }; + iohk-shell-env = import ./../shell.nix { inherit pkgs iohkpkgs; }; } diff --git a/pkgs/default.nix b/pkgs/default.nix index 94d20ac892a..5b9f44960cc 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -762,8 +762,6 @@ self: { pname = "authenticate-oauth"; version = "1.6"; sha256 = "0xc37yql79r9idjfdhzg85syrwwgaxggcv86myi6zq2pzl89yvfj"; - revision = "1"; - editedCabalFile = "ba9e93e7b949fa4799ae7b3cb302df38dc7fb0be0460803b6c48636317b2bcbb"; libraryHaskellDepends = [ base base64-bytestring @@ -1431,8 +1429,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; isLibrary = true; isExecutable = true; @@ -1623,7 +1621,6 @@ self: { bytestring cardano-sl-core cardano-sl-infra - cardano-sl-lrc cardano-sl-ssc cardano-sl-txp cardano-sl-update @@ -1688,8 +1685,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; postUnpack = "sourceRoot+=/core; echo source root reset to \$sourceRoot"; libraryHaskellDepends = [ @@ -1762,8 +1759,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; postUnpack = "sourceRoot+=/db; echo source root reset to \$sourceRoot"; libraryHaskellDepends = [ @@ -1800,8 +1797,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; postUnpack = "sourceRoot+=/godtossing; echo source root reset to \$sourceRoot"; libraryHaskellDepends = [ @@ -1848,8 +1845,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; postUnpack = "sourceRoot+=/infra; echo source root reset to \$sourceRoot"; libraryHaskellDepends = [ @@ -1910,8 +1907,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; postUnpack = "sourceRoot+=/lrc; echo source root reset to \$sourceRoot"; libraryHaskellDepends = [ @@ -1940,8 +1937,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; postUnpack = "sourceRoot+=/ssc; echo source root reset to \$sourceRoot"; libraryHaskellDepends = [ @@ -1977,8 +1974,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; postUnpack = "sourceRoot+=/txp; echo source root reset to \$sourceRoot"; libraryHaskellDepends = [ @@ -2023,8 +2020,8 @@ self: { version = "0.4.4"; src = fetchgit { url = "https://github.com/input-output-hk/cardano-sl.git"; - sha256 = "1li70k82mvyn4psmwcjjdhvcbrdliq0mcxx3g7q8r1cpam77c27k"; - rev = "4bcf1e6b601d531f753ebdb6aec23e19d4b08e6c"; + sha256 = "05zk3bm27lmcfi2a93c70r3s0z79ah31j3zkib52arm5y15yh55h"; + rev = "1239a6a876fbbb970e836c8bc6bb72d781ba2fa9"; }; postUnpack = "sourceRoot+=/update; echo source root reset to \$sourceRoot"; libraryHaskellDepends = [ @@ -5174,8 +5171,6 @@ self: { pname = "memory"; version = "0.14.5"; sha256 = "01d1bg8pkhw9mpyd7nm5zzpqv9kh9cj2fkd2ywvkay7np2r14820"; - revision = "1"; - editedCabalFile = "fe81cc9b260784b0e8e71d4953441fc97a575200732ded56ce25c0900744e605"; libraryHaskellDepends = [ base bytestring @@ -8194,8 +8189,8 @@ self: { universum = callPackage ({ base, bytestring, containers, deepseq, exceptions, ghc-prim, hashable, microlens, microlens-mtl, mkDerivation, mtl, safe, stdenv, stm, text, text-format, transformers, type-operators, unordered-containers, utf8-string, vector }: mkDerivation { pname = "universum"; - version = "0.4.3"; - sha256 = "17rrikfid54z8h95qns5q7bdxadnnggv1pl2d9ilz9pz9hi7a9g6"; + version = "0.4.2"; + sha256 = "1chyj0mrrfhzhd6wrj9wlxyil9jiyq6yvk27dvh6qzj7qrw2ilzz"; libraryHaskellDepends = [ base bytestring diff --git a/pkgs/generate.sh b/pkgs/generate.sh index 1b7f209a048..dcf27c729e9 100755 --- a/pkgs/generate.sh +++ b/pkgs/generate.sh @@ -6,6 +6,7 @@ function runInShell { } set -xe +set -v # Get relative path to script directory scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") @@ -15,23 +16,26 @@ source ${scriptDir}/../scripts/set_nixpath.sh # Generate stack2nix Nix package runInShell cabal2nix \ --no-check \ - --revision $(jq .rev < ../stack2nix-src.json -r) \ + --revision $(jq .rev < ${scriptDir}/../stack2nix-src.json -r) \ https://github.com/input-output-hk/stack2nix.git > $scriptDir/stack2nix.nix # Build stack2nix Nix package -nix-build -E "with import {}; haskell.packages.ghc802.callPackage ${scriptDir}/stack2nix.nix {}" -o $scriptDir/stack2nix +nix-build ${scriptDir}/.. -A stack2nix -o $scriptDir/stack2nix # Generate explorer until it's merged with cardano-sl repo runInShell cabal2nix \ --no-check \ - --revision $(jq .rev < ../cardano-sl-explorer-src.json -r) \ + --revision $(jq .rev < ${scriptDir}/../cardano-sl-explorer-src.json -r) \ https://github.com/input-output-hk/cardano-sl-explorer.git > $scriptDir/cardano-sl-explorer.nix # Generate cardano-sl package set runInShell $scriptDir/stack2nix/bin/stack2nix \ - --revision $(jq .rev < ../cardano-sl-src.json -r) \ - https://github.com/input-output-hk/cardano-sl.git > $scriptDir/default.nix + --revision $(jq .rev < ${scriptDir}/../cardano-sl-src.json -r) \ + https://github.com/input-output-hk/cardano-sl.git > $scriptDir/default.nix.new +mv $scriptDir/default.nix.new $scriptDir/default.nix # Generate iohk-ops expression for Hydra # Manual build with: nix-build --no-build-output --cores 0 -E "with import {}; haskell.packages.ghc802.callPackage iohk/default.nix {}" +pushd $scriptDir runInShell cabal2nix ./.. > $scriptDir/../iohk/default.nix +popd diff --git a/pkgs/stack2nix.nix b/pkgs/stack2nix.nix index ded4ea5e6c3..b0e7e6a3afc 100644 --- a/pkgs/stack2nix.nix +++ b/pkgs/stack2nix.nix @@ -1,24 +1,24 @@ -{ mkDerivation, async, base, bytestring, containers, data-fix -, directory, fetchgit, filepath, Glob, hnix, monad-parallel -, optparse-applicative, process, SafeSemaphore, stdenv, temporary -, text, yaml +{ mkDerivation, async, base, bytestring, Cabal, containers +, data-fix, directory, fetchgit, filepath, Glob, hnix +, monad-parallel, optparse-applicative, process, SafeSemaphore +, stdenv, temporary, text, yaml }: mkDerivation { pname = "stack2nix"; - version = "0.1.0.0"; + version = "0.1.2.0"; src = fetchgit { url = "https://github.com/input-output-hk/stack2nix.git"; - sha256 = "1vc8w9b7i4wr1jx5zj7kvxj1901ck15scj3556h8j8c64g6ppr8k"; - rev = "8f087b92f83be078e8cfe86fb243121dca4601ba"; + sha256 = "076rsasis3vxbfrp5r3aar4yz9qcrawy8hysvbix62823w12lfas"; + rev = "3f2d4d31b1936dda71ce9a3be145c6407685045e"; }; isLibrary = true; isExecutable = true; libraryHaskellDepends = [ - async base bytestring containers data-fix directory filepath Glob - hnix monad-parallel process SafeSemaphore temporary text yaml + async base bytestring Cabal containers data-fix directory filepath + Glob hnix monad-parallel process SafeSemaphore temporary text yaml ]; - executableHaskellDepends = [ base optparse-applicative ]; + executableHaskellDepends = [ base Cabal optparse-applicative ]; doCheck = false; description = "Convert stack.yaml files into Nix build instructions."; - license = stdenv.lib.licenses.bsd3; + license = stdenv.lib.licenses.mit; } diff --git a/scripts/check-stack2nix.sh b/scripts/check-stack2nix.sh new file mode 100755 index 00000000000..5d576e48671 --- /dev/null +++ b/scripts/check-stack2nix.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -xe + +# Get relative path to script directory +scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") + +source ${scriptDir}/../pkgs/generate.sh + +git diff --text --exit-code diff --git a/shell.nix b/shell.nix index 128f6125dc7..26af3976c59 100644 --- a/shell.nix +++ b/shell.nix @@ -3,7 +3,6 @@ , nixpkgs ? lib.fetchNixPkgs , pkgs ? import nixpkgs {} , iohkpkgs ? import ./default.nix { inherit pkgs; } -, stack2nix ? iohkpkgs.callPackage ./pkgs/stack2nix.nix {} }: let compiler = pkgs.haskell.packages."${ghcVer}"; @@ -24,8 +23,6 @@ ghc = ghcOrig.override (oldArgs: { in with new; parent // { # intero = overGithub old.intero "commercialhaskell/intero" # "e546ea086d72b5bf8556727e2983930621c3cb3c" "1qv7l5ri3nysrpmnzfssw8wvdvz0f6bmymnz1agr66fplazid4pn" { doCheck = false; }; - inherit stack2nix; - iohk-ops = iohkpkgs.callPackage (import ./iohk) {}; }; }); @@ -59,6 +56,6 @@ mkDerivation { license = stdenv.lib.licenses.mit; }; -drv = ghc.callPackage drvf {}; +drv = pkgs.haskellPackages.callPackage drvf { inherit (iohkpkgs) stack2nix iohk-ops; }; in if pkgs.lib.inNixShell then drv.env else drv