init commit
This commit is contained in:
63
buildOpenwrt.nix
Normal file
63
buildOpenwrt.nix
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
pkgs ? import <nixpkgs> {},
|
||||
target,
|
||||
arch,
|
||||
profile,
|
||||
version,
|
||||
packages ? [],
|
||||
manifestPkgs ? "$(cat manifest_packages)",
|
||||
workingFolder ? "$PWD/_builder"
|
||||
}:
|
||||
pkgs.mkShell {
|
||||
name = "openwrt-build-${target}-${arch}-${profile}";
|
||||
buildInputs = with pkgs; [
|
||||
perl
|
||||
quilt
|
||||
ccache
|
||||
libxslt
|
||||
gcc
|
||||
gengetopt
|
||||
subversion
|
||||
git
|
||||
python3Full
|
||||
rsync
|
||||
man_db
|
||||
gawk
|
||||
gettext
|
||||
unzip
|
||||
file
|
||||
wget
|
||||
ncurses5.dev
|
||||
zlib.static
|
||||
gnumake
|
||||
which
|
||||
bash
|
||||
coreutils
|
||||
wget
|
||||
gnutar
|
||||
curl
|
||||
cacert
|
||||
];
|
||||
shellHook =
|
||||
''
|
||||
export WORKING_FOLDER=$(realpath ${workingFolder})
|
||||
function loadBuilder() {
|
||||
curl -s https://downloads.openwrt.org/releases/${version}/targets/${target}/${arch}/openwrt-imagebuilder-${version}-${target}-${arch}.Linux-x86_64.tar.xz | tar xvJ -C $WORKING_FOLDER
|
||||
curl -s https://downloads.openwrt.org/releases/${version}/targets/${target}/${arch}/openwrt-${version}-${target}-${arch}.manifest | cut -f 1 -d ' ' | tr '\n' ' ' > $WORKING_FOLDER/openwrt-imagebuilder-${version}-${target}-${arch}.Linux-x86_64/manifest_packages
|
||||
}
|
||||
|
||||
function removeBuilder() {
|
||||
rm -rf $WORKING_FOLDER/openwrt-imagebuilder-${version}-${target}-${arch}.Linux-x86_64
|
||||
}
|
||||
|
||||
function makeImage() {
|
||||
cd $WORKING_FOLDER/openwrt-imagebuilder-${version}-${target}-${arch}.Linux-x86_64
|
||||
MANIFEST_PKGS=${manifestPkgs}
|
||||
make image PROFILE=${profile} PACKAGES="$MANIFEST_PKGS ${toString packages}"
|
||||
}
|
||||
|
||||
function makeCleanImage() {
|
||||
removeBuilder && loadBuilder && makeImage
|
||||
}
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user