mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
Add managing of proot-static
This commit is contained in:
parent
41fca9b4e9
commit
eb2fcc80f5
6 changed files with 48 additions and 21 deletions
|
|
@ -147,6 +147,7 @@ in
|
||||||
|
|
||||||
ln --symbolic ${config.environment.files.login} $out/filesystem/bin/login
|
ln --symbolic ${config.environment.files.login} $out/filesystem/bin/login
|
||||||
ln --symbolic ${config.environment.files.loginInner} $out/filesystem/usr/lib/login-inner
|
ln --symbolic ${config.environment.files.loginInner} $out/filesystem/usr/lib/login-inner
|
||||||
|
ln --symbolic ${config.environment.files.prootStatic}/bin/proot-static $out/filesystem/bin/proot-static
|
||||||
|
|
||||||
ln --symbolic ${config.environment.binSh} $out/filesystem/bin/sh
|
ln --symbolic ${config.environment.binSh} $out/filesystem/bin/sh
|
||||||
ln --symbolic ${config.environment.usrBinEnv} $out/filesystem/usr/bin/env
|
ln --symbolic ${config.environment.usrBinEnv} $out/filesystem/usr/bin/env
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,13 @@ with lib;
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
build = {
|
build = {
|
||||||
|
arch = mkOption {
|
||||||
|
type = types.enum [ "aarch64" "i686" ];
|
||||||
|
default = if pkgs.stdenv.isAarch64 then "aarch64" else "i686";
|
||||||
|
internal = true;
|
||||||
|
description = "Destination arch.";
|
||||||
|
};
|
||||||
|
|
||||||
initialBuild = mkOption {
|
initialBuild = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|
|
||||||
|
|
@ -11,24 +11,17 @@ with lib;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
build = {
|
build.channel = {
|
||||||
arch = mkOption {
|
nixpkgs = mkOption {
|
||||||
type = types.enum [ "aarch64" "i686" ];
|
type = types.str;
|
||||||
description = "Destination arch.";
|
default = "https://nixos.org/channels/nixos-19.09";
|
||||||
|
description = "Channel URL for nixpkgs.";
|
||||||
};
|
};
|
||||||
|
|
||||||
channel = {
|
nix-on-droid = mkOption {
|
||||||
nixpkgs = mkOption {
|
type = types.str;
|
||||||
type = types.str;
|
default = "https://github.com/t184256/nix-on-droid-bootstrap/archive/master.tar.gz";
|
||||||
default = "https://nixos.org/channels/nixos-19.09";
|
description = "Channel URL for nix-on-droid.";
|
||||||
description = "Channel URL for nixpkgs.";
|
|
||||||
};
|
|
||||||
|
|
||||||
nix-on-droid = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "https://github.com/t184256/nix-on-droid-bootstrap/archive/master.tar.gz";
|
|
||||||
description = "Channel URL for nix-on-droid.";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
cfg = config.environment.files;
|
||||||
|
|
||||||
login = pkgs.callPackage ./login.nix { inherit config; };
|
login = pkgs.callPackage ./login.nix { inherit config; };
|
||||||
|
|
||||||
loginInner = pkgs.callPackage ./login-inner.nix { inherit config customPkgs; };
|
loginInner = pkgs.callPackage ./login-inner.nix { inherit config customPkgs; };
|
||||||
|
|
@ -31,6 +33,13 @@ in
|
||||||
internal = true;
|
internal = true;
|
||||||
description = "Login-inner script.";
|
description = "Login-inner script.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
prootStatic = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
readOnly = true;
|
||||||
|
internal = true;
|
||||||
|
description = "proot-static package.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -40,14 +49,26 @@ in
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
build.activation.installLoginScripts = ''
|
build.activation = {
|
||||||
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin /usr/lib
|
installLoginScripts = ''
|
||||||
$DRY_RUN_CMD cp $VERBOSE_ARG ${login} /bin/login
|
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin /usr/lib
|
||||||
$DRY_RUN_CMD cp $VERBOSE_ARG ${loginInner} /usr/lib/login-inner
|
$DRY_RUN_CMD cp $VERBOSE_ARG ${login} /bin/login
|
||||||
'';
|
$DRY_RUN_CMD cp $VERBOSE_ARG ${loginInner} /usr/lib/login-inner
|
||||||
|
'';
|
||||||
|
|
||||||
|
installProotStatic = ''
|
||||||
|
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin
|
||||||
|
$DRY_RUN_CMD cp $VERBOSE_ARG ${cfg.prootStatic}/bin/proot-static /bin/.proot-static.new
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
environment.files = {
|
environment.files = {
|
||||||
inherit login loginInner;
|
inherit login loginInner;
|
||||||
|
|
||||||
|
prootStatic =
|
||||||
|
if config.build.arch == "aarch64"
|
||||||
|
then "/nix/store/40zq5iy3iaj3pc9phshxmp4x8k7084lf-proot-termux-unstable-2019-09-05-aarch64-unknown-linux-android"
|
||||||
|
else "/nix/store/wlr4f16mfsg1fkj4wdrppcmh0kd3lgwv-proot-termux-unstable-2019-09-05-i686-unknown-linux-android";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,10 @@ writeScript "login" ''
|
||||||
exec ${installationDir}/bin/login "$@"
|
exec ${installationDir}/bin/login "$@"
|
||||||
''
|
''
|
||||||
else ''
|
else ''
|
||||||
|
if [[ -x ${installationDir}/bin/.proot-static.new ]] && ! $(/system/bin/pgrep proot-static); then
|
||||||
|
/system/bin/mv ${installationDir}/bin/.proot-static.new ${installationDir}/bin/proot-static
|
||||||
|
fi
|
||||||
|
|
||||||
exec ${installationDir}/bin/proot-static \
|
exec ${installationDir}/bin/proot-static \
|
||||||
-b ${installationDir}/nix:/nix \
|
-b ${installationDir}/nix:/nix \
|
||||||
-b ${installationDir}/bin:/bin \
|
-b ${installationDir}/bin:/bin \
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# head of nixos-19.09 as of 2019-10-14
|
# head of nixos-19.09 as of 2019-10-14
|
||||||
|
# note: when updating nixpkgs, update store paths of proot-termux in modules/environment/login/default.nix
|
||||||
pinnedPkgsSrc = builtins.fetchTarball {
|
pinnedPkgsSrc = builtins.fetchTarball {
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/45a25ff41a2309099ff2e70b2f37debd5e567618.tar.gz";
|
url = "https://github.com/NixOS/nixpkgs/archive/45a25ff41a2309099ff2e70b2f37debd5e567618.tar.gz";
|
||||||
sha256 = "0w37p98i47d7snhckz8a3a60v0f05b5047vsm4rczink9mk9x7r3";
|
sha256 = "0w37p98i47d7snhckz8a3a60v0f05b5047vsm4rczink9mk9x7r3";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue