Refactor persistence structure
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -63,8 +63,8 @@ prepare_disk() {
|
||||
}
|
||||
|
||||
copy_keys() {
|
||||
mkdir -p "$root/persist/etc/ssh"
|
||||
cp -f "$flake/hosts/$host/secrets/ssh_host_ed25519_key" "$root/persist/etc/ssh/ssh_host_ed25519_key"
|
||||
mkdir -p "$root/persist/state/etc/ssh"
|
||||
cp -f "$flake/hosts/$host/secrets/ssh_host_ed25519_key" "$root/persist/state/etc/ssh/ssh_host_ed25519_key"
|
||||
|
||||
for path in "$flake/hosts/$host/users"/*; do
|
||||
if [[ -z "$key" ]]; then
|
||||
@@ -73,8 +73,8 @@ copy_keys() {
|
||||
|
||||
local user
|
||||
user=$(basename "$path")
|
||||
mkdir -p "$root/persist/home/$user/.config/sops-nix"
|
||||
cp -f "$flake/secrets/$key/key.txt" "$root/persist/home/$user/.config/sops-nix/key.txt"
|
||||
mkdir -p "$root/persist/state/home/$user/.config/sops-nix"
|
||||
cp -f "$flake/secrets/$key/key.txt" "$root/persist/state/home/$user/.config/sops-nix/key.txt"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ set_permissions() {
|
||||
for path in "$flake/hosts/$host/users"/*; do
|
||||
local user
|
||||
user=$(basename "$path")
|
||||
chown -R "$(cat "$flake/hosts/$host/users/$user/uid"):100" "$root/persist/home/$user"
|
||||
chown -R "$(cat "$flake/hosts/$host/users/$user/uid"):100" "$root/persist/*/home/$user"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -92,8 +92,9 @@ install() {
|
||||
|
||||
copy_config() {
|
||||
echo "Copying configuration..."
|
||||
rm -rf "$root/persist/etc/nixos"
|
||||
cp -r "$flake" "$root/persist/etc/nixos"
|
||||
mkdir -p "$root/persist/user/etc/nixos"
|
||||
rm -rf "$root/persist/user/etc/nixos"
|
||||
cp -r "$flake" "$root/persist/user/etc/nixos"
|
||||
}
|
||||
|
||||
finish() {
|
||||
|
Reference in New Issue
Block a user