diff --git a/test/backpack/cabal.project b/test/backpack/cabal.project new file mode 100644 index 0000000000..564ecc4881 --- /dev/null +++ b/test/backpack/cabal.project @@ -0,0 +1,13 @@ +allow-newer: + , unpacked-containers:* + , unpacked-unordered-containers:* + +source-repository-package + type: git + location: https://github.com/ekmett/unpacked-containers + tag: 7dc56993a57511b58257b5d389473e638a7082d2 + --sha256: 1vijp2hs9ynfm8k2yrv06ccpfi1n2s2b5bqvzrjdd3gqn4bi66q4 + subdir: + unpacked-containers + unpacked-unordered-containers + diff --git a/test/backpack/default.nix b/test/backpack/default.nix new file mode 100644 index 0000000000..47a001e2e7 --- /dev/null +++ b/test/backpack/default.nix @@ -0,0 +1,62 @@ +{ stdenv +, lib +, fetchFromGitHub +, cabalProject' +, haskellLib +, recurseIntoAttrs +, compiler-nix-name +, evalPackages +, ... +}: + + +let + project = cabalProject' { + inherit compiler-nix-name evalPackages; + src = fetchFromGitHub { + owner = "ekmett"; + repo = "unpacked-containers"; + rev = "7dc56993a57511b58257b5d389473e638a7082d2"; + hash = "sha256-BBsTF7H4jdZk/huvsoQWNkR3GTNgZy8mqs76pKG4Mu4="; + }; + cabalProjectLocal = '' + allow-newer: + , unpacked-containers:* + , unpacked-unordered-containers:* + ''; + + }; + + packages = haskellLib.selectProjectPackages project.hsPkgs; + components = lib.concatMap haskellLib.getAllComponents (lib.attrValues packages); + +in +recurseIntoAttrs { + ifdInputs = { + plan-nix = lib.addMetaAttrs + { + platforms = lib.platforms.all; + # Making this work for cross compilers will be difficult. + disabled = stdenv.buildPlatform != stdenv.hostPlatform; + } + project.plan-nix; + }; + + run = stdenv.mkDerivation { + name = "backpack-test"; + + buildCommand = '' + printf ${lib.concatStringsSep " " components} + touch $out + ''; + + meta = { + platforms = lib.platforms.all; + }; + + passthru = { + # Used for debugging with nix repl + inherit project packages; + }; + }; +} diff --git a/test/default.nix b/test/default.nix index 9ca3cbb580..540b457eec 100644 --- a/test/default.nix +++ b/test/default.nix @@ -178,6 +178,7 @@ let # All tests. allTests = { + backpack = callTest ./backpack { }; cabal-simple = callTest ./cabal-simple { inherit util; }; cabal-simple-debug = callTest ./cabal-simple-debug { inherit util; }; cabal-simple-prof = callTest ./cabal-simple-prof { inherit util; };