Skip to content

Commit

Permalink
WIP: 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 7f1432e commit a3e6a33
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions modules/environment/login/login-inner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,33 @@ 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"
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.tmp"
cat "${config.user.home}/.config/nix-on-droid/flake.nix.tmp" \
> "${config.user.home}/.config/nix-on-droid/flake.nix"
''}
echo "Overriding system value in the flake..."
while IFS="" read -r p || [[ -n "$p" ]]
do
if [[ $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.tmp"
cat "${config.user.home}/.config/nix-on-droid/flake.nix.tmp" \
> "${config.user.home}/.config/nix-on-droid/flake.nix"
${nixCmd} run nixpkgs#gnused -- \
-i \
-e 's,\"aarch64-linux",\"${targetSystem}\",' \
Expand All @@ -99,6 +118,8 @@ writeText "login-inner" ''
. "${config.user.home}/.nix-profile/etc/profile.d/nix-on-droid-session-init.sh"
rm -f "${config.user.home}/.config/nix-on-droid/flake.nix.tmp"
fi
echo
Expand Down

0 comments on commit a3e6a33

Please sign in to comment.