idk
This commit is contained in:
@@ -94,14 +94,14 @@ let
|
||||
# Decide fetcher for URL type based on optional extra.unpack hint.
|
||||
useFetchZip = comp: comp ? extra && comp.extra ? unpack && comp.extra.unpack == "zip";
|
||||
|
||||
# Build a single src from a rendered component spec.
|
||||
mkSrcFromRendered =
|
||||
comp:
|
||||
# Build a single src from a rendered component spec, using the given pkgs for fetchers.
|
||||
mkSrcFromRendered' =
|
||||
pkgs': comp:
|
||||
let
|
||||
fetcher = if comp ? fetcher then comp.fetcher else "none";
|
||||
in
|
||||
if fetcher == "github" then
|
||||
pkgs.fetchFromGitHub (
|
||||
pkgs'.fetchFromGitHub (
|
||||
{
|
||||
owner = comp.owner;
|
||||
repo = comp.repo;
|
||||
@@ -113,7 +113,7 @@ let
|
||||
// lib.optionalAttrs (comp ? name) { name = comp.name; }
|
||||
)
|
||||
else if fetcher == "git" then
|
||||
pkgs.fetchgit {
|
||||
pkgs'.fetchgit {
|
||||
url = comp.url;
|
||||
rev = comp.rev;
|
||||
fetchSubmodules = if comp ? submodules then comp.submodules else false;
|
||||
@@ -124,7 +124,7 @@ let
|
||||
url = if comp ? url then comp.url else comp.urlTemplate;
|
||||
in
|
||||
if useFetchZip comp then
|
||||
pkgs.fetchzip (
|
||||
pkgs'.fetchzip (
|
||||
{
|
||||
inherit url;
|
||||
hash = comp.hash;
|
||||
@@ -132,12 +132,12 @@ let
|
||||
// lib.optionalAttrs (comp ? extra && comp.extra ? stripRoot) { stripRoot = comp.extra.stripRoot; }
|
||||
)
|
||||
else
|
||||
pkgs.fetchurl {
|
||||
pkgs'.fetchurl {
|
||||
inherit url;
|
||||
hash = comp.hash;
|
||||
}
|
||||
else if fetcher == "pypi" then
|
||||
pkgs.python3Packages.fetchPypi {
|
||||
pkgs'.python3Packages.fetchPypi {
|
||||
pname = comp.name;
|
||||
version = comp.version;
|
||||
hash = comp.hash;
|
||||
@@ -146,6 +146,10 @@ let
|
||||
# fetcher == "none": pass-through (e.g., linux version/hash consumed by custom logic)
|
||||
comp;
|
||||
|
||||
# Build a single src from a rendered component spec using the default (lib-level) pkgs.
|
||||
# Deprecated: prefer mkSrcFromRendered' with an explicit pkgs argument.
|
||||
mkSrcFromRendered = mkSrcFromRendered' pkgs;
|
||||
|
||||
in
|
||||
rec {
|
||||
/*
|
||||
@@ -181,30 +185,33 @@ rec {
|
||||
/*
|
||||
Render a component with variables and then build its src (or pass-through for fetcher "none").
|
||||
Prefer using mkAllSources, which handles rendering for all components.
|
||||
|
||||
pkgs: the nixpkgs instance to use for fetchers (must match the target system).
|
||||
*/
|
||||
mkSrc =
|
||||
comp: variables:
|
||||
pkgs': comp: variables:
|
||||
let
|
||||
rendered = renderValue comp variables;
|
||||
in
|
||||
mkSrcFromRendered rendered;
|
||||
mkSrcFromRendered' pkgs' rendered;
|
||||
|
||||
/*
|
||||
Produce an attrset of all sources for a selected spec:
|
||||
mkAllSources selected
|
||||
mkAllSources pkgs selected
|
||||
Where:
|
||||
pkgs: the nixpkgs instance to use for fetchers (must match the target system).
|
||||
selected = selectVariant spec variantName system
|
||||
Returns:
|
||||
{ componentName = src | renderedComp (for "none"); ... }
|
||||
*/
|
||||
mkAllSources =
|
||||
selected:
|
||||
pkgs': selected:
|
||||
mapAttrs (
|
||||
_name: comp:
|
||||
if comp ? fetcher && comp.fetcher == "none" then
|
||||
renderValue comp selected.variables
|
||||
else
|
||||
mkSrc (renderValue comp selected.variables) selected.variables
|
||||
mkSrc pkgs' (renderValue comp selected.variables) selected.variables
|
||||
) selected.sources;
|
||||
|
||||
# Expose deepMerge for convenience (right-biased).
|
||||
|
||||
Reference in New Issue
Block a user