about summary refs log tree commit diff
path: root/web/bubblegum
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-04-20T08·18+0200
committersterni <sternenseemann@systemli.org>2021-04-20T11·00+0000
commitf88ac5c0b5292ad2398927fd0ec97489399493e6 (patch)
treea9232fc9b0c2a260c10ea503db2d31e214954dd8 /web/bubblegum
parentc21dee2b5bad39a44afb900684236c48f767069a (diff)
feat(nix/utils): add storePathName, a more generic baseNameOf r/2532
This is a wrapper around baseNameOf which also can deal with
derivations. Added to //nix/utils since I've found myself introducing an
ad-hoc implementation of this for both //web/bubblegum and //nix/buildC.

Change-Id: I2fcd97a150d6eda21ab323fa0d881ff7442a892e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3049
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'web/bubblegum')
-rw-r--r--web/bubblegum/default.nix14
1 files changed, 6 insertions, 8 deletions
diff --git a/web/bubblegum/default.nix b/web/bubblegum/default.nix
index d9b106ddde..ed4e48839b 100644
--- a/web/bubblegum/default.nix
+++ b/web/bubblegum/default.nix
@@ -5,6 +5,7 @@ let
   inherit (depot.nix)
     runExecline
     getBins
+    utils
     ;
 
   statusCodes = {
@@ -179,16 +180,13 @@ let
       # the input path or name of the input derivation.
       # Must be given if the input is a string.
     , name ? null
-    }:
+    , ...
+    }@args:
     input: let
       drvName =
-        if name != null
-        then name
-        else if builtins.isPath input
-        then baseNameOf input
-        else if lib.isDerivation input
-        then input.name
-        else builtins.throw "Need name";
+        if builtins.isString input || args ? name
+        then args.name
+        else utils.storePathName input;
       script =
         if builtins.isPath input || lib.isDerivation input
         then input