Merge pull request 'fix: update infect' (#25) from testing/digital-ocean-cleanup into providers/digital-ocean

Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-infect/pulls/25
This commit is contained in:
Inex Code 2023-07-26 01:09:53 +03:00
commit acae23fdb0

View file

@ -29,11 +29,7 @@ makeConf() {
# Prevent grep for sending error code 1 (and halting execution) when no lines are selected : https://www.unix.com/man-page/posix/1P/grep
local IFS=$'\n'
for trypath in /root/.ssh/authorized_keys /home/$SUDO_USER/.ssh/authorized_keys $HOME/.ssh/authorized_keys; do
[[ -r "$trypath" ]] \
&& keys=$(sed -E 's/^.*((ssh|ecdsa)-[^[:space:]]+)[[:space:]]+([^[:space:]]+)([[:space:]]*.*)$/\1 \3\4/' "$trypath") \
&& break
done
local network_import=""
[[ -n "$doNetConf" ]] && network_import="./networking.nix # generated at runtime by nixos-infect"
@ -58,6 +54,9 @@ makeConf() {
"apiKey": "$CF_TOKEN",
"useStagingACME": $STAGING_ACME
},
"email": {
"location": "sda"
},
"server": {
"provider": "DIGITALOCEAN"
},
@ -117,6 +116,11 @@ EOF
)
fi
availableKernelModules=('"ata_piix"' '"uhci_hcd"' '"xen_blkfront"')
if isX86_64; then
availableKernelModules+=('"vmw_pvscsi"')
fi
# If you rerun this later, be sure to prune the filesSystems attr
cat > /etc/nixos/hardware-configuration.nix << EOF
{ modulesPath, ... }:
@ -127,6 +131,7 @@ EOF
];
$bootcfg
boot.initrd.kernelModules = [ "nvme" ];
boot.initrd.availableKernelModules = [ ${availableKernelModules[@]} ];
fileSystems."/" = { device = "$rootfsdev"; fsType = "$rootfstype"; };
}
EOF
@ -181,7 +186,10 @@ EOF
networking = {
nameservers = [ ${nameservers[@]} ];
defaultGateway = "${gateway}";
defaultGateway6 = "${gateway6}";
defaultGateway6 = {
address = "${gateway6}";
interface = "${eth0_name}";
};
dhcpcd.enable = false;
$predictable_inames
interfaces = {
@ -330,7 +338,7 @@ infect() {
#addgroup nixbld -g 30000 || true
#for i in {1..10}; do adduser -DH -G nixbld nixbld$i || true; done
curl -L https://nixos.org/nix/install | $SHELL
curl -L https://nixos.org/nix/install | sh -s -- --no-channel-add
# shellcheck disable=SC1090
source ~/.nix-profile/etc/profile.d/nix.sh