Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a52d7674cc7b
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1206faa6d5c9
Choose a head ref
  • 10 commits
  • 42 files changed
  • 3 contributors

Commits on Nov 24, 2019

  1. Verified

    This commit was signed with the committer’s verified signature.
    endocrimes Danielle
    Copy the full SHA
    84a1052 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    endocrimes Danielle
    Copy the full SHA
    99537e9 View commit details
  3. treewide: Get rid of most parseDrvName without breaking compat

    That is because this commit should be merged to both master and
    release-19.09.
    Ericson2314 committed Nov 24, 2019
    Copy the full SHA
    9b090cc View commit details
  4. Copy the full SHA
    d0d5136 View commit details
  5. firefox-wrapper: Get rid of name argument

    Only pname + version is supported now. (Both are still optional,
    however.)
    Ericson2314 committed Nov 24, 2019
    Copy the full SHA
    d34d84a View commit details
  6. doc: Fix and clarify allowInsecurePredicate example

    I had made inbalanced parens. Remove unneeded parens for legibility too.
    Ericson2314 committed Nov 24, 2019
    Copy the full SHA
    97baa2e View commit details
  7. Copy the full SHA
    51991e9 View commit details
  8. Copy the full SHA
    4a0a297 View commit details
  9. Copy the full SHA
    747d5a3 View commit details
  10. Merge pull request #74057 from Ericson2314/wrapper-pname-support

    treewide: Purge most parseDrvName
    Ericson2314 authored Nov 24, 2019
    Copy the full SHA
    1206faa View commit details
Showing with 94 additions and 96 deletions.
  1. +5 −6 doc/using/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. +4 −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. +1 −1 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. +3 −6 pkgs/top-level/all-packages.nix
  42. +1 −1 pkgs/top-level/lua-packages.nix
11 changes: 5 additions & 6 deletions doc/using/configuration.xml
Original file line number Diff line number Diff line change
@@ -141,11 +141,10 @@
For a more useful example, try the following. This configuration only allows unfree packages named flash player and visual studio code:
<programlisting>
{
allowUnfreePredicate = (pkg: builtins.elem
(pkg.pname or (builtins.parseDrvName pkg.name).name) [
"flashplayer"
"vscode"
]);
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"flashplayer"
"vscode"
];
}
</programlisting>
</para>
@@ -217,7 +216,7 @@
The following configuration example only allows insecure packages with very short names:
<programlisting>
{
allowInsecurePredicate = (pkg: (builtins.stringLength (builtins.parseDrvName pkg.name).name) &lt;= 5);
allowInsecurePredicate = pkg: builtins.stringLength (lib.getName pkg) &lt;= 5;
}
</programlisting>
</para>
3 changes: 2 additions & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
@@ -84,7 +84,8 @@ let
hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
escapeShellArg escapeShellArgs replaceChars lowerChars
upperChars toLower toUpper addContextFrom splitString
removePrefix removeSuffix versionOlder versionAtLeast getVersion
removePrefix removeSuffix versionOlder versionAtLeast
getName getVersion
nameFromURL enableFeature enableFeatureAs withFeature
withFeatureAs fixedWidthString fixedWidthNumber isStorePath
toInt readPathsFromFile fileContents;
17 changes: 17 additions & 0 deletions lib/strings.nix
Original file line number Diff line number Diff line change
@@ -472,6 +472,23 @@ rec {
*/
versionAtLeast = v1: v2: !versionOlder v1 v2;

/* This function takes an argument that's either a derivation or a
derivation's "name" attribute and extracts the name part from that
argument.
Example:
getName "youtube-dl-2016.01.01"
=> "youtube-dl"
getName pkgs.youtube-dl
=> "youtube-dl"
*/
getName = x:
let
parse = drv: (builtins.parseDrvName drv).name;
in if isString x
then parse x
else x.pname or (parse x.name);

/* This function takes an argument that's either a derivation or a
derivation's "name" attribute and extracts the version part from that
argument.
2 changes: 1 addition & 1 deletion maintainers/scripts/update.nix
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ let

packageData = package: {
name = package.name;
pname = (builtins.parseDrvName package.name).name;
pname = lib.getName package;
updateScript = map builtins.toString (pkgs.lib.toList package.updateScript);
};

12 changes: 4 additions & 8 deletions nixos/modules/services/databases/mysql.nix
Original file line number Diff line number Diff line change
@@ -8,15 +8,11 @@ let

mysql = cfg.package;

isMariaDB =
let
pName = _p: (builtins.parseDrvName (_p.name)).name;
in pName mysql == pName pkgs.mariadb;
isMariaDB = lib.getName mysql == lib.getName pkgs.mariadb;

isMysqlAtLeast57 =
let
pName = _p: (builtins.parseDrvName (_p.name)).name;
in (pName mysql == pName pkgs.mysql57)
&& ((builtins.compareVersions mysql.version "5.7") >= 0);
(lib.getName mysql == lib.getName pkgs.mysql57)
&& (builtins.compareVersions mysql.version "5.7" >= 0);

mysqldOptions =
"--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql}";
2 changes: 1 addition & 1 deletion nixos/modules/services/networking/znc/default.nix
Original file line number Diff line number Diff line change
@@ -239,7 +239,7 @@ in
services.znc = {
configFile = mkDefault (pkgs.writeText "znc-generated.conf" semanticString);
config = {
Version = (builtins.parseDrvName pkgs.znc.name).version;
Version = lib.getVersion pkgs.znc;
Listener.l.Port = mkDefault 5000;
Listener.l.SSL = mkDefault true;
};
4 changes: 2 additions & 2 deletions nixos/modules/system/boot/loader/grub/grub.nix
Original file line number Diff line number Diff line change
@@ -47,8 +47,8 @@ let
grub = f grub;
grubTarget = f (grub.grubTarget or "");
shell = "${pkgs.runtimeShell}";
fullName = (builtins.parseDrvName realGrub.name).name;
fullVersion = (builtins.parseDrvName realGrub.name).version;
fullName = lib.getName realGrub;
fullVersion = lib.getVersion realGrub;
grubEfi = f grubEfi;
grubTargetEfi = if cfg.efiSupport && (cfg.version == 2) then f (grubEfi.grubTarget or "") else "";
bootPath = args.path;
2 changes: 1 addition & 1 deletion pkgs/applications/editors/kdevelop5/kdevelop.nix
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ mkDerivation rec {
# https://cgit.kde.org/kdevelop.git/commit/?id=716372ae2e8dff9c51e94d33443536786e4bd85b
# required as nixos seems to be unable to find CLANG_BUILTIN_DIR
cmakeFlags = [
"-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${(builtins.parseDrvName llvmPackages.clang.name).version}/include"
"-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${lib.getVersion llvmPackages.clang}/include"
];

dontWrapQtApps = true;
14 changes: 6 additions & 8 deletions pkgs/applications/misc/sweethome3d/default.nix
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@

let

getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;

# TODO: Should we move this to `lib`? Seems like its would be useful in many cases.
extensionOf = filePath:
lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath)));
@@ -15,15 +13,15 @@ let
'') icons);

mkSweetHome3D =
{ name, module, version, src, license, description, desktopName, icons }:
{ pname, module, version, src, license, description, desktopName, icons }:

stdenv.mkDerivation rec {
inherit name version src description;
inherit pname version src description;
exec = stdenv.lib.toLower module;
sweethome3dItem = makeDesktopItem {
inherit exec desktopName;
name = getDesktopFileName name;
icon = getDesktopFileName name;
name = pname;
icon = pname;
comment = description;
genericName = "Computer Aided (Interior) Design";
categories = "Application;Graphics;2DGraphics;3DGraphics;";
@@ -49,7 +47,7 @@ let
mkdir -p $out/bin
cp install/${module}-${version}.jar $out/share/java/.
${installIcons (getDesktopFileName name) icons}
${installIcons pname icons}
cp "${sweethome3dItem}/share/applications/"* $out/share/applications
@@ -74,9 +72,9 @@ let
in {

application = mkSweetHome3D rec {
pname = stdenv.lib.toLower module + "-application";
version = "6.2";
module = "SweetHome3D";
name = stdenv.lib.toLower module + "-application-" + version;
description = "Design and visualize your future home";
license = stdenv.lib.licenses.gpl2Plus;
src = fetchsvn {
13 changes: 5 additions & 8 deletions pkgs/applications/misc/sweethome3d/editors.nix
Original file line number Diff line number Diff line change
@@ -7,20 +7,17 @@ let
m: "sweethome3d-"
+ removeSuffix "libraryeditor" (toLower m)
+ "-editor";
sweetName = m: v: sweetExec m + "-" + v;

getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;

mkEditorProject =
{ name, module, version, src, license, description, desktopName }:
{ pname, module, version, src, license, description, desktopName }:

stdenv.mkDerivation rec {
application = sweethome3dApp;
inherit name module version src description;
inherit pname module version src description;
exec = sweetExec module;
editorItem = makeDesktopItem {
inherit exec desktopName;
name = getDesktopFileName name;
name = pname;
comment = description;
genericName = "Computer Aided (Interior) Design";
categories = "Application;Graphics;2DGraphics;3DGraphics;";
@@ -66,7 +63,7 @@ in {
textures-editor = mkEditorProject rec {
version = "1.5";
module = "TexturesLibraryEditor";
name = sweetName module version;
pname = module;
description = "Easily create SH3T files and edit the properties of the texture images it contain";
license = stdenv.lib.licenses.gpl2Plus;
src = fetchcvs {
@@ -81,7 +78,7 @@ in {
furniture-editor = mkEditorProject rec {
version = "1.19";
module = "FurnitureLibraryEditor";
name = sweetName module version;
pname = module;
description = "Quickly create SH3F files and edit the properties of the 3D models it contain";
license = stdenv.lib.licenses.gpl2;
src = fetchcvs {
7 changes: 4 additions & 3 deletions pkgs/applications/networking/browsers/firefox/wrapper.nix
Original file line number Diff line number Diff line change
@@ -18,8 +18,9 @@ browser:

let
wrapper =
{ browserName ? browser.browserName or (builtins.parseDrvName browser.name).name
, name ? (browserName + "-" + (builtins.parseDrvName browser.name).version)
{ browserName ? browser.browserName or (lib.getName browser)
, pname ? browserName
, version ? lib.getVersion browser
, desktopName ? # browserName with first letter capitalized
(lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName)
, nameSuffix ? ""
@@ -83,7 +84,7 @@ let
gtk_modules = [ libcanberra-gtk2 ];

in stdenv.mkDerivation {
inherit name;
inherit pname version;

desktopItem = makeDesktopItem {
name = browserName;
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

set -eu -o pipefail

oldVersion="$(nix-instantiate --eval -E "with import ./. {}; slack-theme-black.version or (builtins.parseDrvName slack-theme-black.name).version" | tr -d '"')"
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion slack-theme-black" | tr -d '"')"
latestSha="$(curl -L -s https://api.github.com/repos/laCour/slack-night-mode/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"

if [ ! "null" = "${latestSha}" ]; then
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

set -eu -o pipefail

oldVersion=$(nix-instantiate --eval -E "with import ./. {}; zoom-us.version or (builtins.parseDrvName zoom-us.name).version" | tr -d '"')
oldVersion=$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion zoom-us" | tr -d '"')
version="$(curl -sI https://zoom.us/client/latest/zoom_x86_64.tar.xz | grep -Fi 'Location:' | pcregrep -o1 '/(([0-9]\.?)+)/')"

if [ ! "${oldVersion}" = "${version}" ]; then
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

set -eu -o pipefail

oldVersion="$(nix-instantiate --eval -E "with import ./. {}; git.version or (builtins.parseDrvName git.name).version" | tr -d '"')"
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion git" | tr -d '"')"
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|')"

if [ ! "${oldVersion}" = "${latestTag}" ]; then
2 changes: 1 addition & 1 deletion pkgs/applications/version-management/monotone/default.nix
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

let
version = "1.1";
perlVersion = (builtins.parseDrvName perl.name).version;
perlVersion = stdenv.lib.getVersion perl;
in

assert perlVersion != "";
2 changes: 1 addition & 1 deletion pkgs/applications/video/vdr/wrapper.nix
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

in symlinkJoin {

name = "vdr-with-plugins-${(builtins.parseDrvName vdr.name).version}";
name = "vdr-with-plugins-${lib.getVersion vdr}";

paths = [ vdr ] ++ plugins;

2 changes: 1 addition & 1 deletion pkgs/applications/virtualization/OVMF/default.nix
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ let
else
throw "Unsupported architecture";

version = (builtins.parseDrvName edk2.name).version;
version = lib.getVersion edk2;
in

edk2.mkDerivation projectDscPath {
6 changes: 3 additions & 3 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@ let
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");

bintoolsVersion = (builtins.parseDrvName bintools.name).version;
bintoolsName = (builtins.parseDrvName bintools.name).name;
bintoolsVersion = stdenv.lib.getVersion bintools;
bintoolsName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName bintools);

libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc;
@@ -74,7 +74,7 @@ in

stdenv.mkDerivation {
name = targetPrefix
+ (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${bintoolsName}-wrapper")
+ (if name != "" then name else "${bintoolsName}-wrapper")
+ (stdenv.lib.optionalString (bintools != null && bintoolsVersion != "") "-${bintoolsVersion}");

preferLocalBuild = true;
6 changes: 3 additions & 3 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
@@ -35,8 +35,8 @@ let
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");

ccVersion = (builtins.parseDrvName cc.name).version;
ccName = (builtins.parseDrvName cc.name).name;
ccVersion = stdenv.lib.getVersion cc;
ccName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName cc);

libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc;
@@ -94,7 +94,7 @@ assert nativePrefix == bintools.nativePrefix;

stdenv.mkDerivation {
name = targetPrefix
+ (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${ccName}-wrapper")
+ (if name != "" then name else "${ccName}-wrapper")
+ (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}");

preferLocalBuild = true;
4 changes: 2 additions & 2 deletions pkgs/common-updater/scripts/update-source-version
Original file line number Diff line number Diff line change
@@ -92,8 +92,8 @@ if [ -z "$oldUrl" ]; then
die "Couldn't evaluate source url from '$attr.src'!"
fi

drvName=$(nix-instantiate $systemArg --eval -E "with import ./. {}; (builtins.parseDrvName $attr.name).name" | tr -d '"')
oldVersion=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.${versionKey} or (builtins.parseDrvName $attr.name).version" | tr -d '"')
drvName=$(nix-instantiate $systemArg --eval -E "with import ./. {}; lib.getName $attr" | tr -d '"')
oldVersion=$(nix-instantiate $systemArg --eval -E "with import ./. {}; $attr.${versionKey} or lib.getVersion $attr" | tr -d '"')

if [ -z "$drvName" -o -z "$oldVersion" ]; then
die "Couldn't evaluate name and version from '$attr.name'!"
5 changes: 2 additions & 3 deletions pkgs/desktops/gnome-3/default.nix
Original file line number Diff line number Diff line change
@@ -14,10 +14,9 @@ lib.makeScope pkgs.newScope (self: with self; {
*/
removePackagesByName = packages: packagesToRemove:
let
pkgName = drv: (builtins.parseDrvName drv.name).name;
namesToRemove = map pkgName packagesToRemove;
namesToRemove = map lib.getName packagesToRemove;
in
lib.filter (x: !(builtins.elem (pkgName x) namesToRemove)) packages;
lib.filter (x: !(builtins.elem (lib.getName x) namesToRemove)) packages;

maintainers = with pkgs.lib.maintainers; [ lethalman jtojnar hedning worldofpeace ];

2 changes: 1 addition & 1 deletion pkgs/development/compilers/chicken/4/eggDerivation.nix
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
let
libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
overrides = import ./overrides.nix;
baseName = (builtins.parseDrvName name).name;
baseName = lib.getName name;
override = if builtins.hasAttr baseName overrides
then
builtins.getAttr baseName overrides
4 changes: 2 additions & 2 deletions pkgs/development/em-modules/generic/default.nix
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ pkgs.stdenv.mkDerivation (
args //
{

pname = "emscripten-${args.pname or (builtins.parseDrvName args.name).name}";
version = args.version or (builtins.parseDrvName args.name).version;
pname = "emscripten-${lib.getName args}";
version = lib.getVersion args;
buildInputs = [ emscripten python ] ++ buildInputs;
nativeBuildInputs = [ emscripten python ] ++ nativeBuildInputs;

2 changes: 1 addition & 1 deletion pkgs/development/interpreters/lua-5/build-lua-package.nix
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {

# enabled only for src.rock
setSourceRoot= let
name_only=(builtins.parseDrvName name).name;
name_only= lib.getName name;
in
lib.optionalString (knownRockspec == null) ''
# format is rockspec_basename/source_basename
2 changes: 1 addition & 1 deletion pkgs/development/libraries/science/math/caffe2/default.nix
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ let
dst = "pybind11";
};

ccVersion = (builtins.parseDrvName stdenv.cc.name).version;
ccVersion = lib.getVersion stdenv.cc;
in

stdenv.mkDerivation rec {
2 changes: 1 addition & 1 deletion pkgs/development/lisp-modules/openssl-lib-marked.nix
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ with import ../../../default.nix {};
runCommand "openssl-lib-marked" {} ''
mkdir -p "$out/lib"
for lib in ssl crypto; do
version="${(builtins.parseDrvName openssl.name).version}"
version="${lib.getVersion openssl}"
ln -s "${lib.getLib openssl}/lib/lib$lib.so" "$out/lib/lib$lib.so.$version"
version="$(echo "$version" | sed -re 's/[a-z]+$//')"
while test -n "$version"; do
Loading