mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
bootstrap: use env vars to set custom channel urls
This commit is contained in:
parent
bb8ac7fe1f
commit
b01a2a8a57
2 changed files with 15 additions and 5 deletions
|
|
@ -137,7 +137,9 @@ To re-trigger the installation, you can use
|
||||||
|
|
||||||
If you want to change the nix-on-droid channel to your custom one,
|
If you want to change the nix-on-droid channel to your custom one,
|
||||||
you can do that either with `nix-channel` after the installation,
|
you can do that either with `nix-channel` after the installation,
|
||||||
or by using `--argstr nixOnDroidChannelURL <URL>`.
|
or by setting the environment variable `NIX_ON_DROID_CHANNEL_URL`.
|
||||||
|
Other environment variables are `NIXPKGS_CHANNEL_URL` an
|
||||||
|
`NIX_ON_DROID_FLAKE_URL`.
|
||||||
|
|
||||||
**Note**: The `proot` binary is not built on the android device
|
**Note**: The `proot` binary is not built on the android device
|
||||||
(NDK is required for building it, and it's not available on mobile platforms).
|
(NDK is required for building it, and it's not available on mobile platforms).
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,14 @@ let
|
||||||
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
||||||
|
urlOptionValue = url: envVar:
|
||||||
|
let
|
||||||
|
envValue = builtins.getEnv envVar;
|
||||||
|
in
|
||||||
|
pkgs.lib.mkIf
|
||||||
|
(envValue != "" || url != null)
|
||||||
|
(if url == null then envValue else url);
|
||||||
|
|
||||||
modules = import ../modules {
|
modules = import ../modules {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
|
||||||
|
|
@ -29,15 +37,15 @@ let
|
||||||
# Fix invoking bash after initial build.
|
# Fix invoking bash after initial build.
|
||||||
user.shell = "${initialPackageInfo.bash}/bin/bash";
|
user.shell = "${initialPackageInfo.bash}/bin/bash";
|
||||||
|
|
||||||
build = with pkgs.lib; {
|
build = {
|
||||||
inherit arch;
|
inherit arch;
|
||||||
|
|
||||||
channel = {
|
channel = {
|
||||||
nixpkgs = mkIf (nixpkgsChannelURL != null) nixpkgsChannelURL;
|
nixpkgs = urlOptionValue nixpkgsChannelURL "NIXPKGS_CHANNEL_URL";
|
||||||
nix-on-droid = mkIf (nixOnDroidChannelURL != null) nixOnDroidChannelURL;
|
nix-on-droid = urlOptionValue nixOnDroidChannelURL "NIX_ON_DROID_CHANNEL_URL";
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.nix-on-droid = mkIf (nixOnDroidFlakeURL != null) nixOnDroidFlakeURL;
|
flake.nix-on-droid = urlOptionValue nixOnDroidFlakeURL "NIX_ON_DROID_FLAKE_URL";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue