query
On this page

getName

lib.strings.getName

Docs pulled from | This Revision | about 1 hour ago


This function takes an argument x that's either a derivation or a derivation's "name" attribute and extracts the name part from that argument.

Inputs

x
1. Function argument

Type

getName :: String | Derivation -> String

Examples

lib.strings.getName usage example

getName "youtube-dl-2016.01.01"
=> "youtube-dl"
getName pkgs.youtube-dl
=> "youtube-dl"

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

getName = let
    parse = drv: (parseDrvName drv).name;
  in x:
    if isString x
    then parse x
    else x.pname or (parse x.name);