Skip to content

Commit

Permalink
login-inner: get rid of gnused in flake bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
t184256 committed Jul 7, 2024
1 parent 73a579b commit 2ed50d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
29 changes: 20 additions & 9 deletions modules/environment/login/login-inner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/emulator/bootstrap_flakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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$')
Expand Down

0 comments on commit 2ed50d8

Please sign in to comment.