Skip to content

Commit

Permalink
Merge pull request #299360 from reckenrode/darwin-aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
reckenrode authored Mar 27, 2024
2 parents 0ca930a + 8018673 commit 2944f24
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
53 changes: 53 additions & 0 deletions pkgs/top-level/darwin-aliases.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
lib: self: super: pkgs:

### Deprecated aliases - for backward compatibility

### Please maintain this list in ASCIIbetical ordering.
### Hint: the "sections" are delimited by ### <letter> ###

# These aliases should not be used within nixpkgs, but exist to improve
# backward compatibility in projects outside of nixpkgs. See the
# documentation for the `allowAliases` option for more background.

# A script to convert old aliases to throws and remove old
# throws can be found in './maintainers/scripts/remove-old-aliases.py'.

# Add 'preserve, reason: reason why' after the date if the alias should not be removed.
# Try to keep them to a minimum.
# valid examples of what to preserve:
# distro aliases such as:
# debian-package-name -> nixos-package-name

# pkgs is provided to allow packages to be moved out of the darwin attrset.

with self;

let
# Removing recurseForDerivation prevents derivations of aliased attribute set
# to appear while listing all the packages available.
removeRecurseForDerivations =
alias:
if alias.recurseForDerivations or false then
lib.removeAttrs alias [ "recurseForDerivations" ]
else
alias;

# Disabling distribution prevents top-level aliases for non-recursed package
# sets from building on Hydra.
removeDistribute = alias: if lib.isDerivation alias then lib.dontDistribute alias else alias;

# Make sure that we are not shadowing something from darwin-packages.nix.
checkInPkgs =
n: alias:
if builtins.hasAttr n super then throw "Alias ${n} is still in darwin-packages.nix" else alias;

mapAliases = lib.mapAttrs (
n: alias: removeDistribute (removeRecurseForDerivations (checkInPkgs n alias))
);
in

mapAliases ({
### B ###

builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06
})
6 changes: 3 additions & 3 deletions pkgs/top-level/darwin-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ let
fetchurlBoot = import ../build-support/fetchurl/boot.nix {
inherit (stdenv) system;
};

aliases = self: super: lib.optionalAttrs config.allowAliases (import ../top-level/darwin-aliases.nix lib self super pkgs);
in

makeScopeWithSplicing' {
otherSplices = generateSplicesForMkScope "darwin";
extra = spliced: spliced.apple_sdk.frameworks;
f = (self: let
f = lib.extends aliases (self: let
inherit (self) mkDerivation callPackage;

# Must use pkgs.callPackage to avoid infinite recursion.
Expand Down Expand Up @@ -258,7 +260,5 @@ impure-cmds // appleSourcePackages // chooseLibs // {
modules = [ { nixpkgs.hostPlatform = "x86_64-linux"; } ];
};

} // lib.optionalAttrs config.allowAliases {
builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06
});
}

0 comments on commit 2944f24

Please sign in to comment.