builder: put variantPackages in its own derivation
This commit is contained in:
parent
e11740497a
commit
d8df8f0565
32
builder.nix
32
builder.nix
|
@ -70,6 +70,15 @@ let
|
||||||
|
|
||||||
variantFiles = fetchSums "${baseUrl}/targets/${target}/${variant}" sha256;
|
variantFiles = fetchSums "${baseUrl}/targets/${target}/${variant}" sha256;
|
||||||
|
|
||||||
|
variantPackages = runCommandNoCC "openwrt-${release}-${target}-${variant}-packages" {} ''
|
||||||
|
mkdir packages
|
||||||
|
${lib.concatMapStrings (file:
|
||||||
|
lib.optionalString (lib.hasPrefix "packages/" file) ''
|
||||||
|
ln -s ${variantFiles.${file}} ${file}
|
||||||
|
'') (builtins.attrNames variantFiles)}
|
||||||
|
mv packages $out
|
||||||
|
'';
|
||||||
|
|
||||||
feedsPackagesFile = builtins.mapAttrs (feed: sha256:
|
feedsPackagesFile = builtins.mapAttrs (feed: sha256:
|
||||||
fetchurl {
|
fetchurl {
|
||||||
url = "${baseUrl}/packages/${arch}/${feed}/Packages";
|
url = "${baseUrl}/packages/${arch}/${feed}/Packages";
|
||||||
|
@ -82,7 +91,7 @@ let
|
||||||
) feedsPackagesFile;
|
) feedsPackagesFile;
|
||||||
|
|
||||||
feedsPackages = builtins.mapAttrs (feed: files:
|
feedsPackages = builtins.mapAttrs (feed: files:
|
||||||
runCommandNoCC "openwrt-${feed}-packages" {} ''
|
runCommandNoCC "openwrt-${release}-${arch}-${feed}-packages" {} ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
ln -s ${feedsPackagesFile.${feed}} $out/Packages
|
ln -s ${feedsPackagesFile.${feed}} $out/Packages
|
||||||
${lib.concatMapStrings (file: ''
|
${lib.concatMapStrings (file: ''
|
||||||
|
@ -135,7 +144,7 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
cat >repositories.conf <<EOF
|
cat >repositories.conf <<EOF
|
||||||
src imagebuilder file:packages
|
src imagebuilder file:${variantPackages}
|
||||||
${lib.concatMapStrings (feed: ''
|
${lib.concatMapStrings (feed: ''
|
||||||
src openwrt_${feed} file:${feedsPackages.${feed}}
|
src openwrt_${feed} file:${feedsPackages.${feed}}
|
||||||
'') (builtins.attrNames feedsPackages)}
|
'') (builtins.attrNames feedsPackages)}
|
||||||
|
@ -148,22 +157,9 @@ stdenv.mkDerivation {
|
||||||
ncurses which rsync git file getopt wget
|
ncurses which rsync git file getopt wget
|
||||||
bash perl python3
|
bash perl python3
|
||||||
];
|
];
|
||||||
buildPhase =
|
buildPhase = ''
|
||||||
let
|
make image SHELL=${runtimeShell} \
|
||||||
packagesDir = runCommandNoCC "openwrt-${release}-${target}-${variant}-packages" {} ''
|
PROFILE="${profile}"
|
||||||
mkdir packages
|
|
||||||
${lib.concatMapStrings (file:
|
|
||||||
lib.optionalString (lib.hasPrefix "packages/" file) ''
|
|
||||||
ln -s ${variantFiles.${file}} ${file}
|
|
||||||
'') (builtins.attrNames variantFiles)}
|
|
||||||
mv packages $out
|
|
||||||
'';
|
|
||||||
in ''
|
|
||||||
rm -r packages
|
|
||||||
cp -r ${packagesDir} packages
|
|
||||||
chmod u+w -R packages
|
|
||||||
|
|
||||||
make image SHELL=${runtimeShell} PROFILE="${profile}"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user