login-inner: get rid of gnused in flake bootstrap

This commit is contained in:
Alexander Sosedkin 2024-07-07 23:42:33 +02:00
parent 35076ea33f
commit bab7c453f4
2 changed files with 22 additions and 11 deletions

View file

@ -81,18 +81,29 @@ writeText "login-inner" ''
${lib.optionalString config.build.flake.inputOverrides ''
echo "Overriding input urls in the flake..."
${nixCmd} run nixpkgs#gnused -- \
-i \
-e 's,\"github:NixOS/nixpkgs.*\",\"${config.build.flake.nixpkgs}\",' \
-e 's,\"github:nix-community/nix-on-droid.*\",\"${config.build.flake.nix-on-droid}\",' \
"${config.user.home}/.config/nix-on-droid/flake.nix"
while IFS="" read -r p || [[ -n "$p" ]]
do
if [[ $p =~ (.*)github:NixOS/nixpkgs.*\"\; ]]; then
printf "''${BASH_REMATCH[1]}${config.build.flake.nixpkgs}\";\n" "$p"
elif [[ $p =~ (.*)github:nix-community/nix-on-droid.*\"\; ]]; then
printf "''${BASH_REMATCH[1]}${config.build.flake.nix-on-droid}\";\n" "$p"
else
printf '%s\n' "$p"
fi
done <<<$(< "${config.user.home}/.config/nix-on-droid/flake.nix") \
> "${config.user.home}/.config/nix-on-droid/flake.nix"
''}
echo "Overriding system value in the flake..."
${nixCmd} run nixpkgs#gnused -- \
-i \
-e 's,\"aarch64-linux",\"${targetSystem}\",' \
"${config.user.home}/.config/nix-on-droid/flake.nix"
while IFS="" read -r p || [[ -n "$p" ]]
do
if [[ $p =~ (.*)\"aarch64-linux\"(.*) ]]; then
printf "''${BASH_REMATCH[1]}\"${targetSystem}\"''${BASH_REMATCH[2]}\n" "$p"
else
printf '%s\n' "$p"
fi
done <<<$(< "${config.user.home}/.config/nix-on-droid/flake.nix") \
> "${config.user.home}/.config/nix-on-droid/flake.nix"
echo "Installing first Nix-on-Droid generation..."
${nixCmd} run ${config.build.flake.nix-on-droid} -- switch --flake ${config.user.home}/.config/nix-on-droid

View file

@ -40,8 +40,8 @@ def run(d):
wait_for(d, 'Setting up Nix-on-Droid with flakes...')
wait_for(d, 'Installing flake from default template...')
wait_for(d, 'Overriding system value in the flake...', timeout=600)
wait_for(d, 'Installing first Nix-on-Droid generation...')
wait_for(d, 'Overriding system value in the flake...')
wait_for(d, 'Installing first Nix-on-Droid generation...', timeout=180)
wait_for(d, 'Building activation package', timeout=180)
wait_for(d, 'Congratulations!', timeout=900)
wait_for(d, 'bash-5.2$')