mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 15:22:59 +01:00
Merge pull request #229639 from lilyinstarlight/feature/node-aliases
nodePackages: add aliases
This commit is contained in:
commit
4563892ca7
5 changed files with 47 additions and 6 deletions
|
@ -100,11 +100,12 @@ def convert_to_throw(date_older_list: list[str]) -> list[tuple[str, str]]:
|
||||||
date_older_list.remove(line)
|
date_older_list.remove(line)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
alias = before_equal.strip()
|
alias = before_equal
|
||||||
|
alias_unquoted = before_equal.strip('"')
|
||||||
after_equal_list = [x.strip(";:") for x in after_equal.split()]
|
after_equal_list = [x.strip(";:") for x in after_equal.split()]
|
||||||
|
|
||||||
converted = (
|
converted = (
|
||||||
f"{indent}{alias} = throw \"'{alias}' has been renamed to/replaced by"
|
f"{indent}{alias} = throw \"'{alias_unquoted}' has been renamed to/replaced by"
|
||||||
f" '{after_equal_list.pop(0)}'\";"
|
f" '{after_equal_list.pop(0)}'\";"
|
||||||
f' # Converted to throw {datetime.today().strftime("%Y-%m-%d")}'
|
f' # Converted to throw {datetime.today().strftime("%Y-%m-%d")}'
|
||||||
)
|
)
|
||||||
|
|
38
pkgs/development/node-packages/aliases.nix
Normal file
38
pkgs/development/node-packages/aliases.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
pkgs: lib: self: super:
|
||||||
|
|
||||||
|
### Deprecated aliases - for backward compatibility
|
||||||
|
|
||||||
|
with self;
|
||||||
|
|
||||||
|
let
|
||||||
|
# Removing recurseForDerivation prevents derivations of aliased attribute
|
||||||
|
# set to appear while listing all the packages available.
|
||||||
|
removeRecurseForDerivations = alias: with lib;
|
||||||
|
if alias.recurseForDerivations or false
|
||||||
|
then removeAttrs alias ["recurseForDerivations"]
|
||||||
|
else alias;
|
||||||
|
|
||||||
|
# Disabling distribution prevents top-level aliases for non-recursed package
|
||||||
|
# sets from building on Hydra.
|
||||||
|
removeDistribute = alias: with lib;
|
||||||
|
if isDerivation alias then
|
||||||
|
dontDistribute alias
|
||||||
|
else alias;
|
||||||
|
|
||||||
|
# Make sure that we are not shadowing something from node-packages.nix.
|
||||||
|
checkInPkgs = n: alias:
|
||||||
|
if builtins.hasAttr n super
|
||||||
|
then throw "Alias ${n} is still in node-packages.nix"
|
||||||
|
else alias;
|
||||||
|
|
||||||
|
mapAliases = aliases:
|
||||||
|
lib.mapAttrs (n: alias:
|
||||||
|
removeDistribute
|
||||||
|
(removeRecurseForDerivations
|
||||||
|
(checkInPkgs n alias)))
|
||||||
|
aliases;
|
||||||
|
in
|
||||||
|
|
||||||
|
mapAliases ({
|
||||||
|
"@githubnext/github-copilot-cli" = pkgs.github-copilot-cli; # Added 2023-05-02
|
||||||
|
})
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, lib, nodejs, stdenv}:
|
{ config, pkgs, lib, nodejs, stdenv }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) composeManyExtensions extends makeExtensible mapAttrs;
|
inherit (lib) composeManyExtensions extends makeExtensible mapAttrs;
|
||||||
|
@ -15,7 +15,12 @@ let
|
||||||
})
|
})
|
||||||
) (import ./main-programs.nix);
|
) (import ./main-programs.nix);
|
||||||
|
|
||||||
|
aliases = final: prev:
|
||||||
|
lib.optionalAttrs config.allowAliases
|
||||||
|
(import ./aliases.nix pkgs lib final prev);
|
||||||
|
|
||||||
extensions = composeManyExtensions [
|
extensions = composeManyExtensions [
|
||||||
|
aliases
|
||||||
mainProgramOverrides
|
mainProgramOverrides
|
||||||
(import ./overrides.nix { inherit pkgs nodejs; })
|
(import ./overrides.nix { inherit pkgs nodejs; })
|
||||||
];
|
];
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
"@commitlint/cli" = "commitlint";
|
"@commitlint/cli" = "commitlint";
|
||||||
"@forge/cli" = "forge";
|
"@forge/cli" = "forge";
|
||||||
"@gitbeaker/cli" = "gitbeaker";
|
"@gitbeaker/cli" = "gitbeaker";
|
||||||
"@githubnext/github-copilot-cli" = "github-copilot-cli";
|
|
||||||
"@google/clasp" = "clasp";
|
"@google/clasp" = "clasp";
|
||||||
"@medable/mdctl-cli" = "mdctl";
|
"@medable/mdctl-cli" = "mdctl";
|
||||||
"@mermaid-js/mermaid-cli" = "mmdc";
|
"@mermaid-js/mermaid-cli" = "mmdc";
|
||||||
|
|
|
@ -39,8 +39,6 @@ final: prev: {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
"@githubnext/github-copilot-cli" = pkgs.github-copilot-cli;
|
|
||||||
|
|
||||||
"@medable/mdctl-cli" = prev."@medable/mdctl-cli".override (oldAttrs: {
|
"@medable/mdctl-cli" = prev."@medable/mdctl-cli".override (oldAttrs: {
|
||||||
nativeBuildInputs = with pkgs; with darwin.apple_sdk.frameworks; [
|
nativeBuildInputs = with pkgs; with darwin.apple_sdk.frameworks; [
|
||||||
glib
|
glib
|
||||||
|
|
Loading…
Reference in a new issue