mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
Link to profile in activation script instead of nix-on-droid
This commit is contained in:
parent
be7dfc7195
commit
cd58e8dbd4
2 changed files with 37 additions and 21 deletions
|
|
@ -108,6 +108,13 @@ in
|
|||
internal = true;
|
||||
description = "Package containing /etc files.";
|
||||
};
|
||||
|
||||
profileDirectory = mkOption {
|
||||
type = types.path;
|
||||
readOnly = true;
|
||||
internal = true;
|
||||
description = "Path to nix-on-droid profile.";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -117,27 +124,36 @@ in
|
|||
|
||||
config = {
|
||||
|
||||
build.activationPackage =
|
||||
pkgs.runCommand
|
||||
"nix-on-droid-generation"
|
||||
{
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
''
|
||||
mkdir --parents $out/filesystem/{bin,usr/{bin,lib}}
|
||||
build = {
|
||||
activationAfter.linkProfile = ''
|
||||
generationDir="$(dirname "$(realpath $0)")"
|
||||
$DRY_RUN_CMD nix-env --profile "${cfg.profileDirectory}" --set "$generationDir"
|
||||
'';
|
||||
|
||||
cp ${activationScript} $out/activate
|
||||
activationPackage =
|
||||
pkgs.runCommand
|
||||
"nix-on-droid-generation"
|
||||
{
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
''
|
||||
mkdir --parents $out/filesystem/{bin,usr/{bin,lib}}
|
||||
|
||||
ln --symbolic ${config.build.etc}/etc $out/etc
|
||||
ln --symbolic ${config.environment.path} $out/nix-on-droid-path
|
||||
cp ${activationScript} $out/activate
|
||||
|
||||
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.build.etc}/etc $out/etc
|
||||
ln --symbolic ${config.environment.path} $out/nix-on-droid-path
|
||||
|
||||
ln --symbolic ${config.environment.binSh} $out/filesystem/bin/sh
|
||||
ln --symbolic ${config.environment.usrBinEnv} $out/filesystem/usr/bin/env
|
||||
'';
|
||||
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.binSh} $out/filesystem/bin/sh
|
||||
ln --symbolic ${config.environment.usrBinEnv} $out/filesystem/usr/bin/env
|
||||
'';
|
||||
|
||||
profileDirectory = "/nix/var/nix/profiles/nix-on-droid";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ function doHelp() {
|
|||
}
|
||||
|
||||
function doSwitch() {
|
||||
local profileDirectory="/nix/var/nix/profiles/nix-on-droid"
|
||||
if [[ -v VERBOSE ]]; then
|
||||
PASSTHROUGH_OPTS+=(--show-trace)
|
||||
fi
|
||||
|
||||
echo "Building activation package..."
|
||||
nix build \
|
||||
|
|
@ -43,15 +45,13 @@ function doSwitch() {
|
|||
${PASSTHROUGH_OPTS[*]} \
|
||||
activationPackage
|
||||
|
||||
echo "Save profile activation package..."
|
||||
echo "Run activation script..."
|
||||
generationDir="$(nix path-info \
|
||||
--file "<nix-on-droid/modules>" \
|
||||
${PASSTHROUGH_OPTS[*]} \
|
||||
activationPackage \
|
||||
)"
|
||||
nix-env --profile "${profileDirectory}" --set "${generationDir}"
|
||||
|
||||
echo "Run activation script..."
|
||||
"${generationDir}/activate"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue