Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ pkgs, haskellPackages }: 2 3let 4 # This can be regenerated by running `cabal2nix ./src` in the current directory. 5 pkgDef = 6 { 7 mkDerivation, 8 base, 9 lib, 10 }: 11 mkDerivation { 12 pname = "haskell-setBuildTarget"; 13 version = "0.1.0.0"; 14 src = ./src; 15 isLibrary = false; 16 isExecutable = true; 17 executableHaskellDepends = [ base ]; 18 license = "unknown"; 19 }; 20 21 drv = haskellPackages.callPackage pkgDef { }; 22 23 test = 24 target: excluded: 25 let 26 only = pkgs.haskell.lib.compose.setBuildTarget target drv; 27 in 28 '' 29 if [[ ! -f "${only}/bin/${target}" ]]; then 30 echo "${target} was not built" 31 exit 1 32 fi 33 34 if [[ -f "${only}/bin/${excluded}" ]]; then 35 echo "${excluded} was built, when it should not have been" 36 exit 1 37 fi 38 ''; 39 40in 41pkgs.runCommand "test haskell.lib.compose.setBuildTarget" 42 { 43 meta = { 44 inherit (drv.meta) platforms; 45 }; 46 } 47 '' 48 ${test "foo" "bar"} 49 ${test "bar" "foo"} 50 touch "$out" 51 ''