Browse Source

Merge pull request #74058 from Ericson2314/wrapper-pname-support-19.09

treewide: Purge most parseDrvName preserving compat for 19.09
genode
John Ericson 1 year ago
parent
commit
1d3511851d
No account linked to committer's email address
42 changed files with 99 additions and 97 deletions
  1. 5
    6
      doc/configuration.xml
  2. 2
    1
      lib/default.nix
  3. 17
    0
      lib/strings.nix
  4. 1
    1
      maintainers/scripts/update.nix
  5. 4
    8
      nixos/modules/services/databases/mysql.nix
  6. 1
    1
      nixos/modules/services/networking/znc/default.nix
  7. 2
    2
      nixos/modules/system/boot/loader/grub/grub.nix
  8. 1
    1
      pkgs/applications/editors/kdevelop5/kdevelop.nix
  9. 6
    8
      pkgs/applications/misc/sweethome3d/default.nix
  10. 5
    8
      pkgs/applications/misc/sweethome3d/editors.nix
  11. 5
    3
      pkgs/applications/networking/browsers/firefox/wrapper.nix
  12. 1
    1
      pkgs/applications/networking/instant-messengers/slack/update.sh
  13. 1
    1
      pkgs/applications/networking/instant-messengers/zoom-us/update.sh
  14. 1
    1
      pkgs/applications/version-management/git-and-tools/git/update.sh
  15. 1
    1
      pkgs/applications/version-management/monotone/default.nix
  16. 1
    1
      pkgs/applications/video/vdr/wrapper.nix
  17. 1
    1
      pkgs/applications/virtualization/OVMF/default.nix
  18. 3
    3
      pkgs/build-support/bintools-wrapper/default.nix
  19. 3
    3
      pkgs/build-support/cc-wrapper/default.nix
  20. 2
    2
      pkgs/common-updater/scripts/update-source-version
  21. 2
    3
      pkgs/desktops/gnome-3/default.nix
  22. 1
    1
      pkgs/development/compilers/chicken/4/eggDerivation.nix
  23. 2
    2
      pkgs/development/em-modules/generic/default.nix
  24. 1
    1
      pkgs/development/interpreters/lua-5/build-lua-package.nix
  25. 1
    1
      pkgs/development/libraries/science/math/caffe2/default.nix
  26. 1
    1
      pkgs/development/lisp-modules/openssl-lib-marked.nix
  27. 3
    3
      pkgs/development/perl-modules/generic/default.nix
  28. 1
    1
      pkgs/development/tools/analysis/radare2/update.py
  29. 1
    1
      pkgs/development/tools/continuous-integration/jenkins/update.sh
  30. 3
    4
      pkgs/development/tools/documentation/antora/default.nix
  31. 2
    8
      pkgs/misc/emulators/retroarch/wrapper.nix
  32. 1
    1
      pkgs/misc/emulators/wine/staging.nix
  33. 1
    1
      pkgs/misc/tmux-plugins/default.nix
  34. 1
    1
      pkgs/misc/vim-plugins/build-vim-plugin.nix
  35. 2
    2
      pkgs/os-specific/linux/prl-tools/default.nix
  36. 2
    2
      pkgs/servers/x11/xorg/overrides.nix
  37. 1
    1
      pkgs/shells/zsh/oh-my-zsh/update.sh
  38. 1
    1
      pkgs/tools/audio/acoustid-fingerprinter/default.nix
  39. 1
    1
      pkgs/tools/inputmethods/ibus/wrapper.nix
  40. 1
    1
      pkgs/tools/security/afl/libdislocator.nix
  41. 6
    6
      pkgs/top-level/all-packages.nix
  42. 1
    1
      pkgs/top-level/lua-packages.nix

+ 5
- 6
doc/configuration.xml View File

@@ -141,11 +141,10 @@
141 141
      For a more useful example, try the following. This configuration only allows unfree packages named flash player and visual studio code:
142 142
 <programlisting>
143 143
 {
144
-  allowUnfreePredicate = (pkg: builtins.elem
145
-    (builtins.parseDrvName pkg.name).name [
146
-      "flashplayer"
147
-      "vscode"
148
-    ]);
144
+  allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
145
+    "flashplayer"
146
+    "vscode"
147
+  ];
149 148
 }
150 149
 </programlisting>
151 150
     </para>
@@ -217,7 +216,7 @@
217 216
      The following configuration example only allows insecure packages with very short names:
218 217
 <programlisting>
219 218
 {
220
-  allowInsecurePredicate = (pkg: (builtins.stringLength (builtins.parseDrvName pkg.name).name) &lt;= 5);
219
+  allowInsecurePredicate = pkg: builtins.stringLength (lib.getName pkg) &lt;= 5;
221 220
 }
222 221
 </programlisting>
223 222
     </para>

+ 2
- 1
lib/default.nix View File

@@ -84,7 +84,8 @@ let
84 84
       hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
85 85
       escapeShellArg escapeShellArgs replaceChars lowerChars
86 86
       upperChars toLower toUpper addContextFrom splitString
87
-      removePrefix removeSuffix versionOlder versionAtLeast getVersion
87
+      removePrefix removeSuffix versionOlder versionAtLeast
88
+      getName getVersion
88 89
       nameFromURL enableFeature enableFeatureAs withFeature
89 90
       withFeatureAs fixedWidthString fixedWidthNumber isStorePath
90 91
       toInt readPathsFromFile fileContents;

+ 17
- 0
lib/strings.nix View File

@@ -472,6 +472,23 @@ rec {
472 472
   */
473 473
   versionAtLeast = v1: v2: !versionOlder v1 v2;
474 474
 
475
+  /* This function takes an argument that's either a derivation or a
476
+     derivation's "name" attribute and extracts the name part from that
477
+     argument.
478
+
479
+     Example:
480
+       getName "youtube-dl-2016.01.01"
481
+       => "youtube-dl"
482
+       getName pkgs.youtube-dl
483
+       => "youtube-dl"
484
+  */
485
+  getName = x:
486
+   let
487
+     parse = drv: (builtins.parseDrvName drv).name;
488
+   in if isString x
489
+      then parse x
490
+      else x.pname or (parse x.name);
491
+
475 492
   /* This function takes an argument that's either a derivation or a
476 493
      derivation's "name" attribute and extracts the version part from that
477 494
      argument.

+ 1
- 1
maintainers/scripts/update.nix View File

@@ -126,7 +126,7 @@ let
126 126
 
127 127
   packageData = package: {
128 128
     name = package.name;
129
-    pname = (builtins.parseDrvName package.name).name;
129
+    pname = lib.getName package;
130 130
     updateScript = map builtins.toString (pkgs.lib.toList package.updateScript);
131 131
   };
132 132
 

+ 4
- 8
nixos/modules/services/databases/mysql.nix View File

@@ -8,15 +8,11 @@ let
8 8
 
9 9
   mysql = cfg.package;
10 10
 
11
-  isMariaDB =
12
-    let
13
-      pName = _p: (builtins.parseDrvName (_p.name)).name;
14
-    in pName mysql == pName pkgs.mariadb;
11
+  isMariaDB = lib.getName mysql == lib.getName pkgs.mariadb;
12
+
15 13
   isMysqlAtLeast57 =
16
-    let
17
-      pName = _p: (builtins.parseDrvName (_p.name)).name;
18
-    in (pName mysql == pName pkgs.mysql57)
19
-       && ((builtins.compareVersions mysql.version "5.7") >= 0);
14
+    (lib.getName mysql == lib.getName pkgs.mysql57)
15
+     && (builtins.compareVersions mysql.version "5.7" >= 0);
20 16
 
21 17
   mysqldOptions =
22 18
     "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql}";

+ 1
- 1
nixos/modules/services/networking/znc/default.nix View File

@@ -239,7 +239,7 @@ in
239 239
     services.znc = {
240 240
       configFile = mkDefault (pkgs.writeText "znc-generated.conf" semanticString);
241 241
       config = {
242
-        Version = (builtins.parseDrvName pkgs.znc.name).version;
242
+        Version = lib.getVersion pkgs.znc;
243 243
         Listener.l.Port = mkDefault 5000;
244 244
         Listener.l.SSL = mkDefault true;
245 245
       };

+ 2
- 2
nixos/modules/system/boot/loader/grub/grub.nix View File

@@ -47,8 +47,8 @@ let
47 47
       grub = f grub;
48 48
       grubTarget = f (grub.grubTarget or "");
49 49
       shell = "${pkgs.runtimeShell}";
50
-      fullName = (builtins.parseDrvName realGrub.name).name;
51
-      fullVersion = (builtins.parseDrvName realGrub.name).version;
50
+      fullName = lib.getName realGrub;
51
+      fullVersion = lib.getVersion realGrub;
52 52
       grubEfi = f grubEfi;
53 53
       grubTargetEfi = if cfg.efiSupport && (cfg.version == 2) then f (grubEfi.grubTarget or "") else "";
54 54
       bootPath = args.path;

+ 1
- 1
pkgs/applications/editors/kdevelop5/kdevelop.nix View File

@@ -36,7 +36,7 @@ mkDerivation rec {
36 36
   # https://cgit.kde.org/kdevelop.git/commit/?id=716372ae2e8dff9c51e94d33443536786e4bd85b
37 37
   # required as nixos seems to be unable to find CLANG_BUILTIN_DIR
38 38
   cmakeFlags = [
39
-    "-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${(builtins.parseDrvName llvmPackages.clang.name).version}/include"
39
+    "-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${lib.getVersion llvmPackages.clang}/include"
40 40
   ];
41 41
 
42 42
   dontWrapQtApps = true;

+ 6
- 8
pkgs/applications/misc/sweethome3d/default.nix View File

@@ -3,8 +3,6 @@
3 3
 
4 4
 let
5 5
 
6
-  getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;
7
-
8 6
   # TODO: Should we move this to `lib`? Seems like its would be useful in many cases.
9 7
   extensionOf = filePath:
10 8
     lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath)));
@@ -15,15 +13,15 @@ let
15 13
   '') icons);
16 14
 
17 15
   mkSweetHome3D =
18
-  { name, module, version, src, license, description, desktopName, icons }:
16
+  { pname, module, version, src, license, description, desktopName, icons }:
19 17
 
20 18
   stdenv.mkDerivation rec {
21
-    inherit name version src description;
19
+    inherit pname version src description;
22 20
     exec = stdenv.lib.toLower module;
23 21
     sweethome3dItem = makeDesktopItem {
24 22
       inherit exec desktopName;
25
-      name = getDesktopFileName name;
26
-      icon = getDesktopFileName name;
23
+      name = pname;
24
+      icon = pname;
27 25
       comment =  description;
28 26
       genericName = "Computer Aided (Interior) Design";
29 27
       categories = "Application;Graphics;2DGraphics;3DGraphics;";
@@ -49,7 +47,7 @@ let
49 47
       mkdir -p $out/bin
50 48
       cp install/${module}-${version}.jar $out/share/java/.
51 49
 
52
-      ${installIcons (getDesktopFileName name) icons}
50
+      ${installIcons pname icons}
53 51
 
54 52
       cp "${sweethome3dItem}/share/applications/"* $out/share/applications
55 53
 
@@ -74,9 +72,9 @@ let
74 72
 in {
75 73
 
76 74
   application = mkSweetHome3D rec {
75
+    pname = stdenv.lib.toLower module + "-application";
77 76
     version = "6.2";
78 77
     module = "SweetHome3D";
79
-    name = stdenv.lib.toLower module + "-application-" + version;
80 78
     description = "Design and visualize your future home";
81 79
     license = stdenv.lib.licenses.gpl2Plus;
82 80
     src = fetchsvn {

+ 5
- 8
pkgs/applications/misc/sweethome3d/editors.nix View File

@@ -7,20 +7,17 @@ let
7 7
     m: "sweethome3d-"
8 8
     + removeSuffix "libraryeditor" (toLower m)
9 9
     + "-editor";
10
-  sweetName = m: v: sweetExec m + "-" + v;
11
-
12
-  getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;
13 10
 
14 11
   mkEditorProject =
15
-  { name, module, version, src, license, description, desktopName }:
12
+  { pname, module, version, src, license, description, desktopName }:
16 13
 
17 14
   stdenv.mkDerivation rec {
18 15
     application = sweethome3dApp;
19
-    inherit name module version src description;
16
+    inherit pname module version src description;
20 17
     exec = sweetExec module;
21 18
     editorItem = makeDesktopItem {
22 19
       inherit exec desktopName;
23
-      name = getDesktopFileName name;
20
+      name = pname;
24 21
       comment =  description;
25 22
       genericName = "Computer Aided (Interior) Design";
26 23
       categories = "Application;Graphics;2DGraphics;3DGraphics;";
@@ -66,7 +63,7 @@ in {
66 63
   textures-editor = mkEditorProject rec {
67 64
     version = "1.5";
68 65
     module = "TexturesLibraryEditor";
69
-    name = sweetName module version;
66
+    pname = module;
70 67
     description = "Easily create SH3T files and edit the properties of the texture images it contain";
71 68
     license = stdenv.lib.licenses.gpl2Plus;
72 69
     src = fetchcvs {
@@ -81,7 +78,7 @@ in {
81 78
   furniture-editor = mkEditorProject rec {
82 79
     version = "1.19";
83 80
     module = "FurnitureLibraryEditor";
84
-    name = sweetName module version;
81
+    pname = module;
85 82
     description = "Quickly create SH3F files and edit the properties of the 3D models it contain";
86 83
     license = stdenv.lib.licenses.gpl2;
87 84
     src = fetchcvs {

+ 5
- 3
pkgs/applications/networking/browsers/firefox/wrapper.nix View File

@@ -18,8 +18,10 @@ browser:
18 18
 
19 19
 let
20 20
   wrapper =
21
-    { browserName ? browser.browserName or (builtins.parseDrvName browser.name).name
22
-    , name ? (browserName + "-" + (builtins.parseDrvName browser.name).version)
21
+    { browserName ? browser.browserName or (lib.getName browser)
22
+    , name ? browserName + "-" + lib.getVersion browser # TODO delete, it's just for compat
23
+    , pname ? lib.getName name
24
+    , version ? lib.getVersion name
23 25
     , desktopName ? # browserName with first letter capitalized
24 26
       (lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName)
25 27
     , nameSuffix ? ""
@@ -83,7 +85,7 @@ let
83 85
       gtk_modules = [ libcanberra-gtk2 ];
84 86
 
85 87
     in stdenv.mkDerivation {
86
-      inherit name;
88
+      inherit pname version;
87 89
 
88 90
       desktopItem = makeDesktopItem {
89 91
         name = browserName;

+ 1
- 1
pkgs/applications/networking/instant-messengers/slack/update.sh View File

@@ -3,7 +3,7 @@
3 3
 
4 4
 set -eu -o pipefail
5 5
 
6
-oldVersion="$(nix-instantiate --eval -E "with import ./. {}; slack-theme-black.version or (builtins.parseDrvName slack-theme-black.name).version" | tr -d '"')"
6
+oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion slack-theme-black" | tr -d '"')"
7 7
 latestSha="$(curl -L -s https://api.github.com/repos/laCour/slack-night-mode/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"
8 8
 
9 9
 if [ ! "null" = "${latestSha}" ]; then

+ 1
- 1
pkgs/applications/networking/instant-messengers/zoom-us/update.sh View File

@@ -3,7 +3,7 @@
3 3
 
4 4
 set -eu -o pipefail
5 5
 
6
-oldVersion=$(nix-instantiate --eval -E "with import ./. {}; zoom-us.version or (builtins.parseDrvName zoom-us.name).version" | tr -d '"')
6
+oldVersion=$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion zoom-us" | tr -d '"')
7 7
 version="$(curl -sI https://zoom.us/client/latest/zoom_x86_64.tar.xz | grep -Fi 'Location:' | pcregrep -o1 '/(([0-9]\.?)+)/')"
8 8
 
9 9
 if [ ! "${oldVersion}" = "${version}" ]; then

+ 1
- 1
pkgs/applications/version-management/git-and-tools/git/update.sh View File

@@ -3,7 +3,7 @@
3 3
 
4 4
 set -eu -o pipefail
5 5
 
6
-oldVersion="$(nix-instantiate --eval -E "with import ./. {}; git.version or (builtins.parseDrvName git.name).version" | tr -d '"')"
6
+oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion git" | tr -d '"')"
7 7
 latestTag="$(git ls-remote --tags --sort="v:refname" git://github.com/git/git.git | grep -v '\{\}' | grep -v '\-rc' | tail -1 | sed 's|^.*/v\(.*\)|\1|')"
8 8
 
9 9
 if [ ! "${oldVersion}" = "${latestTag}" ]; then

+ 1
- 1
pkgs/applications/version-management/monotone/default.nix View File

@@ -5,7 +5,7 @@
5 5
 
6 6
 let
7 7
   version = "1.1";
8
-  perlVersion = (builtins.parseDrvName perl.name).version;
8
+  perlVersion = stdenv.lib.getVersion perl;
9 9
 in
10 10
 
11 11
 assert perlVersion != "";

+ 1
- 1
pkgs/applications/video/vdr/wrapper.nix View File

@@ -8,7 +8,7 @@
8 8
 
9 9
 in symlinkJoin {
10 10
 
11
-  name = "vdr-with-plugins-${(builtins.parseDrvName vdr.name).version}";
11
+  name = "vdr-with-plugins-${lib.getVersion vdr}";
12 12
 
13 13
   paths = [ vdr ] ++ plugins;
14 14
 

+ 1
- 1
pkgs/applications/virtualization/OVMF/default.nix View File

@@ -16,7 +16,7 @@ let
16 16
   else
17 17
     throw "Unsupported architecture";
18 18
 
19
-  version = (builtins.parseDrvName edk2.name).version;
19
+  version = lib.getVersion edk2;
20 20
 in
21 21
 
22 22
 edk2.mkDerivation projectDscPath {

+ 3
- 3
pkgs/build-support/bintools-wrapper/default.nix View File

@@ -34,8 +34,8 @@ let
34 34
   targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
35 35
                                         (targetPlatform.config + "-");
36 36
 
37
-  bintoolsVersion = (builtins.parseDrvName bintools.name).version;
38
-  bintoolsName = (builtins.parseDrvName bintools.name).name;
37
+  bintoolsVersion = stdenv.lib.getVersion bintools;
38
+  bintoolsName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName bintools);
39 39
 
40 40
   libc_bin = if libc == null then null else getBin libc;
41 41
   libc_dev = if libc == null then null else getDev libc;
@@ -74,7 +74,7 @@ in
74 74
 
75 75
 stdenv.mkDerivation {
76 76
   name = targetPrefix
77
-    + (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${bintoolsName}-wrapper")
77
+    + (if name != "" then name else "${bintoolsName}-wrapper")
78 78
     + (stdenv.lib.optionalString (bintools != null && bintoolsVersion != "") "-${bintoolsVersion}");
79 79
 
80 80
   preferLocalBuild = true;

+ 3
- 3
pkgs/build-support/cc-wrapper/default.nix View File

@@ -35,8 +35,8 @@ let
35 35
   targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
36 36
                                            (targetPlatform.config + "-");
37 37
 
38
-  ccVersion = (builtins.parseDrvName cc.name).version;
39
-  ccName = (builtins.parseDrvName cc.name).name;
38
+  ccVersion = stdenv.lib.getVersion cc;
39
+  ccName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName cc);
40 40
 
41 41
   libc_bin = if libc == null then null else getBin libc;
42 42
   libc_dev = if libc == null then null else getDev libc;
@@ -94,7 +94,7 @@ assert nativePrefix == bintools.nativePrefix;
94 94
 
95 95
 stdenv.mkDerivation {
96 96
   name = targetPrefix
97
-    + (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${ccName}-wrapper")
97
+    + (if name != "" then name else "${ccName}-wrapper")
98 98
     + (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}");
99 99
 
100 100
   preferLocalBuild = true;

+ 2
- 2
pkgs/common-updater/scripts/update-source-version View File

@@ -92,8 +92,8 @@ if [ -z "$oldUrl" ]; then
92 92
     die "Couldn't evaluate source url from '$attr.src'!"
93 93
 fi
94 94
 
95
-drvName=$(nix-instantiate $systemArg --eval -E "with import ./. {}; (builtins.parseDrvName $attr.name).name" | tr -d '"')
96
-oldVersion=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.${versionKey} or (builtins.parseDrvName $attr.name).version" | tr -d '"')
95
+drvName=$(nix-instantiate $systemArg --eval -E "with import ./. {}; lib.getName $attr" | tr -d '"')
96
+oldVersion=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.${versionKey} or lib.getVersion $attr" | tr -d '"')
97 97
 
98 98
 if [ -z "$drvName" -o -z "$oldVersion" ]; then
99 99
     die "Couldn't evaluate name and version from '$attr.name'!"

+ 2
- 3
pkgs/desktops/gnome-3/default.nix View File

@@ -14,10 +14,9 @@ lib.makeScope pkgs.newScope (self: with self; {
14 14
   */
15 15
   removePackagesByName = packages: packagesToRemove:
16 16
     let
17
-      pkgName = drv: (builtins.parseDrvName drv.name).name;
18
-      namesToRemove = map pkgName packagesToRemove;
17
+      namesToRemove = map lib.getName packagesToRemove;
19 18
     in
20
-      lib.filter (x: !(builtins.elem (pkgName x) namesToRemove)) packages;
19
+      lib.filter (x: !(builtins.elem (lib.getName x) namesToRemove)) packages;
21 20
 
22 21
   maintainers = with pkgs.lib.maintainers; [ lethalman jtojnar hedning worldofpeace ];
23 22
 

+ 1
- 1
pkgs/development/compilers/chicken/4/eggDerivation.nix View File

@@ -8,7 +8,7 @@
8 8
 let
9 9
   libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
10 10
   overrides = import ./overrides.nix;
11
-  baseName = (builtins.parseDrvName name).name;
11
+  baseName = lib.getName name;
12 12
   override = if builtins.hasAttr baseName overrides
13 13
    then
14 14
      builtins.getAttr baseName overrides

+ 2
- 2
pkgs/development/em-modules/generic/default.nix View File

@@ -10,8 +10,8 @@ pkgs.stdenv.mkDerivation (
10 10
   args //
11 11
   {
12 12
 
13
-  pname = "emscripten-${args.pname or (builtins.parseDrvName args.name).name}";
14
-  version = args.version or (builtins.parseDrvName args.name).version;
13
+  pname = "emscripten-${lib.getName args}";
14
+  version = lib.getVersion args;
15 15
   buildInputs = [ emscripten python ] ++ buildInputs;
16 16
   nativeBuildInputs = [ emscripten python ] ++ nativeBuildInputs;
17 17
 

+ 1
- 1
pkgs/development/interpreters/lua-5/build-lua-package.nix View File

@@ -161,7 +161,7 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {
161 161
 
162 162
   # enabled only for src.rock
163 163
   setSourceRoot= let
164
-    name_only=(builtins.parseDrvName name).name;
164
+    name_only= lib.getName name;
165 165
   in
166 166
     lib.optionalString (knownRockspec == null) ''
167 167
     # format is rockspec_basename/source_basename

+ 1
- 1
pkgs/development/libraries/science/math/caffe2/default.nix View File

@@ -57,7 +57,7 @@ let
57 57
     dst = "pybind11";
58 58
   };
59 59
 
60
-  ccVersion = (builtins.parseDrvName stdenv.cc.name).version;
60
+  ccVersion = lib.getVersion stdenv.cc;
61 61
 in
62 62
 
63 63
 stdenv.mkDerivation rec {

+ 1
- 1
pkgs/development/lisp-modules/openssl-lib-marked.nix View File

@@ -2,7 +2,7 @@ with import ../../../default.nix {};
2 2
 runCommand "openssl-lib-marked" {} ''
3 3
   mkdir -p "$out/lib"
4 4
   for lib in ssl crypto; do
5
-    version="${(builtins.parseDrvName openssl.name).version}"
5
+    version="${lib.getVersion openssl}"
6 6
     ln -s "${lib.getLib openssl}/lib/lib$lib.so" "$out/lib/lib$lib.so.$version"
7 7
     version="$(echo "$version" | sed -re 's/[a-z]+$//')"
8 8
     while test -n "$version"; do

+ 3
- 3
pkgs/development/perl-modules/generic/default.nix View File

@@ -34,15 +34,15 @@ toPerlModule(stdenv.mkDerivation (
34 34
     # https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC
35 35
     PERL_USE_UNSAFE_INC = "1";
36 36
 
37
-    meta.homepage = "https://metacpan.org/release/${attrs.pname or (builtins.parseDrvName attrs.name).name}"; # TODO: phase-out `attrs.name`
37
+    meta.homepage = "https://metacpan.org/release/${lib.getName attrs}"; # TODO: phase-out `attrs.name`
38 38
     meta.platforms = perl.meta.platforms;
39 39
   }
40 40
   attrs
41 41
   )
42 42
   //
43 43
   {
44
-    pname = "perl${perl.version}-${attrs.pname or (builtins.parseDrvName attrs.name).name}"; # TODO: phase-out `attrs.name`
45
-    version = attrs.version or (builtins.parseDrvName attrs.name).version;                   # TODO: phase-out `attrs.name`
44
+    pname = "perl${perl.version}-${lib.getName attrs}"; # TODO: phase-out `attrs.name`
45
+    version = lib.getVersion attrs;                     # TODO: phase-out `attrs.name`
46 46
     builder = ./builder.sh;
47 47
     buildInputs = buildInputs ++ [ perl ];
48 48
     nativeBuildInputs = nativeBuildInputs ++ [ (perl.dev or perl) ];

+ 1
- 1
pkgs/development/tools/analysis/radare2/update.py View File

@@ -38,7 +38,7 @@ def get_radare2_rev() -> str:
38 38
 
39 39
 def get_cutter_version() -> str:
40 40
     version_expr = """
41
-(with import <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage <radare2/cutter.nix> {}).name).version)
41
+(with import <nixpkgs> {}; lib.getVersion (qt5.callPackage <radare2/cutter.nix> {}))
42 42
 """
43 43
     return sh("nix", "eval", "--raw", version_expr.strip(), "-I", "radare2={0}".format(SCRIPT_DIR))
44 44
 

+ 1
- 1
pkgs/development/tools/continuous-integration/jenkins/update.sh View File

@@ -4,7 +4,7 @@
4 4
 set -eu -o pipefail
5 5
 
6 6
 core_json="$(curl -s --fail --location https://updates.jenkins.io/stable/update-center.actual.json | jq .core)"
7
-oldVersion=$(nix-instantiate --eval -E "with import ./. {}; jenkins.version or (builtins.parseDrvName jenkins.name).version" | tr -d '"')
7
+oldVersion=$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion jenkins" | tr -d '"')
8 8
 
9 9
 version="$(jq -r .version <<<$core_json)"
10 10
 sha256="$(jq -r .sha256 <<<$core_json)"

+ 3
- 4
pkgs/development/tools/documentation/antora/default.nix View File

@@ -1,16 +1,15 @@
1 1
 { stdenv, nodePackages_10_x }:
2 2
 
3 3
 let
4
-  drvName = drv: (builtins.parseDrvName drv).name;
5 4
   linkNodeDeps = ({ pkg, deps, name ? "" }:
6 5
     let
7
-      targetModule = if name != "" then name else drvName pkg;
6
+      targetModule = if name != "" then name else stdenv.lib.getName pkg;
8 7
     in nodePackages_10_x.${pkg}.override (oldAttrs: {
9 8
       postInstall = ''
10 9
         mkdir -p $out/lib/node_modules/${targetModule}/node_modules
11 10
         ${stdenv.lib.concatStringsSep "\n" (map (dep: ''
12
-          ln -s ${nodePackages_10_x.${dep}}/lib/node_modules/${drvName dep} \
13
-            $out/lib/node_modules/${targetModule}/node_modules/${drvName dep}
11
+          ln -s ${nodePackages_10_x.${dep}}/lib/node_modules/${stdenv.lib.getName dep} \
12
+            $out/lib/node_modules/${targetModule}/node_modules/${stdenv.lib.getName dep}
14 13
         '') deps
15 14
         )}
16 15
       '';

+ 2
- 8
pkgs/misc/emulators/retroarch/wrapper.nix View File

@@ -1,14 +1,8 @@
1 1
 { stdenv, lib, makeWrapper, retroarch, cores }:
2 2
 
3
-let
4
-
5
-  p = builtins.parseDrvName retroarch.name;
6
-
7
-in
8
-
9 3
 stdenv.mkDerivation {
10
-  name = "retroarch-" + p.version;
11
-  version = p.version;
4
+  pname = "retroarch";
5
+  version = lib.getVersion retroarch;
12 6
 
13 7
   buildInputs = [ makeWrapper ];
14 8
 

+ 1
- 1
pkgs/misc/emulators/wine/staging.nix View File

@@ -5,7 +5,7 @@ with callPackage ./util.nix {};
5 5
 let patch = (callPackage ./sources.nix {}).staging;
6 6
     build-inputs = pkgNames: extra:
7 7
       (mkBuildInputs wineUnstable.pkgArches pkgNames) ++ extra;
8
-in assert (builtins.parseDrvName wineUnstable.name).version == patch.version;
8
+in assert stdenv.lib.getVersion wineUnstable == patch.version;
9 9
 
10 10
 stdenv.lib.overrideDerivation wineUnstable (self: {
11 11
   buildInputs = build-inputs [ "perl" "utillinux" "autoconf" libtxc_dxtn_Name ] self.buildInputs;

+ 1
- 1
pkgs/misc/tmux-plugins/default.nix View File

@@ -25,7 +25,7 @@ let
25 25
     addonInfo ? null,
26 26
     preInstall ? "",
27 27
     postInstall ? "",
28
-    path ? (builtins.parseDrvName pluginName).name,
28
+    path ? lib.getName pluginName,
29 29
     dependencies ? [],
30 30
     ...
31 31
   }:

+ 1
- 1
pkgs/misc/vim-plugins/build-vim-plugin.nix View File

@@ -18,7 +18,7 @@ rec {
18 18
     buildPhase ? "",
19 19
     preInstall ? "",
20 20
     postInstall ? "",
21
-    path ? (builtins.parseDrvName name).name,
21
+    path ? stdenv.lib.getName name,
22 22
     addonInfo ? null,
23 23
     ...
24 24
   }:

+ 2
- 2
pkgs/os-specific/linux/prl-tools/default.nix View File

@@ -8,7 +8,7 @@ assert (!libsOnly) -> kernel != null;
8 8
 # Disable for kernels 4.15 and above due to compatibility issues
9 9
 assert kernel != null -> stdenv.lib.versionOlder kernel.version "4.15";
10 10
 
11
-let xorgFullVer = (builtins.parseDrvName xorg.xorgserver.name).version;
11
+let xorgFullVer = lib.getVersion xorg.xorgserver;
12 12
     xorgVer = lib.concatStringsSep "." (lib.take 2 (lib.splitString "." xorgFullVer));
13 13
     x64 = if stdenv.hostPlatform.system == "x86_64-linux" then true
14 14
           else if stdenv.hostPlatform.system == "i686-linux" then false
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
44 44
     ( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
45 45
   '';
46 46
 
47
-  kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version;
47
+  kernelVersion = if libsOnly then "" else lib.getName kernel.name;
48 48
   kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}";
49 49
   scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${utillinux}/bin" "${gawk}/bin" ]);
50 50
 

+ 2
- 2
pkgs/servers/x11/xorg/overrides.nix View File

@@ -529,7 +529,7 @@ self: super:
529 529
   xorgserver = with self; super.xorgserver.overrideAttrs (attrs_passed:
530 530
     # exchange attrs if abiCompat is set
531 531
     let
532
-      version = (builtins.parseDrvName attrs_passed.name).version;
532
+      version = lib.getVersion attrs_passed;
533 533
       attrs =
534 534
         if (abiCompat == null || lib.hasPrefix abiCompat version) then
535 535
           attrs_passed // {
@@ -564,7 +564,7 @@ self: super:
564 564
 
565 565
     in attrs //
566 566
     (let
567
-      version = (builtins.parseDrvName attrs.name).version;
567
+      version = lib.getVersion attrs;
568 568
       commonBuildInputs = attrs.buildInputs ++ [ xtrans ];
569 569
       commonPropagatedBuildInputs = [
570 570
         zlib libGL libGLU dbus

+ 1
- 1
pkgs/shells/zsh/oh-my-zsh/update.sh View File

@@ -3,7 +3,7 @@
3 3
 
4 4
 set -eu -o pipefail
5 5
 
6
-oldVersion="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.version or (builtins.parseDrvName oh-my-zsh.name).version" | tr -d '"')"
6
+oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion oh-my-zsh" | tr -d '"')"
7 7
 latestSha="$(curl -L -s https://api.github.com/repos/robbyrussell/oh-my-zsh/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"
8 8
 url="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.src.url" | tr -d '"')"
9 9
 

+ 1
- 1
pkgs/tools/audio/acoustid-fingerprinter/default.nix View File

@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
13 13
   nativeBuildInputs = [ pkgconfig ];
14 14
   buildInputs = [ cmake qt4 taglib chromaprint ffmpeg ];
15 15
 
16
-  cmakeFlags = [ "-DTAGLIB_MIN_VERSION=${(builtins.parseDrvName taglib.name).version}" ];
16
+  cmakeFlags = [ "-DTAGLIB_MIN_VERSION=${stdenv.lib.getVersion taglib}" ];
17 17
 
18 18
   patches = [
19 19
     (fetchpatch {

+ 1
- 1
pkgs/tools/inputmethods/ibus/wrapper.nix View File

@@ -3,7 +3,7 @@
3 3
 }:
4 4
 
5 5
 let
6
-  name = "ibus-with-plugins-" + (builtins.parseDrvName ibus.name).version;
6
+  name = "ibus-with-plugins-" + stdenv.lib.getVersion ibus;
7 7
   env = {
8 8
     buildInputs = [ ibus ] ++ plugins;
9 9
     nativeBuildInputs = [ lndir makeWrapper ];

+ 1
- 1
pkgs/tools/security/afl/libdislocator.nix View File

@@ -1,7 +1,7 @@
1 1
 { stdenv, afl}:
2 2
 
3 3
 stdenv.mkDerivation {
4
-  version = (builtins.parseDrvName afl.name).version;
4
+  version = stdenv.lib.getVersion afl;
5 5
   pname = "libdislocator";
6 6
 
7 7
   src = afl.src;

+ 6
- 6
pkgs/top-level/all-packages.nix View File

@@ -18299,8 +18299,8 @@ in
18299 18299
 
18300 18300
   firefox-bin = wrapFirefox firefox-bin-unwrapped {
18301 18301
     browserName = "firefox";
18302
-    name = "firefox-bin-" +
18303
-      (builtins.parseDrvName firefox-bin-unwrapped.name).version;
18302
+    pname = "firefox-bin";
18303
+    version = lib.getVersion firefox-bin-unwrapped;
18304 18304
     desktopName = "Firefox";
18305 18305
   };
18306 18306
 
@@ -18313,8 +18313,8 @@ in
18313 18313
 
18314 18314
   firefox-beta-bin = res.wrapFirefox firefox-beta-bin-unwrapped {
18315 18315
     browserName = "firefox";
18316
-    name = "firefox-beta-bin-" +
18317
-      (builtins.parseDrvName firefox-beta-bin-unwrapped.name).version;
18316
+    pname = "firefox-beta-bin";
18317
+    version = lib.getVersion firefox-beta-bin-unwrapped;
18318 18318
     desktopName = "Firefox Beta";
18319 18319
   };
18320 18320
 
@@ -18328,8 +18328,8 @@ in
18328 18328
   firefox-devedition-bin = res.wrapFirefox firefox-devedition-bin-unwrapped {
18329 18329
     browserName = "firefox";
18330 18330
     nameSuffix = "-devedition";
18331
-    name = "firefox-devedition-bin-" +
18332
-      (builtins.parseDrvName firefox-devedition-bin-unwrapped.name).version;
18331
+    pname = "firefox-devedition-bin";
18332
+    version = lib.getVersion firefox-devedition-bin-unwrapped;
18333 18333
     desktopName = "Firefox DevEdition";
18334 18334
   };
18335 18335
 

+ 1
- 1
pkgs/top-level/lua-packages.nix View File

@@ -23,7 +23,7 @@ let
23 23
   isLua51 = (lib.versions.majorMinor lua.version) == "5.1";
24 24
   isLua52 = (lib.versions.majorMinor lua.version) == "5.2";
25 25
   isLua53 = lua.luaversion == "5.3";
26
-  isLuaJIT = (builtins.parseDrvName lua.name).name == "luajit";
26
+  isLuaJIT = lib.getName lua == "luajit";
27 27
 
28 28
   lua-setup-hook = callPackage ../development/interpreters/lua-5/setup-hook.nix { };
29 29
 

Loading…
Cancel
Save