Update firebase-tools.nix
This commit is contained in:
@@ -2,16 +2,18 @@
|
|||||||
# This file exports a single overlay function that forces `firebase-tools`
|
# This file exports a single overlay function that forces `firebase-tools`
|
||||||
# to use `nodejs_22` when available, falling back to `nodejs` otherwise.
|
# to use `nodejs_22` when available, falling back to `nodejs` otherwise.
|
||||||
#
|
#
|
||||||
# It's intended to be imported directly in a host's `nixpkgs.overlays`,
|
# firebase-tools uses buildNpmPackage which accepts nodejs as a parameter.
|
||||||
# e.g. in `hosts/server/configuration.nix`.
|
# We override buildNpmPackage to use the desired nodejs version.
|
||||||
final: prev:
|
final: prev:
|
||||||
let
|
let
|
||||||
# Prefer nodejs_22 if present in the previous package set; otherwise use nodejs.
|
# Prefer nodejs_22 if present in the previous package set; otherwise use nodejs.
|
||||||
nodejsChoice = if builtins.hasAttr "nodejs_22" prev then prev.nodejs_22 else prev.nodejs;
|
nodejsChoice = if builtins.hasAttr "nodejs_22" prev then prev.nodejs_22 else prev.nodejs;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Override firebase-tools to use the chosen Node.js package.
|
# Override firebase-tools by providing a custom buildNpmPackage with our nodejs choice
|
||||||
firebase-tools = prev.firebase-tools.override {
|
firebase-tools = prev.firebase-tools.override {
|
||||||
|
buildNpmPackage = prev.buildNpmPackage.override {
|
||||||
nodejs = nodejsChoice;
|
nodejs = nodejsChoice;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user