git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #74057 from Ericson2314/wrapper-pname-support

treewide: Purge most parseDrvName

commit1206faa6d5c9dc9aecb811091e1d547599ecd195 authorJohn Ericson <git@JohnEricson.me> dateSun 24 Nov 2019, 13:31 (7 years ago) parenta52d767747d5a3
42 files changed+94−96
doc/using/configuration.xml+5−6 lib/default.nix+2−1 lib/strings.nix+17 maintainers/scripts/update.nix+1−1 nixos/modules/services/databases/mysql.nix+4−8 nixos/modules/services/networking/znc/default.nix+1−1 nixos/modules/system/boot/loader/grub/grub.nix+2−2 pkgs/applications/editors/kdevelop5/kdevelop.nix+1−1 pkgs/applications/misc/sweethome3d/default.nix+6−8 pkgs/applications/misc/sweethome3d/editors.nix+5−8 pkgs/applications/networking/browsers/firefox/wrapper.nix+4−3 pkgs/applications/networking/instant-messengers/slack/update.sh+1−1 pkgs/applications/networking/instant-messengers/zoom-us/update.sh+1−1 pkgs/applications/version-management/git-and-tools/git/update.sh+1−1 pkgs/applications/version-management/monotone/default.nix+1−1 pkgs/applications/video/vdr/wrapper.nix+1−1 pkgs/applications/virtualization/OVMF/default.nix+1−1 pkgs/build-support/bintools-wrapper/default.nix+3−3 pkgs/build-support/cc-wrapper/default.nix+3−3 pkgs/common-updater/scripts/update-source-version+2−2 pkgs/desktops/gnome-3/default.nix+2−3 pkgs/development/compilers/chicken/4/eggDerivation.nix+1−1 pkgs/development/em-modules/generic/default.nix+2−2 pkgs/development/interpreters/lua-5/build-lua-package.nix+1−1 pkgs/development/libraries/science/math/caffe2/default.nix+1−1 pkgs/development/lisp-modules/openssl-lib-marked.nix+1−1 pkgs/development/perl-modules/generic/default.nix+3−3 pkgs/development/tools/analysis/radare2/update.py+1−1 pkgs/development/tools/continuous-integration/jenkins/update.sh+1−1 pkgs/development/tools/documentation/antora/default.nix+3−4 pkgs/misc/emulators/retroarch/wrapper.nix+2−8 pkgs/misc/emulators/wine/staging.nix+1−1 pkgs/misc/tmux-plugins/default.nix+1−1 pkgs/misc/vim-plugins/build-vim-plugin.nix+1−1 pkgs/os-specific/linux/prl-tools/default.nix+1−1 pkgs/servers/x11/xorg/overrides.nix+2−2 pkgs/shells/zsh/oh-my-zsh/update.sh+1−1 pkgs/tools/audio/acoustid-fingerprinter/default.nix+1−1 pkgs/tools/inputmethods/ibus/wrapper.nix+1−1 pkgs/tools/security/afl/libdislocator.nix+1−1 pkgs/top-level/all-packages.nix+3−6 pkgs/top-level/lua-packages.nix+1−1
doc/using/configuration.xml+5−6
@@ -141,11 +141,10 @@
141141 For a more useful example, try the following. This configuration only allows unfree packages named flash player and visual studio code:
142142<programlisting>
143143{
144− allowUnfreePredicate = (pkg: builtins.elem
145− (pkg.pname or (builtins.parseDrvName pkg.name).name) [
146− "flashplayer"
147− "vscode"
148− ]);
144+ allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
145+ "flashplayer"
146+ "vscode"
147+ ];
149148}
150149</programlisting>
151150 </para>
@@ -217,7 +216,7 @@
217216 The following configuration example only allows insecure packages with very short names:
218217<programlisting>
219218{
220− allowInsecurePredicate = (pkg: (builtins.stringLength (builtins.parseDrvName pkg.name).name) &lt;= 5);
219+ allowInsecurePredicate = pkg: builtins.stringLength (lib.getName pkg) &lt;= 5;
221220}
222221</programlisting>
223222 </para>
lib/default.nix+2−1
@@ -84,7 +84,8 @@ let
8484 hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
8585 escapeShellArg escapeShellArgs replaceChars lowerChars
8686 upperChars toLower toUpper addContextFrom splitString
87− removePrefix removeSuffix versionOlder versionAtLeast getVersion
87+ removePrefix removeSuffix versionOlder versionAtLeast
88+ getName getVersion
8889 nameFromURL enableFeature enableFeatureAs withFeature
8990 withFeatureAs fixedWidthString fixedWidthNumber isStorePath
9091 toInt readPathsFromFile fileContents;
lib/strings.nix+17
@@ -472,6 +472,23 @@ rec {
472472 */
473473 versionAtLeast = v1: v2: !versionOlder v1 v2;
474474
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+
475492 /* This function takes an argument that's either a derivation or a
476493 derivation's "name" attribute and extracts the version part from that
477494 argument.
maintainers/scripts/update.nix+1−1
@@ -126,7 +126,7 @@ let
126126
127127 packageData = package: {
128128 name = package.name;
129− pname = (builtins.parseDrvName package.name).name;
129+ pname = lib.getName package;
130130 updateScript = map builtins.toString (pkgs.lib.toList package.updateScript);
131131 };
132132
nixos/modules/services/databases/mysql.nix+4−8
@@ -8,15 +8,11 @@ let
88
99 mysql = cfg.package;
1010
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+
1513 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);
2016
2117 mysqldOptions =
2218 "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql}";
nixos/modules/services/networking/znc/default.nix+1−1
@@ -239,7 +239,7 @@ in
239239 services.znc = {
240240 configFile = mkDefault (pkgs.writeText "znc-generated.conf" semanticString);
241241 config = {
242− Version = (builtins.parseDrvName pkgs.znc.name).version;
242+ Version = lib.getVersion pkgs.znc;
243243 Listener.l.Port = mkDefault 5000;
244244 Listener.l.SSL = mkDefault true;
245245 };
nixos/modules/system/boot/loader/grub/grub.nix+2−2
@@ -47,8 +47,8 @@ let
4747 grub = f grub;
4848 grubTarget = f (grub.grubTarget or "");
4949 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;
5252 grubEfi = f grubEfi;
5353 grubTargetEfi = if cfg.efiSupport && (cfg.version == 2) then f (grubEfi.grubTarget or "") else "";
5454 bootPath = args.path;
pkgs/applications/editors/kdevelop5/kdevelop.nix+1−1
@@ -37,7 +37,7 @@ mkDerivation rec {
3737 # https://cgit.kde.org/kdevelop.git/commit/?id=716372ae2e8dff9c51e94d33443536786e4bd85b
3838 # required as nixos seems to be unable to find CLANG_BUILTIN_DIR
3939 cmakeFlags = [
40− "-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${(builtins.parseDrvName llvmPackages.clang.name).version}/include"
40+ "-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${lib.getVersion llvmPackages.clang}/include"
4141 ];
4242
4343 dontWrapQtApps = true;
pkgs/applications/misc/sweethome3d/default.nix+6−8
@@ -3,8 +3,6 @@
33
44let
55
6− getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;
7−
86 # TODO: Should we move this to `lib`? Seems like its would be useful in many cases.
97 extensionOf = filePath:
108 lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath)));
@@ -15,15 +13,15 @@ let
1513 '') icons);
1614
1715 mkSweetHome3D =
18− { name, module, version, src, license, description, desktopName, icons }:
16+ { pname, module, version, src, license, description, desktopName, icons }:
1917
2018 stdenv.mkDerivation rec {
21− inherit name version src description;
19+ inherit pname version src description;
2220 exec = stdenv.lib.toLower module;
2321 sweethome3dItem = makeDesktopItem {
2422 inherit exec desktopName;
25− name = getDesktopFileName name;
26− icon = getDesktopFileName name;
23+ name = pname;
24+ icon = pname;
2725 comment = description;
2826 genericName = "Computer Aided (Interior) Design";
2927 categories = "Application;Graphics;2DGraphics;3DGraphics;";
@@ -49,7 +47,7 @@ let
4947 mkdir -p $out/bin
5048 cp install/${module}-${version}.jar $out/share/java/.
5149
52− ${installIcons (getDesktopFileName name) icons}
50+ ${installIcons pname icons}
5351
5452 cp "${sweethome3dItem}/share/applications/"* $out/share/applications
5553
@@ -74,9 +72,9 @@ let
7472in {
7573
7674 application = mkSweetHome3D rec {
75+ pname = stdenv.lib.toLower module + "-application";
7776 version = "6.2";
7877 module = "SweetHome3D";
79− name = stdenv.lib.toLower module + "-application-" + version;
8078 description = "Design and visualize your future home";
8179 license = stdenv.lib.licenses.gpl2Plus;
8280 src = fetchsvn {
pkgs/applications/misc/sweethome3d/editors.nix+5−8
@@ -7,20 +7,17 @@ let
77 m: "sweethome3d-"
88 + removeSuffix "libraryeditor" (toLower m)
99 + "-editor";
10− sweetName = m: v: sweetExec m + "-" + v;
11−
12− getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;
1310
1411 mkEditorProject =
15− { name, module, version, src, license, description, desktopName }:
12+ { pname, module, version, src, license, description, desktopName }:
1613
1714 stdenv.mkDerivation rec {
1815 application = sweethome3dApp;
19− inherit name module version src description;
16+ inherit pname module version src description;
2017 exec = sweetExec module;
2118 editorItem = makeDesktopItem {
2219 inherit exec desktopName;
23− name = getDesktopFileName name;
20+ name = pname;
2421 comment = description;
2522 genericName = "Computer Aided (Interior) Design";
2623 categories = "Application;Graphics;2DGraphics;3DGraphics;";
@@ -66,7 +63,7 @@ in {
6663 textures-editor = mkEditorProject rec {
6764 version = "1.5";
6865 module = "TexturesLibraryEditor";
69− name = sweetName module version;
66+ pname = module;
7067 description = "Easily create SH3T files and edit the properties of the texture images it contain";
7168 license = stdenv.lib.licenses.gpl2Plus;
7269 src = fetchcvs {
@@ -81,7 +78,7 @@ in {
8178 furniture-editor = mkEditorProject rec {
8279 version = "1.19";
8380 module = "FurnitureLibraryEditor";
84− name = sweetName module version;
81+ pname = module;
8582 description = "Quickly create SH3F files and edit the properties of the 3D models it contain";
8683 license = stdenv.lib.licenses.gpl2;
8784 src = fetchcvs {
pkgs/applications/networking/browsers/firefox/wrapper.nix+4−3
@@ -18,8 +18,9 @@ browser:
1818
1919let
2020 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+ , pname ? browserName
23+ , version ? lib.getVersion browser
2324 , desktopName ? # browserName with first letter capitalized
2425 (lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName)
2526 , nameSuffix ? ""
@@ -83,7 +84,7 @@ let
8384 gtk_modules = [ libcanberra-gtk2 ];
8485
8586 in stdenv.mkDerivation {
86− inherit name;
87+ inherit pname version;
8788
8889 desktopItem = makeDesktopItem {
8990 name = browserName;
pkgs/applications/networking/instant-messengers/slack/update.sh+1−1
@@ -3,7 +3,7 @@
33
44set -eu -o pipefail
55
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 '"')"
77latestSha="$(curl -L -s https://api.github.com/repos/laCour/slack-night-mode/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"
88
99if [ ! "null" = "${latestSha}" ]; then
pkgs/applications/networking/instant-messengers/zoom-us/update.sh+1−1
@@ -3,7 +3,7 @@
33
44set -eu -o pipefail
55
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 '"')
77version="$(curl -sI https://zoom.us/client/latest/zoom_x86_64.tar.xz | grep -Fi 'Location:' | pcregrep -o1 '/(([0-9]\.?)+)/')"
88
99if [ ! "${oldVersion}" = "${version}" ]; then
pkgs/applications/version-management/git-and-tools/git/update.sh+1−1
@@ -3,7 +3,7 @@
33
44set -eu -o pipefail
55
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 '"')"
77latestTag="$(git ls-remote --tags --sort="v:refname" git://github.com/git/git.git | grep -v '\{\}' | grep -v '\-rc' | tail -1 | sed 's|^.*/v\(.*\)|\1|')"
88
99if [ ! "${oldVersion}" = "${latestTag}" ]; then
pkgs/applications/version-management/monotone/default.nix+1−1
@@ -5,7 +5,7 @@
55
66let
77 version = "1.1";
8− perlVersion = (builtins.parseDrvName perl.name).version;
8+ perlVersion = stdenv.lib.getVersion perl;
99in
1010
1111assert perlVersion != "";
pkgs/applications/video/vdr/wrapper.nix+1−1
@@ -8,7 +8,7 @@
88
99in symlinkJoin {
1010
11− name = "vdr-with-plugins-${(builtins.parseDrvName vdr.name).version}";
11+ name = "vdr-with-plugins-${lib.getVersion vdr}";
1212
1313 paths = [ vdr ] ++ plugins;
1414
pkgs/applications/virtualization/OVMF/default.nix+1−1
@@ -16,7 +16,7 @@ let
1616 else
1717 throw "Unsupported architecture";
1818
19− version = (builtins.parseDrvName edk2.name).version;
19+ version = lib.getVersion edk2;
2020in
2121
2222edk2.mkDerivation projectDscPath {
pkgs/build-support/bintools-wrapper/default.nix+3−3
@@ -34,8 +34,8 @@ let
3434 targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
3535 (targetPlatform.config + "-");
3636
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);
3939
4040 libc_bin = if libc == null then null else getBin libc;
4141 libc_dev = if libc == null then null else getDev libc;
@@ -74,7 +74,7 @@ in
7474
7575stdenv.mkDerivation {
7676 name = targetPrefix
77− + (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${bintoolsName}-wrapper")
77+ + (if name != "" then name else "${bintoolsName}-wrapper")
7878 + (stdenv.lib.optionalString (bintools != null && bintoolsVersion != "") "-${bintoolsVersion}");
7979
8080 preferLocalBuild = true;
pkgs/build-support/cc-wrapper/default.nix+3−3
@@ -35,8 +35,8 @@ let
3535 targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
3636 (targetPlatform.config + "-");
3737
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);
4040
4141 libc_bin = if libc == null then null else getBin libc;
4242 libc_dev = if libc == null then null else getDev libc;
@@ -94,7 +94,7 @@ assert nativePrefix == bintools.nativePrefix;
9494
9595stdenv.mkDerivation {
9696 name = targetPrefix
97− + (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${ccName}-wrapper")
97+ + (if name != "" then name else "${ccName}-wrapper")
9898 + (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}");
9999
100100 preferLocalBuild = true;
pkgs/common-updater/scripts/update-source-version+2−2
@@ -92,8 +92,8 @@ if [ -z "$oldUrl" ]; then
9292 die "Couldn't evaluate source url from '$attr.src'!"
9393fi
9494
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 '"')
9797
9898if [ -z "$drvName" -o -z "$oldVersion" ]; then
9999 die "Couldn't evaluate name and version from '$attr.name'!"
pkgs/desktops/gnome-3/default.nix+2−3
@@ -14,10 +14,9 @@ lib.makeScope pkgs.newScope (self: with self; {
1414 */
1515 removePackagesByName = packages: packagesToRemove:
1616 let
17− pkgName = drv: (builtins.parseDrvName drv.name).name;
18− namesToRemove = map pkgName packagesToRemove;
17+ namesToRemove = map lib.getName packagesToRemove;
1918 in
20− lib.filter (x: !(builtins.elem (pkgName x) namesToRemove)) packages;
19+ lib.filter (x: !(builtins.elem (lib.getName x) namesToRemove)) packages;
2120
2221 maintainers = with pkgs.lib.maintainers; [ lethalman jtojnar hedning worldofpeace ];
2322
pkgs/development/compilers/chicken/4/eggDerivation.nix+1−1
@@ -8,7 +8,7 @@
88let
99 libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
1010 overrides = import ./overrides.nix;
11− baseName = (builtins.parseDrvName name).name;
11+ baseName = lib.getName name;
1212 override = if builtins.hasAttr baseName overrides
1313 then
1414 builtins.getAttr baseName overrides
pkgs/development/em-modules/generic/default.nix+2−2
@@ -10,8 +10,8 @@ pkgs.stdenv.mkDerivation (
1010 args //
1111 {
1212
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;
1515 buildInputs = [ emscripten python ] ++ buildInputs;
1616 nativeBuildInputs = [ emscripten python ] ++ nativeBuildInputs;
1717
pkgs/development/interpreters/lua-5/build-lua-package.nix+1−1
@@ -161,7 +161,7 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {
161161
162162 # enabled only for src.rock
163163 setSourceRoot= let
164− name_only=(builtins.parseDrvName name).name;
164+ name_only= lib.getName name;
165165 in
166166 lib.optionalString (knownRockspec == null) ''
167167 # format is rockspec_basename/source_basename
pkgs/development/libraries/science/math/caffe2/default.nix+1−1
@@ -57,7 +57,7 @@ let
5757 dst = "pybind11";
5858 };
5959
60− ccVersion = (builtins.parseDrvName stdenv.cc.name).version;
60+ ccVersion = lib.getVersion stdenv.cc;
6161in
6262
6363stdenv.mkDerivation rec {
pkgs/development/lisp-modules/openssl-lib-marked.nix+1−1
@@ -2,7 +2,7 @@ with import ../../../default.nix {};
22runCommand "openssl-lib-marked" {} ''
33 mkdir -p "$out/lib"
44 for lib in ssl crypto; do
5− version="${(builtins.parseDrvName openssl.name).version}"
5+ version="${lib.getVersion openssl}"
66 ln -s "${lib.getLib openssl}/lib/lib$lib.so" "$out/lib/lib$lib.so.$version"
77 version="$(echo "$version" | sed -re 's/[a-z]+$//')"
88 while test -n "$version"; do
pkgs/development/perl-modules/generic/default.nix+3−3
@@ -31,15 +31,15 @@ toPerlModule(stdenv.mkDerivation (
3131 # https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC
3232 PERL_USE_UNSAFE_INC = "1";
3333
34− meta.homepage = "https://metacpan.org/release/${attrs.pname or (builtins.parseDrvName attrs.name).name}"; # TODO: phase-out `attrs.name`
34+ meta.homepage = "https://metacpan.org/release/${lib.getName attrs}"; # TODO: phase-out `attrs.name`
3535 meta.platforms = perl.meta.platforms;
3636 }
3737 attrs
3838 )
3939 //
4040 {
41− pname = "perl${perl.version}-${attrs.pname or (builtins.parseDrvName attrs.name).name}"; # TODO: phase-out `attrs.name`
42− version = attrs.version or (builtins.parseDrvName attrs.name).version; # TODO: phase-out `attrs.name`
41+ pname = "perl${perl.version}-${lib.getName attrs}"; # TODO: phase-out `attrs.name`
42+ version = lib.getVersion attrs; # TODO: phase-out `attrs.name`
4343 builder = ./builder.sh;
4444 buildInputs = buildInputs ++ [ perl ];
4545 nativeBuildInputs = nativeBuildInputs ++ [ (perl.dev or perl) ];
pkgs/development/tools/analysis/radare2/update.py+1−1
@@ -38,7 +38,7 @@ def get_radare2_rev() -> str:
3838
3939def get_cutter_version() -> str:
4040 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> {}))
4242"""
4343 return sh("nix", "eval", "--raw", version_expr.strip(), "-I", "radare2={0}".format(SCRIPT_DIR))
4444
pkgs/development/tools/continuous-integration/jenkins/update.sh+1−1
@@ -4,7 +4,7 @@
44set -eu -o pipefail
55
66core_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 '"')
88
99version="$(jq -r .version <<<$core_json)"
1010sha256="$(jq -r .sha256 <<<$core_json)"
pkgs/development/tools/documentation/antora/default.nix+3−4
@@ -1,16 +1,15 @@
11{ stdenv, nodePackages_10_x }:
22
33let
4− drvName = drv: (builtins.parseDrvName drv).name;
54 linkNodeDeps = ({ pkg, deps, name ? "" }:
65 let
7− targetModule = if name != "" then name else drvName pkg;
6+ targetModule = if name != "" then name else stdenv.lib.getName pkg;
87 in nodePackages_10_x.${pkg}.override (oldAttrs: {
98 postInstall = ''
109 mkdir -p $out/lib/node_modules/${targetModule}/node_modules
1110 ${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}
1413 '') deps
1514 )}
1615 '';
pkgs/misc/emulators/retroarch/wrapper.nix+2−8
@@ -1,14 +1,8 @@
11{ stdenv, lib, makeWrapper, retroarch, cores }:
22
3−let
4−
5− p = builtins.parseDrvName retroarch.name;
6−
7−in
8−
93stdenv.mkDerivation {
10− name = "retroarch-" + p.version;
11− version = p.version;
4+ pname = "retroarch";
5+ version = lib.getVersion retroarch;
126
137 buildInputs = [ makeWrapper ];
148
pkgs/misc/emulators/wine/staging.nix+1−1
@@ -5,7 +5,7 @@ with callPackage ./util.nix {};
55let patch = (callPackage ./sources.nix {}).staging;
66 build-inputs = pkgNames: extra:
77 (mkBuildInputs wineUnstable.pkgArches pkgNames) ++ extra;
8−in assert (builtins.parseDrvName wineUnstable.name).version == patch.version;
8+in assert stdenv.lib.getVersion wineUnstable == patch.version;
99
1010stdenv.lib.overrideDerivation wineUnstable (self: {
1111 buildInputs = build-inputs [ "perl" "utillinux" "autoconf" libtxc_dxtn_Name ] self.buildInputs;
pkgs/misc/tmux-plugins/default.nix+1−1
@@ -25,7 +25,7 @@ let
2525 addonInfo ? null,
2626 preInstall ? "",
2727 postInstall ? "",
28− path ? (builtins.parseDrvName pluginName).name,
28+ path ? lib.getName pluginName,
2929 dependencies ? [],
3030 ...
3131 }:
pkgs/misc/vim-plugins/build-vim-plugin.nix+1−1
@@ -18,7 +18,7 @@ rec {
1818 buildPhase ? "",
1919 preInstall ? "",
2020 postInstall ? "",
21− path ? (builtins.parseDrvName name).name,
21+ path ? stdenv.lib.getName name,
2222 addonInfo ? null,
2323 ...
2424 }:
pkgs/os-specific/linux/prl-tools/default.nix+1−1
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
4444 ( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
4545 '';
4646
47− kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version;
47+ kernelVersion = if libsOnly then "" else lib.getName kernel.name;
4848 kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}";
4949 scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${utillinux}/bin" "${gawk}/bin" ]);
5050
pkgs/servers/x11/xorg/overrides.nix+2−2
@@ -529,7 +529,7 @@ self: super:
529529 xorgserver = with self; super.xorgserver.overrideAttrs (attrs_passed:
530530 # exchange attrs if abiCompat is set
531531 let
532− version = (builtins.parseDrvName attrs_passed.name).version;
532+ version = lib.getVersion attrs_passed;
533533 attrs =
534534 if (abiCompat == null || lib.hasPrefix abiCompat version) then
535535 attrs_passed // {
@@ -564,7 +564,7 @@ self: super:
564564
565565 in attrs //
566566 (let
567− version = (builtins.parseDrvName attrs.name).version;
567+ version = lib.getVersion attrs;
568568 commonBuildInputs = attrs.buildInputs ++ [ xtrans ];
569569 commonPropagatedBuildInputs = [
570570 zlib libGL libGLU dbus
pkgs/shells/zsh/oh-my-zsh/update.sh+1−1
@@ -3,7 +3,7 @@
33
44set -eu -o pipefail
55
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 '"')"
77latestSha="$(curl -L -s https://api.github.com/repos/robbyrussell/oh-my-zsh/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"
88url="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.src.url" | tr -d '"')"
99
pkgs/tools/audio/acoustid-fingerprinter/default.nix+1−1
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
1313 nativeBuildInputs = [ pkgconfig ];
1414 buildInputs = [ cmake qt4 taglib chromaprint ffmpeg ];
1515
16− cmakeFlags = [ "-DTAGLIB_MIN_VERSION=${(builtins.parseDrvName taglib.name).version}" ];
16+ cmakeFlags = [ "-DTAGLIB_MIN_VERSION=${stdenv.lib.getVersion taglib}" ];
1717
1818 patches = [
1919 (fetchpatch {
pkgs/tools/inputmethods/ibus/wrapper.nix+1−1
@@ -3,7 +3,7 @@
33}:
44
55let
6− name = "ibus-with-plugins-" + (builtins.parseDrvName ibus.name).version;
6+ name = "ibus-with-plugins-" + stdenv.lib.getVersion ibus;
77 env = {
88 buildInputs = [ ibus ] ++ plugins;
99 nativeBuildInputs = [ lndir makeWrapper ];
pkgs/tools/security/afl/libdislocator.nix+1−1
@@ -1,7 +1,7 @@
11{ stdenv, afl}:
22
33stdenv.mkDerivation {
4− version = (builtins.parseDrvName afl.name).version;
4+ version = stdenv.lib.getVersion afl;
55 pname = "libdislocator";
66
77 src = afl.src;
pkgs/top-level/all-packages.nix+3−6
@@ -18862,8 +18862,7 @@ in
1886218862
1886318863 firefox-bin = wrapFirefox firefox-bin-unwrapped {
1886418864 browserName = "firefox";
18865− name = "firefox-bin-" +
18866− (builtins.parseDrvName firefox-bin-unwrapped.name).version;
18865+ pname = "firefox-bin";
1886718866 desktopName = "Firefox";
1886818867 };
1886918868
@@ -18876,8 +18875,7 @@ in
1887618875
1887718876 firefox-beta-bin = res.wrapFirefox firefox-beta-bin-unwrapped {
1887818877 browserName = "firefox";
18879− name = "firefox-beta-bin-" +
18880− (builtins.parseDrvName firefox-beta-bin-unwrapped.name).version;
18878+ pname = "firefox-beta-bin";
1888118879 desktopName = "Firefox Beta";
1888218880 };
1888318881
@@ -18891,8 +18889,7 @@ in
1889118889 firefox-devedition-bin = res.wrapFirefox firefox-devedition-bin-unwrapped {
1889218890 browserName = "firefox";
1889318891 nameSuffix = "-devedition";
18894− name = "firefox-devedition-bin-" +
18895− (builtins.parseDrvName firefox-devedition-bin-unwrapped.name).version;
18892+ pname = "firefox-devedition-bin";
1889618893 desktopName = "Firefox DevEdition";
1889718894 };
1889818895
pkgs/top-level/lua-packages.nix+1−1
@@ -23,7 +23,7 @@ let
2323 isLua51 = (lib.versions.majorMinor lua.version) == "5.1";
2424 isLua52 = (lib.versions.majorMinor lua.version) == "5.2";
2525 isLua53 = lua.luaversion == "5.3";
26− isLuaJIT = (builtins.parseDrvName lua.name).name == "luajit";
26+ isLuaJIT = lib.getName lua == "luajit";
2727
2828 lua-setup-hook = callPackage ../development/interpreters/lua-5/setup-hook.nix { };
2929