From 1c87deda6286628e3cb2585a2cc717b2874e8e6d Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 2 Jun 2024 16:01:22 +0200 Subject: [PATCH] release: disallow aliases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having multiple attributes point to the same derivation makes debugging harder because you often cannot just grep the canonical attribute name. It is even annoying when multiple aliases are chained. Having Hydra build aliases is recognized as redundant https://github.com/NixOS/nixpkgs/commit/2d0a7c4eeecd22f26eb37f6077a0397c32250375 so let’s do the same with their evaluation. This commit will make Hydra ignore aliases when evaluating. A nice benefit of this is that it will allow us to warn users when an attribute is renamed, to assist them with early migration. Since tracing messages during evaluation are not allowed because of Hydra, we can currently only choose between having a silent alias and throwing. This was last attempted in 2018 but ended up being reverted because of widespread use of aliases that was not caught by CI: https://github.com/NixOS/nixpkgs/commit/8c025c67d5a151055ef63d2b0d94921604ff0f62 CI has since been improved: https://github.com/NixOS/ofborg/commit/cda5aa2ac77a70bb5660d8d5614a640aacbe7523 --- pkgs/top-level/release-cross.nix | 8 +++++++- pkgs/top-level/release-cuda.nix | 8 +++++++- pkgs/top-level/release-lib.nix | 8 +++++++- pkgs/top-level/release-python.nix | 1 + pkgs/top-level/release-small.nix | 8 +++++++- pkgs/top-level/release.nix | 1 + 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index d6896155c920..14188429e850 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -17,7 +17,13 @@ , # Strip most of attributes when evaluating to spare memory usage scrubJobs ? true , # Attributes passed to nixpkgs. Don't build packages marked as unfree. - nixpkgsArgs ? { config = { allowUnfree = false; inHydra = true; }; } + nixpkgsArgs ? { + config = { + allowAliases = false; + allowUnfree = false; + inHydra = true; + }; + } }: let diff --git a/pkgs/top-level/release-cuda.nix b/pkgs/top-level/release-cuda.nix index f9577b9b72c7..e9a014f08b39 100644 --- a/pkgs/top-level/release-cuda.nix +++ b/pkgs/top-level/release-cuda.nix @@ -15,7 +15,13 @@ "x86_64-linux" ] , # Attributes passed to nixpkgs. - nixpkgsArgs ? { config = { allowUnfree = true; inHydra = true; }; } + nixpkgsArgs ? { + config = { + allowAliases = false; + allowUnfree = true; + inHydra = true; + }; + } }: let diff --git a/pkgs/top-level/release-lib.nix b/pkgs/top-level/release-lib.nix index 9f2886895689..fb70fe7788a5 100644 --- a/pkgs/top-level/release-lib.nix +++ b/pkgs/top-level/release-lib.nix @@ -2,7 +2,13 @@ , packageSet ? (import ../..) , scrubJobs ? true , # Attributes passed to nixpkgs. Don't build packages marked as unfree. - nixpkgsArgs ? { config = { allowUnfree = false; inHydra = true; }; } + nixpkgsArgs ? { + config = { + allowAliases = false; + allowUnfree = false; + inHydra = true; + }; + } }: let diff --git a/pkgs/top-level/release-python.nix b/pkgs/top-level/release-python.nix index 81ea4d3403a7..38f30693fe49 100644 --- a/pkgs/top-level/release-python.nix +++ b/pkgs/top-level/release-python.nix @@ -10,6 +10,7 @@ ] , # Attributes passed to nixpkgs. Don't build packages marked as unfree. nixpkgsArgs ? { config = { + allowAliases = false; allowUnfree = false; inHydra = true; permittedInsecurePackages = [ diff --git a/pkgs/top-level/release-small.nix b/pkgs/top-level/release-small.nix index 0212464acb62..f414c4441fb1 100644 --- a/pkgs/top-level/release-small.nix +++ b/pkgs/top-level/release-small.nix @@ -4,7 +4,13 @@ { nixpkgs ? { outPath = (import ../../lib).cleanSource ../..; revCount = 1234; shortRev = "abcdef"; } , supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] , # Attributes passed to nixpkgs. Don't build packages marked as unfree. - nixpkgsArgs ? { config = { allowUnfree = false; inHydra = true; }; } + nixpkgsArgs ? { + config = { + allowAliases = false; + allowUnfree = false; + inHydra = true; + }; + } }: let diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index d11d1d1dbd43..5aa058c8d1f3 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -26,6 +26,7 @@ , scrubJobs ? true # Attributes passed to nixpkgs. Don't build packages marked as unfree. , nixpkgsArgs ? { config = { + allowAliases = false; allowUnfree = false; inHydra = true; permittedInsecurePackages = [