Fix utility script bugs
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -41,8 +41,8 @@ Any `options.nix` files create custom option definitions when present.
|
|||||||
|
|
||||||
Below is a table of all hosts, with links to their respective README files, which may provide further details and/or post-installation checklists.
|
Below is a table of all hosts, with links to their respective README files, which may provide further details and/or post-installation checklists.
|
||||||
|
|
||||||
| Host | README |
|
| Host | README |
|
||||||
|-------------|------------------------------------------------------|
|
|-------------|----------------------------------------------------------|
|
||||||
| `installer` | [hosts/installer/README.md](./hosts/installer/README.md) |
|
| `installer` | [hosts/installer/README.md](./hosts/installer/README.md) |
|
||||||
| `eirene` | [hosts/eirene/README.md](./hosts/eirene/README.md) |
|
| `eirene` | [hosts/eirene/README.md](./hosts/eirene/README.md) |
|
||||||
| `elara` | [hosts/elara/README.md](./hosts/elara/README.md) |
|
| `elara` | [hosts/elara/README.md](./hosts/elara/README.md) |
|
||||||
|
@@ -14,10 +14,10 @@ in
|
|||||||
(pkgs.formats.json { }).generate "lens-user-store.json"
|
(pkgs.formats.json { }).generate "lens-user-store.json"
|
||||||
{
|
{
|
||||||
__internal__ = {
|
__internal__ = {
|
||||||
migrations = {
|
migrations = {
|
||||||
version = "6.5.0";
|
version = "6.5.0";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
preferences = {
|
preferences = {
|
||||||
colorTheme = "system";
|
colorTheme = "system";
|
||||||
|
@@ -1 +1,13 @@
|
|||||||
# installer
|
# installer
|
||||||
|
|
||||||
|
I have automated myself out of a job. How to use:
|
||||||
|
|
||||||
|
1. Boot into installer
|
||||||
|
2. Unlock luks partition
|
||||||
|
3. Run the following commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd /etc/nixos
|
||||||
|
direnv allow
|
||||||
|
sudo ./lib/scripts/install.sh
|
||||||
|
```
|
||||||
|
@@ -17,7 +17,7 @@ ssh-keygen -t ed25519 -f "./hosts/${HOST}/secrets/ssh_host_ed25519_key" -N ""
|
|||||||
|
|
||||||
AGE_KEY=$(nix shell nixpkgs#ssh-to-age --command bash -c "cat './hosts/${HOST}/secrets/ssh_host_ed25519_key.pub' | ssh-to-age")
|
AGE_KEY=$(nix shell nixpkgs#ssh-to-age --command bash -c "cat './hosts/${HOST}/secrets/ssh_host_ed25519_key.pub' | ssh-to-age")
|
||||||
|
|
||||||
for SOPS_FILE in $(find . -type f -name "sops.yaml"); do
|
find . -type f -name "sops.yaml" | while IFS= read -r SOPS_FILE; do
|
||||||
sed -i "/- hosts:/a\ - &${HOST} ${AGE_KEY}" "${SOPS_FILE}"
|
sed -i "/- hosts:/a\ - &${HOST} ${AGE_KEY}" "${SOPS_FILE}"
|
||||||
sed -i "/- age:/a\ - *${HOST}" "${SOPS_FILE}"
|
sed -i "/- age:/a\ - *${HOST}" "${SOPS_FILE}"
|
||||||
done
|
done
|
||||||
|
@@ -59,7 +59,7 @@ setup_wifi() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Waiting for a network connection..."
|
echo "Waiting for a network connection..."
|
||||||
for i in {1..10}; do
|
for _ in {1..10}; do
|
||||||
if ping -c 1 google.com &>/dev/null; then
|
if ping -c 1 google.com &>/dev/null; then
|
||||||
echo "Connected to the network successfully."
|
echo "Connected to the network successfully."
|
||||||
return
|
return
|
||||||
@@ -73,8 +73,9 @@ setup_wifi() {
|
|||||||
|
|
||||||
select_host() {
|
select_host() {
|
||||||
echo "Available hosts:"
|
echo "Available hosts:"
|
||||||
echo $(nix --experimental-features "nix-command flakes" flake show --json |
|
hosts=$(nix --experimental-features "nix-command flakes" flake show --json \
|
||||||
nix --experimental-features "nix-command flakes" shell nixpkgs#jq --command jq -r '.nixosConfigurations | keys[]')
|
| nix --experimental-features "nix-command flakes" shell nixpkgs#jq --command jq -r '.nixosConfigurations | keys[]')
|
||||||
|
echo "${hosts}"
|
||||||
|
|
||||||
echo "Enter host:"
|
echo "Enter host:"
|
||||||
read -r host
|
read -r host
|
||||||
@@ -120,8 +121,8 @@ copy_config() {
|
|||||||
read -r copy_config
|
read -r copy_config
|
||||||
|
|
||||||
if [[ "${copy_config}" =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
if [[ "${copy_config}" =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
||||||
rm -rf /mnt/etc/nixos
|
rm -rf /mnt/persist/etc/nixos
|
||||||
cp -r . /mnt/etc/nixos
|
cp -r . /mnt/persist/etc/nixos
|
||||||
echo "Configuration copied successfully."
|
echo "Configuration copied successfully."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@ HOST="$1"
|
|||||||
|
|
||||||
AGE_KEY=$(nix shell nixpkgs#ssh-to-age --command bash -c "cat './hosts/${HOST}/secrets/ssh_host_ed25519_key.pub' | ssh-to-age")
|
AGE_KEY=$(nix shell nixpkgs#ssh-to-age --command bash -c "cat './hosts/${HOST}/secrets/ssh_host_ed25519_key.pub' | ssh-to-age")
|
||||||
|
|
||||||
for SOPS_FILE in $(find . -type f -name "sops.yaml"); do
|
find . -type f -name "sops.yaml" | while IFS= read -r SOPS_FILE; do
|
||||||
sed -i "/ - &${HOST} ${AGE_KEY}/d" "${SOPS_FILE}"
|
sed -i "/ - &${HOST} ${AGE_KEY}/d" "${SOPS_FILE}"
|
||||||
sed -i "/ - \*${HOST}/d" "${SOPS_FILE}"
|
sed -i "/ - \*${HOST}/d" "${SOPS_FILE}"
|
||||||
done
|
done
|
||||||
|
@@ -11,11 +11,13 @@ fi
|
|||||||
|
|
||||||
export SOPS_AGE_KEY_FILE="$1"
|
export SOPS_AGE_KEY_FILE="$1"
|
||||||
|
|
||||||
for SOPS_FILE in $(find . -type f -name 'sops.yaml'); do
|
find . -type f -name 'sops.yaml' | while IFS= read -r SOPS_FILE; do
|
||||||
dir=$(dirname "${SOPS_FILE}")
|
dir=$(dirname "${SOPS_FILE}")
|
||||||
echo "${dir}"
|
echo "${dir}"
|
||||||
find "${dir}" -maxdepth 1 -type f -regextype posix-extended -regex '.+\.(yaml|yml|json|env|ini|bin)' | while read -r file; do
|
find "${dir}" -maxdepth 1 -type f -regextype posix-extended \
|
||||||
echo "${file}"
|
-regex '.+\.(yaml|yml|json|env|ini|bin)' \
|
||||||
nix shell nixpkgs#sops --command sops --config "${SOPS_FILE}" updatekeys "${file}" -y
|
! -name 'sops.yaml' | while IFS= read -r file; do
|
||||||
done
|
echo "${file}"
|
||||||
|
nix shell nixpkgs#sops --command sops --config "${SOPS_FILE}" updatekeys "${file}" -y
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user