From ae10abc7f247ed2e8edf62a0fe7ce5876857f127 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 9 Oct 2019 16:51:06 +0200 Subject: [PATCH] Update dhall-haskell, enable tests for Hydra --- .gitmodules | 3 -- default.nix | 6 ++-- dhall-haskell | 1 - dhall-haskell.nix | 2 ++ dhallPinnedNixpkgs.nix | 67 +++++++++++++++++++++++++++++++++++ release.nix | 24 ++++++++++--- tests/default.nix | 26 +++++++++----- toolchain-overlay/default.nix | 4 --- 8 files changed, 107 insertions(+), 26 deletions(-) delete mode 160000 dhall-haskell create mode 100644 dhall-haskell.nix create mode 100644 dhallPinnedNixpkgs.nix diff --git a/.gitmodules b/.gitmodules index 32f45d3..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "dhall-haskell"] - path = dhall-haskell - url = https://github.com/ehmry/dhall-haskell.git diff --git a/default.nix b/default.nix index d8ce6cc..6ea0423 100644 --- a/default.nix +++ b/default.nix @@ -16,9 +16,7 @@ let toolchainOverlay = import ./toolchain-overlay; # Overlay of toolchain patches - nixpkgs' = import ./nixpkgs.nix; - -in { nixpkgs ? nixpkgs', dhall-haskell ? ./dhall-haskell.nix }: +in { nixpkgs ? import ./nixpkgs.nix }: import nixpkgs { # Evaluate an overlayed Nixpkgs for a Genode target @@ -28,5 +26,5 @@ import nixpkgs { isGenode = true; imports = [ ./platform.nix ]; }; - overlays = [ (toolchainOverlay dhall-haskell) pkgOverlay ]; + overlays = [ toolchainOverlay pkgOverlay ]; } diff --git a/dhall-haskell b/dhall-haskell deleted file mode 160000 index 7b36df7..0000000 --- a/dhall-haskell +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7b36df7725a5ed40ef7bd803bb0d3eabbbbde74a diff --git a/dhall-haskell.nix b/dhall-haskell.nix new file mode 100644 index 0000000..bda6c49 --- /dev/null +++ b/dhall-haskell.nix @@ -0,0 +1,2 @@ +let dhall-haskell = import ; +in { linux-dhall = dhall-haskell.dhall; } diff --git a/dhallPinnedNixpkgs.nix b/dhallPinnedNixpkgs.nix new file mode 100644 index 0000000..50805e1 --- /dev/null +++ b/dhallPinnedNixpkgs.nix @@ -0,0 +1,67 @@ +let + fetchNixpkgs = + { rev # The Git revision of nixpkgs to fetch + , owner ? "NixOS" # Owner of the Github repository + , sha256 # The SHA256 hash of the unpacked archive + , system ? builtins.currentSystem # This is overridable if necessary + }: + + if (0 <= builtins.compareVersions builtins.nixVersion "1.12") + + # In Nix 1.12, we can just give a `sha256` to `builtins.fetchTarball`. + then + (builtins.fetchTarball { + url = "https://github.com/${owner}/nixpkgs/archive/${rev}.tar.gz"; + inherit sha256; + }) + + # This hack should at least work for Nix 1.11 + else + ((rec { + tarball = import { + url = "https://github.com/${owner}/nixpkgs/archive/${rev}.tar.gz"; + sha256 = null; + }; + + builtin-paths = import ; + + script = builtins.toFile "nixpkgs-unpacker" '' + "$coreutils/mkdir" "$out" + cd "$out" + "$gzip" --decompress < "$tarball" | "$tar" -x --strip-components=1 + ''; + + nixpkgs = builtins.derivation ({ + name = "nixpkgs-${builtins.substring 0 6 rev}"; + + builder = builtins.storePath builtin-paths.shell; + + args = [ script ]; + + inherit tarball system; + + tar = builtins.storePath builtin-paths.tar; + gzip = builtins.storePath builtin-paths.gzip; + coreutils = builtins.storePath builtin-paths.coreutils; + } // (if null == sha256 then + { } + else { + outputHashMode = "recursive"; + outputHashAlgo = "sha256"; + outputHash = sha256; + })); + }).nixpkgs); +in { + + nixpkgs = fetchNixpkgs { + rev = "1d4de0d552ae9aa66a5b8dee5fb0650a4372d148"; + sha256 = "0xpqc1fhkvvv5dv1zmas2j1q27mi7j7dgyjcdh82mlgl1q63i660"; + }; + + nixpkgsStaticLinux = fetchNixpkgs { + owner = "nh2"; + rev = "925aac04f4ca58aceb83beef18cb7dae0715421b"; + sha256 = "1zr8lscjl2a5cz61f0ibyx55a94v8yyp6sjzjl2gkqjrjbg99abx"; + }; + +} diff --git a/release.nix b/release.nix index 1c35774..aa84a2c 100644 --- a/release.nix +++ b/release.nix @@ -2,16 +2,30 @@ # # SPDX-License-Identifier: LicenseRef-Hippocratic-1.1 -{ genodepkgs ? builtins.fetchGit ./., nixpkgs ? -, dhall-haskell ? ./dhall-haskell.nix }: +let dhallPinned = import ./dhallPinnedNixpkgs.nix; in -let pkgs = import ./default.nix { inherit nixpkgs; }; +{ genodepkgs ? ./default.nix +, nixpkgs ? import ./nixpkgs.nix +, dhall-haskell ? +, dhallNixpkgs ? dhallPinned.nixpkgs +, dhallNixpkgsStaticLinux ? dhallPinned.nixpkgsStaticLinux +}: + +let + pkgs = import genodepkgs { inherit nixpkgs; }; + dhall-haskell' = import (dhall-haskell + "/release.nix") { + nixpkgs = dhallNixpkgs; + nixpkgsStaticLinux = dhallNixpkgsStaticLinux; + }; in { build.x86_64 = { inherit (pkgs) nova stdenv solo5; genode = removeAttrs pkgs.genode [ "override" "overrideDerivation" ]; }; - # tests.x86_64 = import ./tests { inherit pkgs; }; - # Disable tests because of Dhall issues + tests = import ./tests { + inherit nixpkgs; + genodepkgs = pkgs; + dhall-haskell = dhall-haskell'; + }; } diff --git a/tests/default.nix b/tests/default.nix index acffff7..4423a4e 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -11,18 +11,24 @@ let solo5 = call ./solo5.nix { }; solo5-ping = call ./solo5-ping.nix { }; }; - nixpkgs' = import ./../nixpkgs.nix; -in { nixpkgs ? nixpkgs' }: +in + +{ genodepkgs ? import ./../default.nix { } +, nixpkgs ? import ./../nixpkgs.nix +, dhall-haskell +}: let - hostPkgs = import nixpkgs { }; - testPkgs = import ./.. { inherit nixpkgs; }; + hostPkgs = import nixpkgs { + overlays = [ (self: super: { dhall = dhall-haskell.linux-dhall; }) ]; + }; + testPkgs = genodepkgs; lib = hostPkgs.lib // { renderDhallInit = path: args: hostPkgs.runCommand "init.xml" { - buildInputs = [ testPkgs.buildPackages.linux-dhall ]; + buildInputs = [ hostPkgs.dhall ]; initConfig = path; initArgs = args; DHALL_PRELUDE = "${testPkgs.dhallPackages.prelude}/package.dhall"; @@ -36,8 +42,10 @@ let }; in { - linux = tests - (import ./driver-linux.nix { inherit testPkgs hostPkgs lib; }).callTest; - nova = tests - (import ./driver-nova.nix { inherit testPkgs hostPkgs lib; }).callTest; + x86_64 = { + linux = tests + (import ./driver-linux.nix { inherit testPkgs hostPkgs lib; }).callTest; + nova = tests + (import ./driver-nova.nix { inherit testPkgs hostPkgs lib; }).callTest; + }; } diff --git a/toolchain-overlay/default.nix b/toolchain-overlay/default.nix index 25b9c1d..3425dec 100644 --- a/toolchain-overlay/default.nix +++ b/toolchain-overlay/default.nix @@ -2,8 +2,6 @@ # # SPDX-License-Identifier: LicenseRef-Hippocratic-1.1 -dhall-haskell: - self: super: let @@ -35,8 +33,6 @@ in { null; }); - inherit (import dhall-haskell) linux-dhall; - genodeHeaders = self.callPackage ./headers { }; inherit genodelibc;