Skip to content

various: fix pname misuse in urls - #483962

Merged
gepbird merged 1 commit into
NixOS:masterfrom
quantenzitrone:fix-pname-misuse
Feb 5, 2026
Merged

gepbird merged 1 commit into
NixOS:masterfrom
quantenzitrone:fix-pname-misuse

Conversation

@quantenzitrone

@quantenzitrone quantenzitrone commented Jan 26, 2026 •

Copy link
Copy Markdown
Contributor

ref: #277994

pname misuse in urls was easy to automatically fix

script:

for i in (rg 'url = .*\$\{pname\}' */*/package.nix | cat)
    set file (string split -m 1 : $i -f 1)
    set line (string split -m 1 : $i -f 2)
    set pname (rg -F 'pname =' $file | cut -d '"' -f 2)
    if test (count $pname) -eq 1
        sd -F $line (echo $line | sd -F '${pname}' "$pname") $file
    end
    if rg --quiet 'pname[^ ][^=]' $file
        git restore $file
    end
end

set torestore; for i in (git show HEAD | rg -F '+++ b/' | cut -d / -f 2-)
    set pname (string split / $i -f 4)
    if ! nix eval .#$pname
        set torestore $torestore $i
    end
end

git restore $torestore

nix fmt

Things done

  • checked that urls don't change (see @gepbird​s review below)
  • changes do not require release notes
  • Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.

github-actions[bot]

This comment was marked as outdated.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. labels Jan 26, 2026
@quantenzitrone
quantenzitrone force-pushed the fix-pname-misuse branch 3 times, most recently from 27bcbf0 to 5992d9d Compare January 30, 2026 04:40
@github-actions
github-actions Bot dismissed their stale review January 30, 2026 04:45

Review dismissed automatically

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 6.topic: musl Running or building packages with musl libc and removed 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. labels Jan 30, 2026
@quantenzitrone
quantenzitrone marked this pull request as ready for review January 30, 2026 04:58
@gepbird

This comment was marked as resolved.

@gepbird

gepbird commented Feb 1, 2026 •

Copy link
Copy Markdown
Contributor

this shouldn't create any rebuilds

If the URL was rewritten to a different one, it wouldn't create a rebuild because it's a FOD and the hash hasn't changed. We should somehow verify that the URLs haven't changed.

My first concern is how does the script handle cases with multiple pnames? For example given this theoretical package:

{
  stdenv,
  fetchurl,
}:

let
  some-component = stdenv.mkDerivation rec {
    pname = "sub-package";
    version = "1.0.0";

    src = fetchurl {
      url = "https://some-software.com/${pname}/${version}";
      hash = "";
    };
  };
in
stdenv.mkDerivation rec {
  pname = "main-package";
  version = "1.0.0";

  src = fetchurl {
    url = "https://some-software.com/${pname}/${version}";
    hash = "";
  };

  buildInputs = [ some-component ];
}

I'll try to write a script that evaluates the src.url for packages, but I'm not sure how to solve the above problem yet.

(Sorry for "my" last comment, this is the first time I've tried https://github.com/DieracDelta/srcbot in the hope of automatically verifying that sources hasn't changed, but looks like it was designed to get the changed packages from CI/ user input.)

@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 1, 2026

@gepbird gepbird left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I checked the first 25 files manually and verified the rest with the below methods.
I'm confident this is safe to merge :)

Each file has 1 line removal and 1 line addition

This can be seen from the patch header at https://github.com/NixOS/nixpkgs/pull/483962.patch, for example:

pkgs/by-name/ae/aeolus-stops/package.nix               | 2 +-

There are only 3 files with multiple changes, I verified those manually (caused by nixfmt and rec removal):

pkgs/by-name/lu/luculent/package.nix                   | 4 ++--
pkgs/by-name/ma/man-pages-posix/package.nix            | 4 ++--
pkgs/by-name/mp/mp3gain/package.nix                    | 4 +---

Each modified file touches url in src and it's a fetch* call

#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3Packages.unidiff
import re
from unidiff import PatchSet

for diff in PatchSet.from_filename("483962.patch"):
    if not re.compile(r"src = fetch.* {.*-\s*url = .*\+\s*url = .*};", re.DOTALL).search(str(diff)):
        print("no matches in file: " + diff.path)

There are 6 outliers (didn't match src =, or the closing } for the fetch* call was outside of the hunk, manually verified that these are correct):

no matches in file: pkgs/by-name/fr/freetype/package.nix
no matches in file: pkgs/by-name/gd/gdk-pixbuf/package.nix
no matches in file: pkgs/by-name/gr/groove/package.nix
no matches in file: pkgs/by-name/li/libsignon-glib/package.nix
no matches in file: pkgs/by-name/me/mesa_glu/package.nix
no matches in file: pkgs/by-name/wa/warzone2100/package.nix

URL evaluates to the same value as before this PR

# file: eval-urls.nix
let
  pkgs = import ./. {};
  # pnames are obtained from git file paths
  pnames = ["aeolus-stops" "aeolus" "aewan" "aften" "aldo" "altermime" "AMB-plugins" "apache-flex-sdk" "apcupsd" "applgrid" "apr" "aprutil" "argus-clients" "argus" "arphic-ukai" "arphic-uming" "artisan" "astyle" "atanks" "atftp" "auctex" "autobuild" "autocutsel" "autossh" "autotalent" "avfs" "awstats" "babeld" "bacula" "barcode" "bb" "bftpd" "bison" "black-hole-solver" "bleachbit" "bliss" "blobwars" "blueman" "boolstuff" "brasero-unwrapped" "bristol" "bsdbuild" "bsdiff" "btrbk" "buddy" "buildtorrent" "bvi" "bwm_ng" "cachefilesd" "calcurse" "cantarell-fonts" "catdoc" "catdvi" "cbftp" "cddiscid" "cdi2iso" "cdpr" "cgui" "chemtool" "chromium-bsu" "chrony" "cifs-utils" "clamav" "cln" "clustal-omega" "clutter-gst" "cntlm" "coan" "cogl" "colm" "commonsCompress" "commonsFileUpload" "commonsIo" "complexity" "conntrack-tools" "construo" "corosync" "courier-prime" "cppcms" "cppdb" "cppreference-doc" "cppunit" "cpputest" "cpuid" "cramfsswap" "crip" "crrcsim" "crunch" "csa" "cscope" "csv2odf" "culmus" "cutee" "cvs2svn" "cytoscape" "czmq" "d2coding" "dadadodo" "dante" "dar" "datefudge" "dbxml" "dd_rescue" "ddrutility" "dedup" "dejagnu" "devilspie2" "devtodo" "dfu-util" "dgen-sdl" "di" "dico" "disnixos" "dit" "djmount" "djview" "djvulibre" "dkimproxy" "dnsmasq" "dnstracer" "dos2unix" "dovecot" "dpic" "dspam" "dssi" "dvd-slideshow" "dvdbackup" "dvdplusrwtools" "easytag" "ebtables" "ebumeter" "edgetpu-compiler" "efont-unicode" "eggdbus" "egypt" "elfutils" "eli" "em" "emma" "enca" "enet" "ephemeralpg" "eq10q" "evolution-ews" "exempi" "exim" "exonerate" "exrtools" "ext4magic" "farstream" "fatsort" "fcrackzip" "fcron" "fdk_aac" "fim" "findbugs" "firefly-desktop" "flink" "fllog" "flmsg" "flpsed" "flrig" "fluxbox" "flwrap" "foremost" "forktty" "fox" "fox_1_6" "frame" "freeipmi" "freetds" "freetype" "ftop" "fuse-emulator" "g-wrap" "gama" "garmintools" "gatling" "gcal" "gd" "gdk-pixbuf" "gdl" "gengetopt" "genromfs" "getxbook" "gexiv2" "gl117" "gl2ps" "glade" "glee" "glibmm" "global" "glpk" "gmm" "gmu" "gnaural" "gnome-console" "gnome-doc-utils" "gnome-icon-theme" "gnome-menus" "gnome-multi-writer" "gnome-photos" "gnome-tweaks" "gnome-user-docs" "gnome-video-effects" "gnote" "gnu-pw-mgr" "gnuclad" "gnushogi" "gob2" "gobi_loader" "gofish" "goocanvasmm2" "gource" "gp2c" "gperf" "gptfdisk" "gpu-screen-recorder-gtk" "gpu-screen-recorder" "gputils" "grail" "graphs" "grepcidr" "grilo-plugins" "groff" "groove" "gsettings-desktop-schemas" "gsl" "gsm" "gsound" "gspell" "gtk-engine-murrine" "gtk-sharp-3_0" "gtkdatabox" "gtkimageview" "gtksourceviewmm" "gtksourceviewmm4" "gtkspell2" "gtkspellmm" "gtkwave" "gtranslator" "gts" "guile-cairo" "guile-json" "guile-lib" "guile-opengl" "guile-reader" "gupnp-dlna" "gxemul" "gxmessage" "hamlib_3" "hermit" "hitch" "hivex" "hoppet" "hostapd" "html-xml-utils" "htmlcxx" "htslib" "humanity-icon-theme" "hyena" "iconnamingutils" "id3lib" "id3v2" "ifmetric" "imagination" "indent" "inetutils" "intercal" "intltool" "iptstate" "ipvsadm" "ispell" "ispike" "itstool" "jaaa" "jack_oscrolloscope" "jackmeter" "japa" "jbang" "jconvolver" "jed" "jibri" "jicofo" "jitsi-meet-prosody" "jitsi-videobridge" "joe" "jpeginfo" "json-glib" "jsonrpc-glib" "julia-mono" "kacst" "kanif" "keyutils" "kgraphviewer" "khmeros" "klavaro" "komga" "koules" "kpcli" "kytea" "kythe" "lame" "languagetool" "lao" "lci" "lcms1" "lcms2" "ldns" "libaacs" "libaal" "libabigail" "libabw" "libaio" "libasr" "libass" "libasyncns" "libaudclient" "libavc1394" "libbdplus" "libbluray" "libbs2b" "libbsd" "libcacard" "libcanberra" "libcddb" "libcdr" "libdaemon" "libdazzle" "libdbi" "libdc1394" "libdivecomputer" "libdrm" "libdsk" "libdvbcsa" "libdvbpsi" "libdvdcss" "libelf" "libestr" "libev" "libevdev" "libexecinfo" "libexosip" "libextractor" "libexttextcat" "libffi_3_3" "libfido2" "libfishsound" "libftdi" "libgaminggear" "libgdamm" "libgepub" "libgig" "libgmpris" "libgnomekbd" "libgnt" "libgovirt" "libgpg-error" "libgringotts" "libgweather" "libgxps" "libibmad" "libibumad" "libinfinity" "libinklevel" "libiodbc" "libircclient" "libisds" "liblangtag" "liblo" "liblscp" "libmad" "libmatheval" "libmaxminddb" "libmhash" "libmng" "libmodplug" "libmpeg2" "libmspack" "libnatpmp" "libnatspec" "libnbd" "libnetfilter_acct" "libnetfilter_conntrack" "libnetfilter_cthelper" "libnetfilter_cttimeout" "libnetfilter_log" "libnetfilter_queue" "libnftnl" "libnma" "libnotify" "libnova" "liboauth" "libofa" "liboggz" "libomxil-bellagio" "libosinfo" "libowfat" "libpar2" "libpcap" "libpgf" "libptytty" "libraw1394" "libreswan" "libshout" "libsignon-glib" "libsmi" "libspectre" "libspectrum" "libstatgrab" "libstroke" "libthreadar" "libticables2" "libticalcs2" "libticonv" "libtifiles2" "libu2f-host" "libu2f-server" "libuchardet" "libudfread" "libva-vdpau-driver" "libvdpau" "libvirt-glib" "libvisio" "libvorbis" "libvori" "libvterm" "libwebcam" "libwpg" "libwps" "libx86" "libxmi" "libykneomgr" "libyubikey" "libzmf" "lighttpd" "lilv" "lingot" "link-grammar" "linuxConsoleTools" "liquidwar" "lirc" "lklug-sinhala" "lldpd" "lmodern" "log4cpp" "log4cxx" "logstalgia" "loudmouth" "ltl2ba" "lttng-tools" "lttng-ust_2_12" "lttv" "luculent" "lv2" "lwm" "lxgw-wenkai" "lzip" "lzo" "m17n_db" "macse" "man-pages-posix" "mc" "mda_lv2" "memcached" "menumaker" "mesa-demos" "mesa_glu" "meterbridge" "mi2ly" "mikmod" "mimetic" "miniHttpd" "minidlna" "mm-common" "mno16" "motif" "mousetweaks" "movit" "mp3gain" "mp3val" "mpop" "msilbc" "msr" "mtdev" "mtools" "mtx" "musl" "mylvmbackup" "nanum" "nasm" "nasty" "nedit" "nemiver" "net-snmp" "networkmanager-openconnect" "networkmanager-strongswan" "networkmanager-vpnc" "networkmanagerapplet" "newt" "ngircd" "niftyreg" "nitrogen" "nkf" "nload" "npapi_sdk" "nss_pam_ldapd" "nut" "oath-toolkit" "obitools3" "objconv" "oddjob" "oidentd" "onboard" "openbox" "openfst" "opengrok" "openldap" "openntpd" "openocd" "openpa" "opensmtpd" "opusTools" "osinfo-db" "osmo" "out-of-tree" "p0f" "palp" "pam_mktemp" "pam_u2f" "paperkey" "paxctl" "paxtest" "pbzip2" "pcb" "pcg_c" "pcsc-cyberjack" "pdfchain" "pdfgrep" "peg" "pflogsumm" "pgbouncer" "phrasendrescher" "picosat" "pig" "pinpoint" "pioneers" "pitivi" "pkg-config-unwrapped" "plank" "plib" "plplot" "polytopes_db" "poppler_data" "pptp" "pptpd" "psftools" "pspp" "psutils" "qpid-cpp" "quast" "quilt" "radeontools" "randoop" "randtype" "rapidxml" "rascal" "rcs" "rdfind" "read-edid" "retro-gtk" "rgxg" "rhythmbox" "riemann" "rinutils" "ripmime" "rman" "roccat-tools" "rosegarden" "rpm2targz" "rscw" "rt-tests" "rush" "safefile" "sagittarius-scheme" "samtools" "sbc" "scanbd" "schroedinger" "scrypt" "sdparm" "seccure" "semodule-utils" "seq24" "seren" "serf" "setserial" "shhopt" "siege" "sipcalc" "smbnetfs" "socat" "sound-juicer" "sound-theme-freedesktop" "source-han-code-jp" "sourceHighlight" "spectmorph" "spf-engine" "spice-gtk" "spice-protocol" "spice-vdagent" "spice" "splat" "sqsh" "srecord" "sselp" "sshguard" "sshoogr" "sslmate" "stacks" "stm32flash" "strace" "streamripper" "stricat" "stun" "suricata" "survex" "svrcore" "swaks" "sylpheed" "synapse" "tachyon" "takao" "talkfilters" "talloc" "tanidvr" "tasksh" "tboot" "tdb" "ted" "telepathy-farstream" "telepathy-glib" "telepathy-idle" "telepathy-mission-control" "tessera" "tetraproc" "tevent" "thttpd" "tibetan-machine" "tidyp" "tie" "tilem" "timeline" "tipa" "tiptop" "tokyocabinet" "totem-pl-parser" "tpm-quote-tools" "tpm2-tools" "tqsl" "traceroute" "treemix" "trigger" "trousers" "trx" "tsocks" "ttf_bitstream_vera" "tudu" "tusk" "tvbrowser" "tweak" "ucommon" "udns" "uget" "unifont_upper" "unpaper" "unrtf" "unscii" "untex" "uw-ttyp0" "vassal" "vbindiff" "vcdimager" "vdmfec" "vdpauinfo" "vdrsymbols" "verifast" "virt-what" "vkdt" "vkeybd" "vlan" "vmpk" "vo-aacenc" "vocproc" "vrb" "wakelan" "warzone2100" "wbox" "wcalc" "wcslib" "wdiff" "weather" "weka" "wiki-js" "wily" "wimlib" "wipe" "wireless-regdb" "wmctrl" "wol" "worldpainter" "wqy_microhei" "wqy_zenhei" "x42-plugins" "xbill" "xcbutilxrm" "xearth" "xercesc" "xfsdump" "xfsprogs" "xlog" "xmacro" "xmedcon" "xmlindent" "xmlrpc_c" "xoscope" "xosd" "xplanet" "xsokoban" "xtruss" "xwayland" "xylib" "xzoom" "yasr" "yate" "yelp-tools" "ytalk" "zerofree" "zita-alsa-pcmi" "zita-at1" "zita-njbridge" "zs-wait4host" "zssh"];
in
  pkgs.lib.concatMapStringsSep "\n" (pname: pkgs.${pname}.src.url) pnames
git checkout 4254839dacf917d37c79e62cbf75b1eceed0d7a0~1
nix-instantiate --raw --eval eval-urls.nix > before
git checkout 4254839dacf917d37c79e62cbf75b1eceed0d7a0
nix-instantiate --raw --eval eval-urls.nix > after
diff before after # no output, all went good!

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Feb 1, 2026
@quantenzitrone

Copy link
Copy Markdown
Contributor Author

If the URL was rewritten to a different one, it wouldn't create a rebuild because it's a FOD and the hash hasn't changed. We should somehow verify that the URLs haven't changed.

true, sorry i feel dumb now

thanks for checking that the urls didn't change

@quantenzitrone

Copy link
Copy Markdown
Contributor Author

resolved merge conflicts by removing changes in conflicting files

@nixpkgs-ci nixpkgs-ci Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 1, 2026
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 3, 2026
@nixpkgs-ci nixpkgs-ci Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Feb 5, 2026

@gepbird gepbird left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still looks good, I ran the above checks again.

@gepbird
gepbird added this pull request to the merge queue Feb 5, 2026
Merged via the queue into NixOS:master with commit 1b9d1ca Feb 5, 2026
25 of 28 checks passed
@quantenzitrone
quantenzitrone deleted the fix-pname-misuse branch February 5, 2026 10:32
@K900

K900 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Look people, if you're going to keep sending random treewides that don't practically improve things, AT LEAST send them to staging so I don't have to keep fixing your merge conflicts every 6 hours.

@quantenzitrone

quantenzitrone commented Feb 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Wouldn't it create even more merge conflicts this way?

@Hythera Hythera mentioned this pull request May 11, 2026
3 of 13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: musl Running or building packages with musl libc 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants