Skip to content

Commit

Permalink
Fix user-vms build
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed May 7, 2024
1 parent a60571c commit 090915b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions servers/cs306/user-vms/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ in
}
'';
"http://*.vps.acmcsuf.com" =
(lib.concatStrings (lib.imap0 (i: user: ''
@user${i} <<CEL
with lib;
with builtins;
(concatStrings (imap0 (i: user: ''
@user_${toString i} <<CEL
{host} == "${user.sanitized_id}.vps.acmcsuf.com" ||
{host}.endsWith(".${user.sanitized_id}.vps.acmcsuf.com")
CEL
handle @user${i} {
handle @user_${toString i} {
reverse_proxy * http://${user.ip}:80
}
'') config.acm.user-vms.usersInfo)) +
Expand Down
2 changes: 1 addition & 1 deletion servers/cs306/user-vms/vps.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h2>Users</h2>
<ul class="users-info-list">
<li class="url">
<b>Website URL:</b>
{{ $url := ($user.sanitized_id | printf "%s.vps.acmcsuf.com") }}
{{ $url := ($info.sanitized_id | printf "%s.vps.acmcsuf.com") }}
<a href="https://{{ $url }}" target="_blank">{{ $url }}</a>
</li>
<li class="discord">
Expand Down
2 changes: 1 addition & 1 deletion user-machines/vm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ in
acm.user-vms.usersInfo = imap0 (i: user: {
id = user.id;
ip = ips.ipFromOffset i;
sanitized_id = lib.toLower (builtins.replaceStrings ["."] ["_"] user.id);
sanitized_id = toLower (replaceStrings ["."] ["_"] user.id);
}) self.users;

virtualisation.libvirt.enable = true;
Expand Down

0 comments on commit 090915b

Please sign in to comment.