Skip to content

Commit

Permalink
Hacky support for custom packages
Browse files Browse the repository at this point in the history
This is so barely baked. It doesn't actually make this easy, it just
makes it possible. You still need to override the configure phase to
symlink in the appropriate `.ipk` file for this to work.

See astro#38 for the
proper feature request.
  • Loading branch information
jfly committed Apr 21, 2024
1 parent 7ce60a3 commit 53f1a8a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
).packages.${packagesArch}
# Extra OpenWRT packages (can be prefixed with "-")
, packages ? []
# TODO: <<< explain >>>
, hackExtraPackages ? []
# Include extra files
, files ? null
# Which services in /etc/init.d/ should be disabled
Expand Down Expand Up @@ -91,6 +93,9 @@ pkgs.stdenv.mkDerivation {
ln -s $file $(basename $file)
done
fi
'' + lib.optionalString (files != null) ''
# copy files to avoid making etc read-only
cp -r --no-preserve=all ${files} files
'';

nativeBuildInputs = with pkgs; [
Expand All @@ -103,7 +108,7 @@ pkgs.stdenv.mkDerivation {
makeArgs = lib.concatStringsSep " " [
"-j$NIX_BUILD_CORES"
"DISABLED_SERVICES='${lib.concatStringsSep " " disabledServices}'"
"PACKAGES='${lib.concatStringsSep " " packages}'"
"PACKAGES='${lib.concatStringsSep " " (packages ++ hackExtraPackages)}'"
"PROFILE='${profile}'"
"SHELL='${pkgs.runtimeShell}'"
(lib.optionalString (files != null) "FILES='./files'")
Expand All @@ -114,9 +119,6 @@ pkgs.stdenv.mkDerivation {
in lib.optionalString (lib.versionOlder release "19") ''
# Hack around broken check for gcc
touch staging_dir/host/.prereq-build
'' + lib.optionalString (files != null) ''
# copy files to avoid making etc read-only
cp -r --no-preserve=all ${files} files
'' + ''
make image ${makeArgs}
'';
Expand Down

0 comments on commit 53f1a8a

Please sign in to comment.