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 73a579bb00
commit 2ed50d8210
2 changed files with 22 additions and 11 deletions

View file

@ -81,18 +81,29 @@ writeText "login-inner" ''
${lib.optionalString config.build.flake.inputOverrides '' ${lib.optionalString config.build.flake.inputOverrides ''
echo "Overriding input urls in the flake..." echo "Overriding input urls in the flake..."
${nixCmd} run nixpkgs#gnused -- \ while IFS="" read -r p || [[ -n "$p" ]]
-i \ do
-e 's,\"github:NixOS/nixpkgs.*\",\"${config.build.flake.nixpkgs}\",' \ if [[ $p =~ (.*)github:NixOS/nixpkgs.*\"\; ]]; then
-e 's,\"github:nix-community/nix-on-droid.*\",\"${config.build.flake.nix-on-droid}\",' \ printf "''${BASH_REMATCH[1]}${config.build.flake.nixpkgs}\";\n" "$p"
"${config.user.home}/.config/nix-on-droid/flake.nix" 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..." echo "Overriding system value in the flake..."
${nixCmd} run nixpkgs#gnused -- \ while IFS="" read -r p || [[ -n "$p" ]]
-i \ do
-e 's,\"aarch64-linux",\"${targetSystem}\",' \ if [[ $p =~ (.*)\"aarch64-linux\"(.*) ]]; then
"${config.user.home}/.config/nix-on-droid/flake.nix" 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..." echo "Installing first Nix-on-Droid generation..."
${nixCmd} run ${config.build.flake.nix-on-droid} -- switch --flake ${config.user.home}/.config/nix-on-droid ${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, 'Setting up Nix-on-Droid with flakes...')
wait_for(d, 'Installing flake from default template...') wait_for(d, 'Installing flake from default template...')
wait_for(d, 'Overriding system value in the flake...', timeout=600) wait_for(d, 'Overriding system value in the flake...')
wait_for(d, 'Installing first Nix-on-Droid generation...') wait_for(d, 'Installing first Nix-on-Droid generation...', timeout=180)
wait_for(d, 'Building activation package', timeout=180) wait_for(d, 'Building activation package', timeout=180)
wait_for(d, 'Congratulations!', timeout=900) wait_for(d, 'Congratulations!', timeout=900)
wait_for(d, 'bash-5.2$') wait_for(d, 'bash-5.2$')