Skip to content
This repository has been archived by the owner on Jun 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #82 from input-output-hk/stack2nix-travis-testing
Browse files Browse the repository at this point in the history
[DEVOPS-32] ensure pkgs/default.nix is up to date
  • Loading branch information
domenkozar authored Jul 1, 2017
2 parents bc1a2e8 + c06bc33 commit 235dd70
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 58 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ install:
- echo "binary-caches = https://cache.nixos.org https://hydra.iohk.io" >> ~/nix.conf
- echo "binary-cache-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" >> ~/nix.conf
- export NIX_CONF_DIR=~
- nix-env -iA nixopsUnstable -f '<nixpkgs>'
- nix-env -f '<nixpkgs>' -i -A nixopsUnstable -A git
- nix-env -iA iohk-ops -f 'default.nix'
- touch static/datadog-{api,application}.secret
- echo "secret" > static/tarsnap-cardano-deployer.secret
- mkdir keys
- touch keys/key{0,1,2,3,4,5,6,7,8,9,10,11,12,13,41}.sk
script:
- git --version
- ./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
Expand Down
6 changes: 3 additions & 3 deletions cardano-sl-explorer-src.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"url": "https://github.com/input-output-hk/cardano-sl-explorer.git",
"rev": "982ac2dd3efeca6fd7ebc1df11e9d1bf628c1700",
"date": "2017-06-14T12:23:15+02:00",
"sha256": "0gia9zp5nhyqc4i4say4yf8w4r6im6syrxkd33prl0wq2j3y0337",
"rev": "c5bebf1b1f343f952182a598f5c9e625998b2b70",
"date": "2017-06-27T19:33:12+02:00",
"sha256": "1lm0a07vb1hqavrraq75ifscfhkrdgqsg62l1nmn86yiwpk40q8d",
"fetchSubmodules": true
}
6 changes: 3 additions & 3 deletions cardano-sl-src.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"url": "https://github.com/input-output-hk/cardano-sl.git",
"rev": "b70844676db4658553a1e0b258e9e1cc8469cc3a",
"date": "2017-06-22T17:14:39+03:00",
"sha256": "0jpvlw287gn0xasnv4kjl6xqqrg7camfwv92vmhqx6a7ay5srs8n",
"rev": "86ab2c4dd5cfec64a0eca4ff996c02a40bbe733d",
"date": "2017-06-29T14:54:09+02:00",
"sha256": "09l50wq641r0x3b7g9v286s25hswjkm2dfcq0rajhfrcpd8ad32w",
"fetchSubmodules": true
}
10 changes: 8 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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
5 changes: 2 additions & 3 deletions jobsets/cardano.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
}
4 changes: 2 additions & 2 deletions pkgs/cardano-sl-explorer.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ mkDerivation {
version = "0.1.0";
src = fetchgit {
url = "https://github.com/input-output-hk/cardano-sl-explorer.git";
sha256 = "0gia9zp5nhyqc4i4say4yf8w4r6im6syrxkd33prl0wq2j3y0337";
rev = "982ac2dd3efeca6fd7ebc1df11e9d1bf628c1700";
sha256 = "1lm0a07vb1hqavrraq75ifscfhkrdgqsg62l1nmn86yiwpk40q8d";
rev = "c5bebf1b1f343f952182a598f5c9e625998b2b70";
};
isLibrary = true;
isExecutable = true;
Expand Down
161 changes: 131 additions & 30 deletions pkgs/default.nix

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions pkgs/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function runInShell {
}

set -xe
set -v

# Get relative path to script directory
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
Expand All @@ -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 <nixpkgs> {}; 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 <nixpkgs> {}; haskell.packages.ghc802.callPackage iohk/default.nix {}"
pushd $scriptDir
runInShell cabal2nix ./.. > $scriptDir/../iohk/default.nix
popd
4 changes: 2 additions & 2 deletions pkgs/stack2nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ mkDerivation {
version = "0.1.0.0";
src = fetchgit {
url = "https://github.com/input-output-hk/stack2nix.git";
sha256 = "1vc8w9b7i4wr1jx5zj7kvxj1901ck15scj3556h8j8c64g6ppr8k";
rev = "8f087b92f83be078e8cfe86fb243121dca4601ba";
sha256 = "01b8kc205m6p2q3l4an0gx9062w9szjkk139m3qnra7g4bh5551g";
rev = "59ee4de0223da8ad8ae56adb02f39ec365a20d42";
};
isLibrary = true;
isExecutable = true;
Expand Down
10 changes: 10 additions & 0 deletions scripts/check-stack2nix.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}";
Expand All @@ -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) {};
};
});

Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions stack2nix-src.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"url": "https://github.com/input-output-hk/stack2nix.git",
"rev": "3f2d4d31b1936dda71ce9a3be145c6407685045e",
"date": "2017-06-25T08:01:38-07:00",
"sha256": "076rsasis3vxbfrp5r3aar4yz9qcrawy8hysvbix62823w12lfas",
"rev": "59ee4de0223da8ad8ae56adb02f39ec365a20d42",
"date": "2017-06-16T14:08:22-07:00",
"sha256": "01b8kc205m6p2q3l4an0gx9062w9szjkk139m3qnra7g4bh5551g",
"fetchSubmodules": true
}

0 comments on commit 235dd70

Please sign in to comment.