Merge pull request #74057 from Ericson2314/wrapper-pname-support

treewide: Purge most parseDrvName
This commit is contained in:
John Ericson
2019-11-24 13:31:35 -05:00
committed by GitHub
42 changed files with 94 additions and 96 deletions
+5 -6
View File
@@ -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: For a more useful example, try the following. This configuration only allows unfree packages named flash player and visual studio code:
<programlisting> <programlisting>
{ {
allowUnfreePredicate = (pkg: builtins.elem allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
(pkg.pname or (builtins.parseDrvName pkg.name).name) [ "flashplayer"
"flashplayer" "vscode"
"vscode" ];
]);
} }
</programlisting> </programlisting>
</para> </para>
@@ -217,7 +216,7 @@
The following configuration example only allows insecure packages with very short names: The following configuration example only allows insecure packages with very short names:
<programlisting> <programlisting>
{ {
allowInsecurePredicate = (pkg: (builtins.stringLength (builtins.parseDrvName pkg.name).name) &lt;= 5); allowInsecurePredicate = pkg: builtins.stringLength (lib.getName pkg) &lt;= 5;
} }
</programlisting> </programlisting>
</para> </para>
+2 -1
View File
@@ -84,7 +84,8 @@ let
hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape hasInfix hasPrefix hasSuffix stringToCharacters stringAsChars escape
escapeShellArg escapeShellArgs replaceChars lowerChars escapeShellArg escapeShellArgs replaceChars lowerChars
upperChars toLower toUpper addContextFrom splitString upperChars toLower toUpper addContextFrom splitString
removePrefix removeSuffix versionOlder versionAtLeast getVersion removePrefix removeSuffix versionOlder versionAtLeast
getName getVersion
nameFromURL enableFeature enableFeatureAs withFeature nameFromURL enableFeature enableFeatureAs withFeature
withFeatureAs fixedWidthString fixedWidthNumber isStorePath withFeatureAs fixedWidthString fixedWidthNumber isStorePath
toInt readPathsFromFile fileContents; toInt readPathsFromFile fileContents;
+17
View File
@@ -472,6 +472,23 @@ rec {
*/ */
versionAtLeast = v1: v2: !versionOlder v1 v2; 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 /* This function takes an argument that's either a derivation or a
derivation's "name" attribute and extracts the version part from that derivation's "name" attribute and extracts the version part from that
argument. argument.
+1 -1
View File
@@ -126,7 +126,7 @@ let
packageData = package: { packageData = package: {
name = package.name; name = package.name;
pname = (builtins.parseDrvName package.name).name; pname = lib.getName package;
updateScript = map builtins.toString (pkgs.lib.toList package.updateScript); updateScript = map builtins.toString (pkgs.lib.toList package.updateScript);
}; };
+4 -8
View File
@@ -8,15 +8,11 @@ let
mysql = cfg.package; mysql = cfg.package;
isMariaDB = isMariaDB = lib.getName mysql == lib.getName pkgs.mariadb;
let
pName = _p: (builtins.parseDrvName (_p.name)).name;
in pName mysql == pName pkgs.mariadb;
isMysqlAtLeast57 = isMysqlAtLeast57 =
let (lib.getName mysql == lib.getName pkgs.mysql57)
pName = _p: (builtins.parseDrvName (_p.name)).name; && (builtins.compareVersions mysql.version "5.7" >= 0);
in (pName mysql == pName pkgs.mysql57)
&& ((builtins.compareVersions mysql.version "5.7") >= 0);
mysqldOptions = mysqldOptions =
"--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql}"; "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql}";
@@ -239,7 +239,7 @@ in
services.znc = { services.znc = {
configFile = mkDefault (pkgs.writeText "znc-generated.conf" semanticString); configFile = mkDefault (pkgs.writeText "znc-generated.conf" semanticString);
config = { config = {
Version = (builtins.parseDrvName pkgs.znc.name).version; Version = lib.getVersion pkgs.znc;
Listener.l.Port = mkDefault 5000; Listener.l.Port = mkDefault 5000;
Listener.l.SSL = mkDefault true; Listener.l.SSL = mkDefault true;
}; };
@@ -47,8 +47,8 @@ let
grub = f grub; grub = f grub;
grubTarget = f (grub.grubTarget or ""); grubTarget = f (grub.grubTarget or "");
shell = "${pkgs.runtimeShell}"; shell = "${pkgs.runtimeShell}";
fullName = (builtins.parseDrvName realGrub.name).name; fullName = lib.getName realGrub;
fullVersion = (builtins.parseDrvName realGrub.name).version; fullVersion = lib.getVersion realGrub;
grubEfi = f grubEfi; grubEfi = f grubEfi;
grubTargetEfi = if cfg.efiSupport && (cfg.version == 2) then f (grubEfi.grubTarget or "") else ""; grubTargetEfi = if cfg.efiSupport && (cfg.version == 2) then f (grubEfi.grubTarget or "") else "";
bootPath = args.path; bootPath = args.path;
@@ -37,7 +37,7 @@ mkDerivation rec {
# https://cgit.kde.org/kdevelop.git/commit/?id=716372ae2e8dff9c51e94d33443536786e4bd85b # https://cgit.kde.org/kdevelop.git/commit/?id=716372ae2e8dff9c51e94d33443536786e4bd85b
# required as nixos seems to be unable to find CLANG_BUILTIN_DIR # required as nixos seems to be unable to find CLANG_BUILTIN_DIR
cmakeFlags = [ 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; dontWrapQtApps = true;
@@ -3,8 +3,6 @@
let let
getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;
# TODO: Should we move this to `lib`? Seems like its would be useful in many cases. # TODO: Should we move this to `lib`? Seems like its would be useful in many cases.
extensionOf = filePath: extensionOf = filePath:
lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath))); lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath)));
@@ -15,15 +13,15 @@ let
'') icons); '') icons);
mkSweetHome3D = mkSweetHome3D =
{ name, module, version, src, license, description, desktopName, icons }: { pname, module, version, src, license, description, desktopName, icons }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
inherit name version src description; inherit pname version src description;
exec = stdenv.lib.toLower module; exec = stdenv.lib.toLower module;
sweethome3dItem = makeDesktopItem { sweethome3dItem = makeDesktopItem {
inherit exec desktopName; inherit exec desktopName;
name = getDesktopFileName name; name = pname;
icon = getDesktopFileName name; icon = pname;
comment = description; comment = description;
genericName = "Computer Aided (Interior) Design"; genericName = "Computer Aided (Interior) Design";
categories = "Application;Graphics;2DGraphics;3DGraphics;"; categories = "Application;Graphics;2DGraphics;3DGraphics;";
@@ -49,7 +47,7 @@ let
mkdir -p $out/bin mkdir -p $out/bin
cp install/${module}-${version}.jar $out/share/java/. cp install/${module}-${version}.jar $out/share/java/.
${installIcons (getDesktopFileName name) icons} ${installIcons pname icons}
cp "${sweethome3dItem}/share/applications/"* $out/share/applications cp "${sweethome3dItem}/share/applications/"* $out/share/applications
@@ -74,9 +72,9 @@ let
in { in {
application = mkSweetHome3D rec { application = mkSweetHome3D rec {
pname = stdenv.lib.toLower module + "-application";
version = "6.2"; version = "6.2";
module = "SweetHome3D"; module = "SweetHome3D";
name = stdenv.lib.toLower module + "-application-" + version;
description = "Design and visualize your future home"; description = "Design and visualize your future home";
license = stdenv.lib.licenses.gpl2Plus; license = stdenv.lib.licenses.gpl2Plus;
src = fetchsvn { src = fetchsvn {
@@ -7,20 +7,17 @@ let
m: "sweethome3d-" m: "sweethome3d-"
+ removeSuffix "libraryeditor" (toLower m) + removeSuffix "libraryeditor" (toLower m)
+ "-editor"; + "-editor";
sweetName = m: v: sweetExec m + "-" + v;
getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;
mkEditorProject = mkEditorProject =
{ name, module, version, src, license, description, desktopName }: { pname, module, version, src, license, description, desktopName }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
application = sweethome3dApp; application = sweethome3dApp;
inherit name module version src description; inherit pname module version src description;
exec = sweetExec module; exec = sweetExec module;
editorItem = makeDesktopItem { editorItem = makeDesktopItem {
inherit exec desktopName; inherit exec desktopName;
name = getDesktopFileName name; name = pname;
comment = description; comment = description;
genericName = "Computer Aided (Interior) Design"; genericName = "Computer Aided (Interior) Design";
categories = "Application;Graphics;2DGraphics;3DGraphics;"; categories = "Application;Graphics;2DGraphics;3DGraphics;";
@@ -66,7 +63,7 @@ in {
textures-editor = mkEditorProject rec { textures-editor = mkEditorProject rec {
version = "1.5"; version = "1.5";
module = "TexturesLibraryEditor"; module = "TexturesLibraryEditor";
name = sweetName module version; pname = module;
description = "Easily create SH3T files and edit the properties of the texture images it contain"; description = "Easily create SH3T files and edit the properties of the texture images it contain";
license = stdenv.lib.licenses.gpl2Plus; license = stdenv.lib.licenses.gpl2Plus;
src = fetchcvs { src = fetchcvs {
@@ -81,7 +78,7 @@ in {
furniture-editor = mkEditorProject rec { furniture-editor = mkEditorProject rec {
version = "1.19"; version = "1.19";
module = "FurnitureLibraryEditor"; module = "FurnitureLibraryEditor";
name = sweetName module version; pname = module;
description = "Quickly create SH3F files and edit the properties of the 3D models it contain"; description = "Quickly create SH3F files and edit the properties of the 3D models it contain";
license = stdenv.lib.licenses.gpl2; license = stdenv.lib.licenses.gpl2;
src = fetchcvs { src = fetchcvs {
@@ -18,8 +18,9 @@ browser:
let let
wrapper = wrapper =
{ browserName ? browser.browserName or (builtins.parseDrvName browser.name).name { browserName ? browser.browserName or (lib.getName browser)
, name ? (browserName + "-" + (builtins.parseDrvName browser.name).version) , pname ? browserName
, version ? lib.getVersion browser
, desktopName ? # browserName with first letter capitalized , desktopName ? # browserName with first letter capitalized
(lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName) (lib.toUpper (lib.substring 0 1 browserName) + lib.substring 1 (-1) browserName)
, nameSuffix ? "" , nameSuffix ? ""
@@ -83,7 +84,7 @@ let
gtk_modules = [ libcanberra-gtk2 ]; gtk_modules = [ libcanberra-gtk2 ];
in stdenv.mkDerivation { in stdenv.mkDerivation {
inherit name; inherit pname version;
desktopItem = makeDesktopItem { desktopItem = makeDesktopItem {
name = browserName; name = browserName;
@@ -3,7 +3,7 @@
set -eu -o pipefail 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')" 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 if [ ! "null" = "${latestSha}" ]; then
@@ -3,7 +3,7 @@
set -eu -o pipefail 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]\.?)+)/')" version="$(curl -sI https://zoom.us/client/latest/zoom_x86_64.tar.xz | grep -Fi 'Location:' | pcregrep -o1 '/(([0-9]\.?)+)/')"
if [ ! "${oldVersion}" = "${version}" ]; then if [ ! "${oldVersion}" = "${version}" ]; then
@@ -3,7 +3,7 @@
set -eu -o pipefail 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|')" 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 if [ ! "${oldVersion}" = "${latestTag}" ]; then
@@ -5,7 +5,7 @@
let let
version = "1.1"; version = "1.1";
perlVersion = (builtins.parseDrvName perl.name).version; perlVersion = stdenv.lib.getVersion perl;
in in
assert perlVersion != ""; assert perlVersion != "";
+1 -1
View File
@@ -8,7 +8,7 @@
in symlinkJoin { in symlinkJoin {
name = "vdr-with-plugins-${(builtins.parseDrvName vdr.name).version}"; name = "vdr-with-plugins-${lib.getVersion vdr}";
paths = [ vdr ] ++ plugins; paths = [ vdr ] ++ plugins;
@@ -16,7 +16,7 @@ let
else else
throw "Unsupported architecture"; throw "Unsupported architecture";
version = (builtins.parseDrvName edk2.name).version; version = lib.getVersion edk2;
in in
edk2.mkDerivation projectDscPath { edk2.mkDerivation projectDscPath {
@@ -34,8 +34,8 @@ let
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-"); (targetPlatform.config + "-");
bintoolsVersion = (builtins.parseDrvName bintools.name).version; bintoolsVersion = stdenv.lib.getVersion bintools;
bintoolsName = (builtins.parseDrvName bintools.name).name; bintoolsName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName bintools);
libc_bin = if libc == null then null else getBin libc; libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc; libc_dev = if libc == null then null else getDev libc;
@@ -74,7 +74,7 @@ in
stdenv.mkDerivation { stdenv.mkDerivation {
name = targetPrefix 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}"); + (stdenv.lib.optionalString (bintools != null && bintoolsVersion != "") "-${bintoolsVersion}");
preferLocalBuild = true; preferLocalBuild = true;
+3 -3
View File
@@ -35,8 +35,8 @@ let
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-"); (targetPlatform.config + "-");
ccVersion = (builtins.parseDrvName cc.name).version; ccVersion = stdenv.lib.getVersion cc;
ccName = (builtins.parseDrvName cc.name).name; ccName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName cc);
libc_bin = if libc == null then null else getBin libc; libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc; libc_dev = if libc == null then null else getDev libc;
@@ -94,7 +94,7 @@ assert nativePrefix == bintools.nativePrefix;
stdenv.mkDerivation { stdenv.mkDerivation {
name = targetPrefix 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}"); + (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}");
preferLocalBuild = true; preferLocalBuild = true;
@@ -92,8 +92,8 @@ if [ -z "$oldUrl" ]; then
die "Couldn't evaluate source url from '$attr.src'!" die "Couldn't evaluate source url from '$attr.src'!"
fi fi
drvName=$(nix-instantiate $systemArg --eval -E "with import ./. {}; (builtins.parseDrvName $attr.name).name" | 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 (builtins.parseDrvName $attr.name).version" | 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 if [ -z "$drvName" -o -z "$oldVersion" ]; then
die "Couldn't evaluate name and version from '$attr.name'!" die "Couldn't evaluate name and version from '$attr.name'!"
+2 -3
View File
@@ -14,10 +14,9 @@ lib.makeScope pkgs.newScope (self: with self; {
*/ */
removePackagesByName = packages: packagesToRemove: removePackagesByName = packages: packagesToRemove:
let let
pkgName = drv: (builtins.parseDrvName drv.name).name; namesToRemove = map lib.getName packagesToRemove;
namesToRemove = map pkgName packagesToRemove;
in 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 ]; maintainers = with pkgs.lib.maintainers; [ lethalman jtojnar hedning worldofpeace ];
@@ -8,7 +8,7 @@
let let
libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/"; libPath = "${chicken}/var/lib/chicken/${toString chicken.binaryVersion}/";
overrides = import ./overrides.nix; overrides = import ./overrides.nix;
baseName = (builtins.parseDrvName name).name; baseName = lib.getName name;
override = if builtins.hasAttr baseName overrides override = if builtins.hasAttr baseName overrides
then then
builtins.getAttr baseName overrides builtins.getAttr baseName overrides
@@ -10,8 +10,8 @@ pkgs.stdenv.mkDerivation (
args // args //
{ {
pname = "emscripten-${args.pname or (builtins.parseDrvName args.name).name}"; pname = "emscripten-${lib.getName args}";
version = args.version or (builtins.parseDrvName args.name).version; version = lib.getVersion args;
buildInputs = [ emscripten python ] ++ buildInputs; buildInputs = [ emscripten python ] ++ buildInputs;
nativeBuildInputs = [ emscripten python ] ++ nativeBuildInputs; nativeBuildInputs = [ emscripten python ] ++ nativeBuildInputs;
@@ -161,7 +161,7 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {
# enabled only for src.rock # enabled only for src.rock
setSourceRoot= let setSourceRoot= let
name_only=(builtins.parseDrvName name).name; name_only= lib.getName name;
in in
lib.optionalString (knownRockspec == null) '' lib.optionalString (knownRockspec == null) ''
# format is rockspec_basename/source_basename # format is rockspec_basename/source_basename
@@ -57,7 +57,7 @@ let
dst = "pybind11"; dst = "pybind11";
}; };
ccVersion = (builtins.parseDrvName stdenv.cc.name).version; ccVersion = lib.getVersion stdenv.cc;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@@ -2,7 +2,7 @@ with import ../../../default.nix {};
runCommand "openssl-lib-marked" {} '' runCommand "openssl-lib-marked" {} ''
mkdir -p "$out/lib" mkdir -p "$out/lib"
for lib in ssl crypto; do 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" ln -s "${lib.getLib openssl}/lib/lib$lib.so" "$out/lib/lib$lib.so.$version"
version="$(echo "$version" | sed -re 's/[a-z]+$//')" version="$(echo "$version" | sed -re 's/[a-z]+$//')"
while test -n "$version"; do while test -n "$version"; do
@@ -31,15 +31,15 @@ toPerlModule(stdenv.mkDerivation (
# https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC # https://metacpan.org/pod/release/XSAWYERX/perl-5.26.0/pod/perldelta.pod#Removal-of-the-current-directory-%28%22.%22%29-from-@INC
PERL_USE_UNSAFE_INC = "1"; PERL_USE_UNSAFE_INC = "1";
meta.homepage = "https://metacpan.org/release/${attrs.pname or (builtins.parseDrvName attrs.name).name}"; # TODO: phase-out `attrs.name` meta.homepage = "https://metacpan.org/release/${lib.getName attrs}"; # TODO: phase-out `attrs.name`
meta.platforms = perl.meta.platforms; meta.platforms = perl.meta.platforms;
} }
attrs attrs
) )
// //
{ {
pname = "perl${perl.version}-${attrs.pname or (builtins.parseDrvName attrs.name).name}"; # TODO: phase-out `attrs.name` pname = "perl${perl.version}-${lib.getName attrs}"; # TODO: phase-out `attrs.name`
version = attrs.version or (builtins.parseDrvName attrs.name).version; # TODO: phase-out `attrs.name` version = lib.getVersion attrs; # TODO: phase-out `attrs.name`
builder = ./builder.sh; builder = ./builder.sh;
buildInputs = buildInputs ++ [ perl ]; buildInputs = buildInputs ++ [ perl ];
nativeBuildInputs = nativeBuildInputs ++ [ (perl.dev or perl) ]; nativeBuildInputs = nativeBuildInputs ++ [ (perl.dev or perl) ];
@@ -38,7 +38,7 @@ def get_radare2_rev() -> str:
def get_cutter_version() -> str: def get_cutter_version() -> str:
version_expr = """ version_expr = """
(with import <nixpkgs> {}; (builtins.parseDrvName (qt5.callPackage <radare2/cutter.nix> {}).name).version) (with import <nixpkgs> {}; lib.getVersion (qt5.callPackage <radare2/cutter.nix> {}))
""" """
return sh("nix", "eval", "--raw", version_expr.strip(), "-I", "radare2={0}".format(SCRIPT_DIR)) return sh("nix", "eval", "--raw", version_expr.strip(), "-I", "radare2={0}".format(SCRIPT_DIR))
@@ -4,7 +4,7 @@
set -eu -o pipefail set -eu -o pipefail
core_json="$(curl -s --fail --location https://updates.jenkins.io/stable/update-center.actual.json | jq .core)" core_json="$(curl -s --fail --location https://updates.jenkins.io/stable/update-center.actual.json | jq .core)"
oldVersion=$(nix-instantiate --eval -E "with import ./. {}; jenkins.version or (builtins.parseDrvName jenkins.name).version" | tr -d '"') oldVersion=$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion jenkins" | tr -d '"')
version="$(jq -r .version <<<$core_json)" version="$(jq -r .version <<<$core_json)"
sha256="$(jq -r .sha256 <<<$core_json)" sha256="$(jq -r .sha256 <<<$core_json)"
@@ -1,16 +1,15 @@
{ stdenv, nodePackages_10_x }: { stdenv, nodePackages_10_x }:
let let
drvName = drv: (builtins.parseDrvName drv).name;
linkNodeDeps = ({ pkg, deps, name ? "" }: linkNodeDeps = ({ pkg, deps, name ? "" }:
let let
targetModule = if name != "" then name else drvName pkg; targetModule = if name != "" then name else stdenv.lib.getName pkg;
in nodePackages_10_x.${pkg}.override (oldAttrs: { in nodePackages_10_x.${pkg}.override (oldAttrs: {
postInstall = '' postInstall = ''
mkdir -p $out/lib/node_modules/${targetModule}/node_modules mkdir -p $out/lib/node_modules/${targetModule}/node_modules
${stdenv.lib.concatStringsSep "\n" (map (dep: '' ${stdenv.lib.concatStringsSep "\n" (map (dep: ''
ln -s ${nodePackages_10_x.${dep}}/lib/node_modules/${drvName dep} \ ln -s ${nodePackages_10_x.${dep}}/lib/node_modules/${stdenv.lib.getName dep} \
$out/lib/node_modules/${targetModule}/node_modules/${drvName dep} $out/lib/node_modules/${targetModule}/node_modules/${stdenv.lib.getName dep}
'') deps '') deps
)} )}
''; '';
+2 -8
View File
@@ -1,14 +1,8 @@
{ stdenv, lib, makeWrapper, retroarch, cores }: { stdenv, lib, makeWrapper, retroarch, cores }:
let
p = builtins.parseDrvName retroarch.name;
in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "retroarch-" + p.version; pname = "retroarch";
version = p.version; version = lib.getVersion retroarch;
buildInputs = [ makeWrapper ]; buildInputs = [ makeWrapper ];
+1 -1
View File
@@ -5,7 +5,7 @@ with callPackage ./util.nix {};
let patch = (callPackage ./sources.nix {}).staging; let patch = (callPackage ./sources.nix {}).staging;
build-inputs = pkgNames: extra: build-inputs = pkgNames: extra:
(mkBuildInputs wineUnstable.pkgArches pkgNames) ++ extra; (mkBuildInputs wineUnstable.pkgArches pkgNames) ++ extra;
in assert (builtins.parseDrvName wineUnstable.name).version == patch.version; in assert stdenv.lib.getVersion wineUnstable == patch.version;
stdenv.lib.overrideDerivation wineUnstable (self: { stdenv.lib.overrideDerivation wineUnstable (self: {
buildInputs = build-inputs [ "perl" "utillinux" "autoconf" libtxc_dxtn_Name ] self.buildInputs; buildInputs = build-inputs [ "perl" "utillinux" "autoconf" libtxc_dxtn_Name ] self.buildInputs;
+1 -1
View File
@@ -25,7 +25,7 @@ let
addonInfo ? null, addonInfo ? null,
preInstall ? "", preInstall ? "",
postInstall ? "", postInstall ? "",
path ? (builtins.parseDrvName pluginName).name, path ? lib.getName pluginName,
dependencies ? [], dependencies ? [],
... ...
}: }:
+1 -1
View File
@@ -18,7 +18,7 @@ rec {
buildPhase ? "", buildPhase ? "",
preInstall ? "", preInstall ? "",
postInstall ? "", postInstall ? "",
path ? (builtins.parseDrvName name).name, path ? stdenv.lib.getName name,
addonInfo ? null, addonInfo ? null,
... ...
}: }:
+1 -1
View File
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz ) ( cd $sourceRoot/tools; tar -xaf prltools${if x64 then ".x64" else ""}.tar.gz )
''; '';
kernelVersion = if libsOnly then "" else (builtins.parseDrvName kernel.name).version; kernelVersion = if libsOnly then "" else lib.getName kernel.name;
kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}"; kernelDir = if libsOnly then "" else "${kernel.dev}/lib/modules/${kernelVersion}";
scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${utillinux}/bin" "${gawk}/bin" ]); scriptPath = lib.concatStringsSep ":" (lib.optionals (!libsOnly) [ "${utillinux}/bin" "${gawk}/bin" ]);
+2 -2
View File
@@ -529,7 +529,7 @@ self: super:
xorgserver = with self; super.xorgserver.overrideAttrs (attrs_passed: xorgserver = with self; super.xorgserver.overrideAttrs (attrs_passed:
# exchange attrs if abiCompat is set # exchange attrs if abiCompat is set
let let
version = (builtins.parseDrvName attrs_passed.name).version; version = lib.getVersion attrs_passed;
attrs = attrs =
if (abiCompat == null || lib.hasPrefix abiCompat version) then if (abiCompat == null || lib.hasPrefix abiCompat version) then
attrs_passed // { attrs_passed // {
@@ -564,7 +564,7 @@ self: super:
in attrs // in attrs //
(let (let
version = (builtins.parseDrvName attrs.name).version; version = lib.getVersion attrs;
commonBuildInputs = attrs.buildInputs ++ [ xtrans ]; commonBuildInputs = attrs.buildInputs ++ [ xtrans ];
commonPropagatedBuildInputs = [ commonPropagatedBuildInputs = [
zlib libGL libGLU dbus zlib libGL libGLU dbus
+1 -1
View File
@@ -3,7 +3,7 @@
set -eu -o pipefail set -eu -o pipefail
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.version or (builtins.parseDrvName oh-my-zsh.name).version" | tr -d '"')" oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion oh-my-zsh" | tr -d '"')"
latestSha="$(curl -L -s https://api.github.com/repos/robbyrussell/oh-my-zsh/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')" latestSha="$(curl -L -s https://api.github.com/repos/robbyrussell/oh-my-zsh/commits\?sha\=master\&since\=${oldVersion} | jq -r '.[0].sha')"
url="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.src.url" | tr -d '"')" url="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.src.url" | tr -d '"')"
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ cmake qt4 taglib chromaprint ffmpeg ]; buildInputs = [ cmake qt4 taglib chromaprint ffmpeg ];
cmakeFlags = [ "-DTAGLIB_MIN_VERSION=${(builtins.parseDrvName taglib.name).version}" ]; cmakeFlags = [ "-DTAGLIB_MIN_VERSION=${stdenv.lib.getVersion taglib}" ];
patches = [ patches = [
(fetchpatch { (fetchpatch {
+1 -1
View File
@@ -3,7 +3,7 @@
}: }:
let let
name = "ibus-with-plugins-" + (builtins.parseDrvName ibus.name).version; name = "ibus-with-plugins-" + stdenv.lib.getVersion ibus;
env = { env = {
buildInputs = [ ibus ] ++ plugins; buildInputs = [ ibus ] ++ plugins;
nativeBuildInputs = [ lndir makeWrapper ]; nativeBuildInputs = [ lndir makeWrapper ];
+1 -1
View File
@@ -1,7 +1,7 @@
{ stdenv, afl}: { stdenv, afl}:
stdenv.mkDerivation { stdenv.mkDerivation {
version = (builtins.parseDrvName afl.name).version; version = stdenv.lib.getVersion afl;
pname = "libdislocator"; pname = "libdislocator";
src = afl.src; src = afl.src;
+3 -6
View File
@@ -18862,8 +18862,7 @@ in
firefox-bin = wrapFirefox firefox-bin-unwrapped { firefox-bin = wrapFirefox firefox-bin-unwrapped {
browserName = "firefox"; browserName = "firefox";
name = "firefox-bin-" + pname = "firefox-bin";
(builtins.parseDrvName firefox-bin-unwrapped.name).version;
desktopName = "Firefox"; desktopName = "Firefox";
}; };
@@ -18876,8 +18875,7 @@ in
firefox-beta-bin = res.wrapFirefox firefox-beta-bin-unwrapped { firefox-beta-bin = res.wrapFirefox firefox-beta-bin-unwrapped {
browserName = "firefox"; browserName = "firefox";
name = "firefox-beta-bin-" + pname = "firefox-beta-bin";
(builtins.parseDrvName firefox-beta-bin-unwrapped.name).version;
desktopName = "Firefox Beta"; desktopName = "Firefox Beta";
}; };
@@ -18891,8 +18889,7 @@ in
firefox-devedition-bin = res.wrapFirefox firefox-devedition-bin-unwrapped { firefox-devedition-bin = res.wrapFirefox firefox-devedition-bin-unwrapped {
browserName = "firefox"; browserName = "firefox";
nameSuffix = "-devedition"; nameSuffix = "-devedition";
name = "firefox-devedition-bin-" + pname = "firefox-devedition-bin";
(builtins.parseDrvName firefox-devedition-bin-unwrapped.name).version;
desktopName = "Firefox DevEdition"; desktopName = "Firefox DevEdition";
}; };
+1 -1
View File
@@ -23,7 +23,7 @@ let
isLua51 = (lib.versions.majorMinor lua.version) == "5.1"; isLua51 = (lib.versions.majorMinor lua.version) == "5.1";
isLua52 = (lib.versions.majorMinor lua.version) == "5.2"; isLua52 = (lib.versions.majorMinor lua.version) == "5.2";
isLua53 = lua.luaversion == "5.3"; isLua53 = lua.luaversion == "5.3";
isLuaJIT = (builtins.parseDrvName lua.name).name == "luajit"; isLuaJIT = lib.getName lua == "luajit";
lua-setup-hook = callPackage ../development/interpreters/lua-5/setup-hook.nix { }; lua-setup-hook = callPackage ../development/interpreters/lua-5/setup-hook.nix { };