Skip to content

Commit

Permalink
tests.haskell.cabalSdist: avoid lib.fileset
Browse files Browse the repository at this point in the history
  • Loading branch information
emilazy committed Dec 31, 2024
1 parent 3a2ebaa commit abab2a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
18 changes: 3 additions & 15 deletions pkgs/test/haskell/cabalSdist/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,7 @@
}:

let
src = lib.fileset.toSource {
root = ./local;
fileset = lib.fileset.unions [
./local/app
./local/CHANGELOG.md
./local/local.cabal
];
};
# This prevents the source from depending on the formatting of the ./local/generated.nix file
localRaw = haskell.lib.compose.overrideSrc {
inherit src;
} (haskellPackages.callPackage ./local/generated.nix { });
localRaw = haskellPackages.callPackage ./generated.nix { };
in
lib.recurseIntoAttrs rec {

Expand All @@ -28,7 +17,6 @@ lib.recurseIntoAttrs rec {

localFromCabalSdist = haskellPackages.buildFromCabalSdist localRaw;

# NOTE: ./local refers to the "./." path in `./local/generated.nix`.
# This test makes sure that localHasNoDirectReference can actually fail if
# it doesn't do anything. If this test fails, either the test setup was broken,
# or Haskell packaging has changed the way `src` is treated in such a way that
Expand All @@ -39,7 +27,7 @@ lib.recurseIntoAttrs rec {
drvPath = builtins.unsafeDiscardOutputDependency localRaw.drvPath;
}
''
grep ${src} $drvPath >/dev/null
grep ${localRaw.src} $drvPath >/dev/null
touch $out
'';

Expand All @@ -49,7 +37,7 @@ lib.recurseIntoAttrs rec {
drvPath = builtins.unsafeDiscardOutputDependency localFromCabalSdist.drvPath;
}
''
grep -v ${src} $drvPath >/dev/null
grep -v ${localRaw.src} $drvPath >/dev/null
touch $out
'';
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# nix run ../../../../..#cabal2nix -- ./.
{
mkDerivation,
base,
lib,
}:
# nix run ../../../../..#cabal2nix -- ./local
{ mkDerivation, base, lib }:
mkDerivation {
pname = "local";
version = "0.1.0.0";
src = ./.; # also referred to as ./local in the test; these are the same path constants
src = ./local;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base ];
description = "Nixpkgs test case";
license = lib.licenses.mit;
mainProgram = "local";
}

0 comments on commit abab2a4

Please sign in to comment.