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;
|
internal = true;
|
||||||
description = "Package containing /etc files.";
|
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 = {
|
config = {
|
||||||
|
|
||||||
build.activationPackage =
|
build = {
|
||||||
|
activationAfter.linkProfile = ''
|
||||||
|
generationDir="$(dirname "$(realpath $0)")"
|
||||||
|
$DRY_RUN_CMD nix-env --profile "${cfg.profileDirectory}" --set "$generationDir"
|
||||||
|
'';
|
||||||
|
|
||||||
|
activationPackage =
|
||||||
pkgs.runCommand
|
pkgs.runCommand
|
||||||
"nix-on-droid-generation"
|
"nix-on-droid-generation"
|
||||||
{
|
{
|
||||||
|
|
@ -139,6 +152,9 @@ in
|
||||||
ln --symbolic ${config.environment.usrBinEnv} $out/filesystem/usr/bin/env
|
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() {
|
function doSwitch() {
|
||||||
local profileDirectory="/nix/var/nix/profiles/nix-on-droid"
|
if [[ -v VERBOSE ]]; then
|
||||||
|
PASSTHROUGH_OPTS+=(--show-trace)
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Building activation package..."
|
echo "Building activation package..."
|
||||||
nix build \
|
nix build \
|
||||||
|
|
@ -43,15 +45,13 @@ function doSwitch() {
|
||||||
${PASSTHROUGH_OPTS[*]} \
|
${PASSTHROUGH_OPTS[*]} \
|
||||||
activationPackage
|
activationPackage
|
||||||
|
|
||||||
echo "Save profile activation package..."
|
echo "Run activation script..."
|
||||||
generationDir="$(nix path-info \
|
generationDir="$(nix path-info \
|
||||||
--file "<nix-on-droid/modules>" \
|
--file "<nix-on-droid/modules>" \
|
||||||
${PASSTHROUGH_OPTS[*]} \
|
${PASSTHROUGH_OPTS[*]} \
|
||||||
activationPackage \
|
activationPackage \
|
||||||
)"
|
)"
|
||||||
nix-env --profile "${profileDirectory}" --set "${generationDir}"
|
|
||||||
|
|
||||||
echo "Run activation script..."
|
|
||||||
"${generationDir}/activate"
|
"${generationDir}/activate"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue