Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/cabal-source-repo/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main where

main :: IO ()
main = putStrLn "Hello, Haskell!"
8 changes: 8 additions & 0 deletions test/cabal-source-repo/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
packages:
./

source-repository-package
type: git
location: https://github.com/input-output-hk/haskell.nix.git
tag: bc01ebc05a8105035c9449943046b46c8364b932
subdir: test/cabal-simple
33 changes: 33 additions & 0 deletions test/cabal-source-repo/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix }:

with stdenv.lib;

let
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = import (callCabalProjectToNix {
index-state = "2019-04-30T00:00:00Z";
# reuse the cabal-simple test project
src = ./.;
});
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
name = "call-cabal-project-to-nix-test";

buildCommand = ''
exe="${packages.use-cabal-simple.components.exes.use-cabal-simple}/bin/use-cabal-simple"

printf "checking whether executable runs... " >& 2
$exe

touch $out
'';

meta.platforms = platforms.all;

passthru = {
# Attributes used for debugging with nix repl
inherit pkgSet packages;
};
}
26 changes: 26 additions & 0 deletions test/cabal-source-repo/use-cabal-simple.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cabal-version: >=1.10
-- Initial package description 'cabal-simple.cabal' generated by 'cabal
-- init'. For further documentation, see
-- http://haskell.org/cabal/users-guide/

name: use-cabal-simple
version: 0.1.0.0
-- synopsis:
-- description:
-- bug-reports:
license: PublicDomain
author: Rodney Lorrimar
maintainer: rodney.lorrimar@iohk.io
-- category:
build-type: Simple

executable use-cabal-simple
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base
, cabal-simple
, extra
, optparse-applicative
-- hs-source-dirs:
default-language: Haskell2010
1 change: 1 addition & 0 deletions test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ in {
shell-for = haskell.callPackage ./shell-for {};
callStackToNix = haskell.callPackage ./callStackToNix {};
callCabalProjectToNix = haskell.callPackage ./call-cabal-project-to-nix {};
cabal-source-repo = haskell.callPackage ./cabal-source-repo {};

# Run unit tests with: nix-instantiate --eval --strict -A unit
# An empty list means success.
Expand Down