From 19ddb1466e09cbac4f288c1f26a7b23584cf7447 Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 8 Nov 2022 10:04:27 +0000 Subject: revert(nix/utils): onlyDrvPath to get the drvPath w/o the outputs This reverts commit 6813598c17959862734e5878d745e7dd8a197717. Reason for revert: This function is a re-implementation of builtins.unsafeDiscardOutputDependency which I missed at the time. Change-Id: I5bb52bfd5e8d51defaf90ee795b0fe99be84f6db Reviewed-on: https://cl.tvl.fyi/c/depot/+/7265 Tested-by: BuildkiteCI Reviewed-by: tazjin --- nix/utils/default.nix | 16 ---------------- nix/utils/tests/default.nix | 11 ----------- 2 files changed, 27 deletions(-) (limited to 'nix/utils') diff --git a/nix/utils/default.nix b/nix/utils/default.nix index a29f346519..0c6c88fafd 100644 --- a/nix/utils/default.nix +++ b/nix/utils/default.nix @@ -43,21 +43,6 @@ let else builtins.throw "Don't know how to get (base)name of " + lib.generators.toPretty { } p; - /* Retrieves the drvPath attribute from a given derivation, but ensures that - the resulting string only depends on the `.drv` file in the nix store and - not on its realised outputs as well. - - Type: drv -> string - */ - onlyDrvPath = drv: - let - inherit (drv) drvPath; - unsafeDrvPath = builtins.unsafeDiscardStringContext drvPath; - in - builtins.appendContext unsafeDrvPath { - ${unsafeDrvPath} = { path = true; }; - }; - /* Query the type of a path exposing the same information as would be by `builtins.readDir`, but for a single, specific target path. @@ -167,7 +152,6 @@ in { inherit storePathName - onlyDrvPath pathType isDirectory isRegularFile diff --git a/nix/utils/tests/default.nix b/nix/utils/tests/default.nix index d5159a8433..344a1771d7 100644 --- a/nix/utils/tests/default.nix +++ b/nix/utils/tests/default.nix @@ -15,7 +15,6 @@ let isSymlink pathType storePathName - onlyDrvPath ; assertUtilsPred = msg: act: exp: [ @@ -92,19 +91,9 @@ let (storePathName cleanedSource) cleanedSource.name) ]; - - onlyDrvPathTests = it "correctly updates the string context of drvPath" [ - (assertEq "onlyDrvPath only produces path dependencies" - (builtins.all - (dep: dep.path or false) - (builtins.attrValues - (builtins.getContext (onlyDrvPath depot.tools.cheddar)))) - true) - ]; in runTestsuite "nix.utils" [ pathPredicates storePathNameTests - onlyDrvPathTests ] -- cgit 1.4.1