Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use appendToName in all-packages.nix #68519

Closed
jtojnar opened this issue Sep 11, 2019 · 7 comments · Fixed by #167545
Closed

Do not use appendToName in all-packages.nix #68519

jtojnar opened this issue Sep 11, 2019 · 7 comments · Fixed by #167545

Comments

@jtojnar
Copy link
Member

jtojnar commented Sep 11, 2019

As noticed in repology/repology-updater#854 (comment), some packages use appendToName in all-packages.nix to distinguish variants by nix-env.

asciidoc-full-with-plugins = appendToName "full-with-plugins" (asciidoc.override {

We should move that name modification to the package expression itself so that the package name is always the same when doing .override { enableStandardFeatures = true; }.

cc @volth

@FRidh
Copy link
Member

FRidh commented Sep 11, 2019

  /* Like `setName', but takes the previous name as an argument.

     Example:
       updateName (oldName: oldName + "-experimental") somePkg
  */
  updateName = updater: drv: drv // {name = updater (drv.name);};


  /* Append a suffix to the name of a package (before the version
     part). */
  appendToName = suffix: updateName (name:
    let x = builtins.parseDrvName name; in "${x.name}-${suffix}-${x.version}");

If you want to ensure it is kept it needs to be part of the derivation, which means it triggers a rebuild (which I think is typically fine for the use case).

@FRidh
Copy link
Member

FRidh commented Sep 11, 2019

The vast majority that I quickly checked should simply use overrideAttrs or, in line with my previous comment, we should use overrideAttrs in updateName.

@stale

This comment was marked as off-topic.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
@jtojnar

This comment was marked as off-topic.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
@stale

This comment was marked as off-topic.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 29, 2020
@davidak
Copy link
Member

davidak commented Jan 21, 2021

This can still be seen in some places:

[davidak@gaming:~/code/nixpkgs]$ grep -R appendToName .
./pkgs/build-support/emacs/wrapper.nix:  (appendToName "with-packages" emacs).name
./pkgs/development/libraries/nuspell/wrapper.nix:  name = (appendToName "with-dicts" nuspell).name;
./pkgs/development/libraries/hunspell/wrapper.nix:  name = (appendToName "with-dicts" hunspell).name;
./pkgs/development/idris-modules/with-packages.nix:lib.appendToName "with-packages" (symlinkJoin {
./pkgs/misc/lilypond/with-fonts.nix:lib.appendToName "with-fonts" (symlinkJoin {
./pkgs/applications/networking/cluster/terraform/default.nix:          lib.appendToName "with-plugins" (stdenv.mkDerivation {
./pkgs/applications/editors/eclipse/default.nix:      name = (lib.meta.appendToName "with-plugins" eclipse).name;
./pkgs/applications/radio/gnuradio/wrapper.nix:  name = (lib.appendToName "wrapped" unwrapped).name;
./pkgs/top-level/all-packages.nix:  inherit (lib) lowPrio hiPrio appendToName makeOverridable;
./pkgs/top-level/all-packages.nix:  amuleDaemon = appendToName "daemon" (amule.override {
./pkgs/top-level/all-packages.nix:  amuleGui = appendToName "gui" (amule.override {
./pkgs/top-level/all-packages.nix:  asciidoc-full = appendToName "full" (asciidoc.override {
./pkgs/top-level/all-packages.nix:  asciidoc-full-with-plugins = appendToName "full-with-plugins" (asciidoc.override {
./pkgs/top-level/all-packages.nix:  gawkInteractive = appendToName "interactive"
./pkgs/top-level/all-packages.nix:  hdf5-mpi = appendToName "mpi" (hdf5.override {
./pkgs/top-level/all-packages.nix:  hdf5-cpp = appendToName "cpp" (hdf5.override {
./pkgs/top-level/all-packages.nix:  hdf5-fortran = appendToName "fortran" (hdf5.override {
./pkgs/top-level/all-packages.nix:  hdf5-threadsafe = appendToName "threadsafe" (hdf5.overrideAttrs (oldAttrs: {
./pkgs/top-level/all-packages.nix:  netcdf-mpi = appendToName "mpi" (netcdf.override {
./pkgs/top-level/all-packages.nix:  openssh_hpn = pkgs.appendToName "with-hpn" (openssh.override {
./pkgs/top-level/all-packages.nix:  openssh_gssapi = pkgs.appendToName "with-gssapi" (openssh.override {
./pkgs/top-level/all-packages.nix:    (if pluginSupport then appendToName "with-plugin" else x: x)
./pkgs/top-level/all-packages.nix:  texinfoInteractive = appendToName "interactive" (
./pkgs/top-level/all-packages.nix:  gmpxx = appendToName "with-cxx" (gmp.override { cxx = true; });
./pkgs/top-level/all-packages.nix:  highfive-mpi = appendToName "mpi" (highfive.override {
./pkgs/top-level/all-packages.nix:  qt48Full = appendToName "full" (qt48.override {
./pkgs/top-level/all-packages.nix:  sqlite-interactive = appendToName "interactive" (sqlite.override { interactive = true; }).bin;
./pkgs/top-level/all-packages.nix:  util-linuxMinimal = if stdenv.isLinux then appendToName "minimal" (util-linux.override {
./pkgs/top-level/all-packages.nix:  emacs27-nox = lowPrio (appendToName "nox" (emacs27.override {
./pkgs/top-level/all-packages.nix:  emacs26-nox = lowPrio (appendToName "nox" (emacs26.override {
./pkgs/top-level/all-packages.nix:  gitSVN = lowPrio (appendToName "with-svn" (git.override {
./pkgs/top-level/all-packages.nix:  gitMinimal = appendToName "minimal" (git.override {
./pkgs/top-level/all-packages.nix:  mercurialFull = appendToName "full" (pkgs.mercurial.override { guiSupport = true; });
./pkgs/top-level/all-packages.nix:  subversionClient = appendToName "client" (pkgs.subversion.override {
./pkgs/top-level/all-packages.nix:  neuron-mpi = appendToName "mpi" (neuron.override {
./pkgs/top-level/all-packages.nix:  raxml-mpi = appendToName "mpi" (raxml.override {
./pkgs/top-level/all-packages.nix:  dblatexFull = appendToName "full" (dblatex.override {
./pkgs/top-level/all-packages.nix:  ghostscriptX = appendToName "with-X" (ghostscript.override {
./pkgs/top-level/python-packages.nix:  binwalk-full = appendToName "full" (self.binwalk.override {

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 21, 2021
@stale

This comment was marked as off-topic.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 20, 2021
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants