Skip to content

pkgs/stdenv/make-derivation: move hostSuffix before the version#120762

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
sternenseemann:mkderivation-host-suffix-middle
Apr 26, 2021
Merged

pkgs/stdenv/make-derivation: move hostSuffix before the version#120762
Ericson2314 merged 1 commit intoNixOS:masterfrom
sternenseemann:mkderivation-host-suffix-middle

Conversation

@sternenseemann
Copy link
Copy Markdown
Member

Adding the hostSuffix to the end of the derivation's name is problematic
since some stuff, including user facing programs like nix-env rely on
the behavior of parseDrvName instead of pname and version.
builtins.parseDrvName currently thinks that the cross compilation target
added via hostSuffix is part of the version. This has the practical
consequence for example that nix-env would think a cross compiled
derivation would be an updated version of a native derivation of the
same package and version — breaking user's profiles.

We can easily prevent this by moving the hostSuffix in between pname and
version. In case name is passed to mkDerivation this is of course not
possible and we are forced to fall back to the old behavior.

This change could serve as a replacement for the migitation we
introduced with the -static appendix to pname in order to avoid
confusion between nix and nixStatic as outlined in the comment added
with this commit.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Apr 26, 2021
@sternenseemann sternenseemann force-pushed the mkderivation-host-suffix-middle branch from b321678 to 278c298 Compare April 26, 2021 17:13
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Apr 26, 2021
Copy link
Copy Markdown
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

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

Overall this is a very good idea. Thanks for doing!

@sternenseemann sternenseemann force-pushed the mkderivation-host-suffix-middle branch from 278c298 to 707541a Compare April 26, 2021 18:40
Adding the hostSuffix to the end of the derivation's name is problematic
since some stuff, including user facing programs like nix-env rely on
the behavior of parseDrvName instead of pname and version.
builtins.parseDrvName currently thinks that the cross compilation target
added via hostSuffix is part of the version. This has the practical
consequence for example that nix-env would think a cross compiled
derivation would be an updated version of a native derivation of the
same package and version — breaking user's profiles.

We can easily prevent this by moving the hostSuffix in between pname and
version. In case name is passed to mkDerivation this is of course not
possible and we are forced to fall back to the old behavior.

This change could serve as a replacement for the migitation we
introduced with the -static appendix to pname in order to avoid
confusion between nix and nixStatic as outlined in the comment added
with this commit.
@sternenseemann sternenseemann force-pushed the mkderivation-host-suffix-middle branch from 707541a to b0c26d2 Compare April 26, 2021 18:40
@r-rmcgibbo
Copy link
Copy Markdown

r-rmcgibbo commented Apr 26, 2021

Result of nixpkgs-review pr 120762 at 278c298a run on aarch64-linux 1

2 packages marked as broken and skipped:
  • nix-exec
  • nixui
6 packages failed to build:
13 packages skipped due to time constraints:
  • crate2nix
  • haskellPackages.hercules-ci-agent
  • hercules-ci-agent
  • hydra-unstable
  • nix-index
  • nixStatic
  • simavr
  • tinygo
  • ubootNanoPCT4
  • ubootPine64
  • ...
59 packages built successfully:
  • armTrustedFirmwareAllwinner
  • armTrustedFirmwareQemu
  • armTrustedFirmwareRK3328
  • armTrustedFirmwareRK3399
  • armTrustedFirmwareS905
  • bundix
  • busybox-sandbox-shell
  • cabal2nix
  • cachix
  • dep2nix
  • disnix
  • disnixos
  • fusionInventory
  • gnuk
  • go2nix
  • haskellPackages.cachix
  • haskellPackages.hercules-ci-cnix-expr
  • haskellPackages.hercules-ci-cnix-store
  • haskellPackages.nix-paths
  • haskellPackages.update-nix-fetchgit
  • nix (nixStable)
  • nix-bundle
  • nix-direnv
  • nix-doc
  • nix-du
  • nix-pin
  • nix-plugins
  • nix-prefetch-bzr
  • nix-prefetch-cvs
  • nix-prefetch-docker
  • nix-prefetch-git
  • nix-prefetch-hg
  • nix-prefetch-scripts
  • nix-prefetch-svn
  • nix-serve
  • nix-update
  • nix-update-source
  • nixFlakes (nixUnstable)
  • nixos-generators
  • nixos-shell
  • nixpkgs-review
  • pkgsStatic.stdenv
  • python38Packages.nix-kernel
  • python38Packages.nixpkgs
  • python38Packages.pythonix
  • python39Packages.nix-kernel
  • python39Packages.nixpkgs
  • python39Packages.pythonix
  • ubootBananaPim64
  • ubootOdroidC2
  • ubootOrangePiZeroPlus2H5
  • ubootPine64LTS
  • ubootPinebookPro
  • ubootROCPCRK3399
  • ubootRockPi4
  • ubootSopine
  • update-nix-fetchgit
  • vgo2nix
  • vulnix

Note that build failures may predate this PR, and could be nondeterministic or hardware dependent.
Please exercise your independent judgement.


Result of nixpkgs-review pr 120762 at 278c298a run on x86_64-linux 1

3 packages marked as broken and skipped:
  • betaflight
  • inav
  • nix-exec
6 packages failed to build:
18 packages skipped due to time constraints:
  • lutris
  • lutris-free
  • lutris-unwrapped
  • nixStatic
  • pipelight
  • playonlinux
  • simavr
  • tinygo
  • wine (winePackages.full)
  • wine-staging
  • ...
61 packages built successfully:
  • armTrustedFirmwareTools
  • axoloti
  • bundix
  • busybox-sandbox-shell
  • cabal2nix
  • cachix
  • common-updater-scripts
  • crate2nix
  • crystal2nix
  • dep2nix
  • disnix
  • disnixos
  • fusee-launcher
  • fusionInventory
  • gnuk
  • go2nix
  • haskellPackages.cachix
  • haskellPackages.hercules-ci-agent
  • haskellPackages.hercules-ci-cnix-expr
  • haskellPackages.hercules-ci-cnix-store
  • haskellPackages.nix-paths
  • haskellPackages.update-nix-fetchgit
  • hercules-ci-agent
  • hydra-unstable
  • lispPackages.quicklisp-to-nix
  • lispPackages.quicklisp-to-nix-system-info
  • nix (nixStable)
  • nix-bundle
  • nix-direnv
  • nix-doc
  • nix-du
  • nix-index
  • nix-pin
  • nix-plugins
  • nix-prefetch
  • nix-prefetch-bzr
  • nix-prefetch-cvs
  • nix-prefetch-docker
  • nix-prefetch-git
  • nix-prefetch-hg
  • nix-prefetch-scripts
  • nix-prefetch-svn
  • nix-serve
  • nix-update
  • nix-update-source
  • nixFlakes (nixUnstable)
  • nixos-generators
  • nixos-rebuild
  • nixos-shell
  • nixpkgs-review
  • nixui
  • pkgsStatic.stdenv
  • python38Packages.nix-kernel
  • python38Packages.nixpkgs
  • python38Packages.pythonix
  • python39Packages.nix-kernel
  • python39Packages.nixpkgs
  • python39Packages.pythonix
  • update-nix-fetchgit
  • vgo2nix
  • vulnix

Note that build failures may predate this PR, and could be nondeterministic or hardware dependent.
Please exercise your independent judgement.

@Ericson2314 Ericson2314 merged commit 8e4fe32 into NixOS:master Apr 26, 2021
@sternenseemann sternenseemann deleted the mkderivation-host-suffix-middle branch April 26, 2021 19:14
@sternenseemann sternenseemann restored the mkderivation-host-suffix-middle branch July 24, 2021 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: stdenv Standard environment 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants