Skip to content

Commit

Permalink
Fix simple bash errors in user VM script
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed May 9, 2024
1 parent 8ba3fa5 commit fd9869b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 2 additions & 0 deletions user-machines/vm/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ in
hostOrderToIP
mkCloudInitImage;

volumeSize = "4G";

ips = rec {
start = {
ip = "192.168.168.2";
Expand Down
17 changes: 7 additions & 10 deletions user-machines/vm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ let
inherit (import ./config.nix { inherit pkgs; })
lib
ips
ubuntu;
ubuntu
volumeSize;

mkRawImage = image: pkgs.runCommand
"${image.name}-raw.img"
Expand All @@ -48,12 +49,6 @@ in
default = "/var/lib/acm-vm";
description = "The directory to store VM disk images in.";
};

volumeSizeGB = mkOption {
type = types.int;
default = 4;
description = "The size in GB of the VM disk images applied to new and existing images.";
};

virtConnection = mkOption {
type = types.str;
Expand Down Expand Up @@ -162,7 +157,7 @@ in
export POOL_NAME="acm-vm-pool"
export POOL_DIRECTORY=${self.poolDirectory}
export VOLUME_SIZE=${toString self.volumeSizeGB}"GiB"
export VOLUME_SIZE=${volumeSize}
log() { echo "$@" >&2; }
Expand All @@ -174,7 +169,8 @@ in
for uuid in ${concatStringsSep " " (map (user: user.uuid) activeUsers)}; do
volume="$uuid.img"
echo "Creating $volume..."
volumePath="$POOL_DIRECTORY/$volume"
echo "Creating $volumePath..."
if [[ -f "$volumePath" ]]; then
log " volume already exists."
Expand All @@ -198,7 +194,8 @@ in
for uuid in ${concatStringsSep " " (map (user: user.uuid) deletedUsers)}; do
volume="$uuid.img"
echo "Deleting $volume..."
volumePath="$POOL_DIRECTORY/$volume"
echo "Deleting $volumePath..."
if [[ -f "$volumePath" ]]; then
log " volume exists, deleting..."
Expand Down

0 comments on commit fd9869b

Please sign in to comment.