various: fix pname misuse in buildRustApplication packages

after this all uses of 'inherit (finalAttrs) pname;' or 'finalAttrs.pname'
in these packages are in my opinion legit uses. e.g.:
- for inheriting the pname and version in fetchPnpmDeps, fetchCargoDeps or fetchCrate
- for use in creating the (p-)name of small sub-packages like tests or updateScripts.
- for cargoDepsName
- for buildAndTestSubdir
This commit is contained in:
quantenzitrone
2026-02-22 04:49:18 +01:00
parent ca363a08a9
commit 3f9a09b808
17 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
'';
postFixup = ''
patchelf --set-rpath "${lib.makeLibraryPath finalAttrs.buildInputs}" $out/bin/${finalAttrs.pname}
patchelf --set-rpath "${lib.makeLibraryPath finalAttrs.buildInputs}" $out/bin/${finalAttrs.meta.mainProgram}
'';
passthru.updateScript = nix-update-script { };
+1 -1
View File
@@ -35,7 +35,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
];
postInstall = ''
installManPage docs/${finalAttrs.pname}.1
installManPage docs/authoscope.1
'';
# Tests requires access to httpin.org
+1 -1
View File
@@ -46,7 +46,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
mv $out/share/applications/software.Browsers.template.desktop $out/share/applications/software.Browsers.desktop
substituteInPlace \
$out/share/applications/software.Browsers.desktop \
--replace-fail 'Exec=ExecCommand' 'Exec=${finalAttrs.pname} %u'
--replace-fail 'Exec=ExecCommand' 'Exec=${finalAttrs.meta.mainProgram} %u'
cp -r resources $out
for size in 16 32 128 256 512; do
install -m 444 \
+1 -1
View File
@@ -15,7 +15,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
src = fetchFromGitHub {
owner = "CycloneDX";
repo = "cyclonedx-rust-cargo";
rev = "${finalAttrs.pname}-${finalAttrs.version}";
rev = "cargo-cyclonedx-${finalAttrs.version}";
hash = "sha256-T/9eHI2P8eCZAqMTeZz1yEi5nljQWfHrdNiU3h3h74U=";
};
+2 -2
View File
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
];
env = {
ENGAGE_DOCS_LINK = "file://${placeholder "doc"}/share/doc/${finalAttrs.pname}/index.html";
ENGAGE_DOCS_LINK = "file://${placeholder "doc"}/share/doc/engage/index.html";
};
src = fetchFromGitLab {
@@ -57,7 +57,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
${lib.getExe mdbook} build
mkdir -p "$doc/share/doc"
mv public "$doc/share/doc/${finalAttrs.pname}"
mv public "$doc/share/doc/engage"
'';
meta = {
+1 -1
View File
@@ -49,7 +49,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
];
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf $out/bin/${finalAttrs.pname} \
patchelf $out/bin/${finalAttrs.meta.mainProgram} \
--add-rpath ${
lib.makeLibraryPath [
vulkan-loader
+1 -1
View File
@@ -58,7 +58,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
desktopName = "Halloy";
comment = "IRC client written in Rust";
icon = "org.squidowl.halloy";
exec = finalAttrs.pname;
exec = finalAttrs.meta.mainProgram;
terminal = false;
mimeTypes = [
"x-scheme-handler/irc"
+1 -1
View File
@@ -10,7 +10,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
src = fetchFromGitHub {
owner = "scruffystuffs";
repo = "${finalAttrs.pname}.rs";
repo = "jfmt.rs";
rev = "v${finalAttrs.version}";
hash = "sha256-X3wk669G07BTPAT5xGbAfIu2Qk90aaJIi1CLmOnSG80=";
};
+1 -1
View File
@@ -18,7 +18,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
meta = {
description = "Preprocessor for mdbook, rendering LaTeX equations to HTML at build time";
mainProgram = "mdbook-katex";
homepage = "https://github.com/lzanini/${finalAttrs.pname}";
homepage = "https://github.com/lzanini/mdbook-katex";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
lovesegfault
+1 -1
View File
@@ -36,7 +36,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
doInstallCheck = true;
installCheckPhase = ''
if [[ "$(${expect}/bin/unbuffer "$out/bin/${finalAttrs.pname}" --help 2> /dev/null | strings | grep ${finalAttrs.version} | tr -d '\n')" == " ${finalAttrs.version}" ]]; then
if [[ "$(${expect}/bin/unbuffer "$out/bin/${finalAttrs.meta.mainProgram}" --help 2> /dev/null | strings | grep ${finalAttrs.version} | tr -d '\n')" == " ${finalAttrs.version}" ]]; then
echo '${finalAttrs.pname} smoke check passed'
else
echo '${finalAttrs.pname} smoke check failed'
+1 -1
View File
@@ -48,7 +48,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
postPatch = ''
substituteInPlace src-tauri/tauri.conf.json \
--replace-fail '"mainBinaryName": "Rclone UI"' '"mainBinaryName": "${finalAttrs.pname}"'
--replace-fail '"mainBinaryName": "Rclone UI"' '"mainBinaryName": "${finalAttrs.meta.mainProgram}"'
substituteInPlace src-tauri/Cargo.toml \
--replace-fail 'name = "app"' 'name = "${finalAttrs.pname}"'
'';
+1 -1
View File
@@ -12,7 +12,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
src = fetchgit {
url = "https://git.launchpad.net/safe-rm";
tag = "${finalAttrs.pname}-${finalAttrs.version}";
tag = "safe-rm-${finalAttrs.version}";
sha256 = "sha256-7+4XwsjzLBCQmHDYNwhlN4Yg3eL43GUEbq8ROtuP2Kw=";
};
+3 -3
View File
@@ -85,9 +85,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
installManPage target/mangen/*
installShellCompletion --cmd ${finalAttrs.pname} \
target/shellcomplete/${finalAttrs.pname}.{bash,fish} \
--zsh target/shellcomplete/_${finalAttrs.pname}
installShellCompletion --cmd ${finalAttrs.meta.mainProgram} \
target/shellcomplete/${finalAttrs.meta.mainProgram}.{bash,fish} \
--zsh target/shellcomplete/_${finalAttrs.meta.mainProgram}
'';
# RUST_BACKTRACE = 1;
+1 -1
View File
@@ -20,7 +20,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
cargoHash = "sha256-7qLC1RvjBXd9JFrJdDTIngZhMvyQV1ko3MXRr/2y7hA=";
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.pname}-ts";
versionCheckProgram = "${placeholder "out"}/bin/similarity-ts";
doInstallCheck = true;
passthru.updateScript = nix-update-script { };
+1 -1
View File
@@ -14,7 +14,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
domain = "git.syndicate-lang.org";
owner = "syndicate-lang";
repo = "syndicate-rs";
rev = "${finalAttrs.pname}-v${finalAttrs.version}";
rev = "syndicate-server-v${finalAttrs.version}";
hash = "sha256-orQN83DE+ZNgdx2PVcYrte/rVDFFtuQuRDKzeumpsLo=";
};
+2 -2
View File
@@ -22,8 +22,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
env.RUSTC_BOOTSTRAP = 1;
postInstall = ''
install -D -m 0444 ../../README* -t "$out/share/doc/${finalAttrs.pname}"
install -D -m 0444 ../../LICEN* -t "$out/share/doc/${finalAttrs.pname}"
install -D -m 0444 ../../README* -t "$out/share/doc/unpfs"
install -D -m 0444 ../../LICEN* -t "$out/share/doc/unpfs"
'';
meta = {
+2 -2
View File
@@ -49,10 +49,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
postPatch = ''
substituteInPlace src/config.rs \
--replace-fail "/etc/wleave" "$out/etc/${finalAttrs.pname}"
--replace-fail "/etc/wleave" "$out/etc/wleave"
substituteInPlace layout.json \
--replace-fail "/usr/share/wleave" "$out/share/${finalAttrs.pname}"
--replace-fail "/usr/share/wleave" "$out/share/wleave"
'';
postInstall = ''