Link to profile in activation script instead of nix-on-droid

This commit is contained in:
Tobias Happ 2019-11-27 10:33:35 +01:00 committed by Alexander Sosedkin
parent be7dfc7195
commit cd58e8dbd4
2 changed files with 37 additions and 21 deletions

View file

@ -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,7 +124,13 @@ in
config = {
build.activationPackage =
build = {
activationAfter.linkProfile = ''
generationDir="$(dirname "$(realpath $0)")"
$DRY_RUN_CMD nix-env --profile "${cfg.profileDirectory}" --set "$generationDir"
'';
activationPackage =
pkgs.runCommand
"nix-on-droid-generation"
{
@ -139,6 +152,9 @@ in
ln --symbolic ${config.environment.usrBinEnv} $out/filesystem/usr/bin/env
'';
profileDirectory = "/nix/var/nix/profiles/nix-on-droid";
};
};
}

View file

@ -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"
}