nixos-config/terranix/workadventure-jitsi-setup/config.nix

50 lines
1.4 KiB
Nix
Raw Normal View History

2020-12-30 01:18:37 +01:00
{ config, lib, pkgs, ... }:
let
hcloud-modules = pkgs.fetchgit {
url = "https://github.com/mrVanDalo/terranix-hcloud.git";
rev = "5fa359a482892cd973dcc6ecfc607f4709f24495";
sha256 = "0smgmdiklj98y71fmcdjsqjq8l41i66hs8msc7k4m9dpkphqk86p";
};
2021-11-01 19:30:41 +01:00
in
{
2020-12-30 01:18:37 +01:00
imports = [ "${hcloud-modules}/default.nix" ];
2020-12-31 02:51:13 +01:00
# configure temporary admin ssh keys
2020-12-30 01:18:37 +01:00
users.admins.palo.publicKey = "${lib.fileContents ./sshkey.pub}";
# configure provisioning private Key to be used when running provisioning on the machines
provisioner.privateKeyFile = toString ./sshkey;
hcloud.nixserver = {
host = {
enable = true;
serverType = "cx51"; # 35€/month
configurationFile = pkgs.writeText "configuration.nix" ''
{ pkgs, lib, config, ... }:
{
environment.systemPackages = [ pkgs.git ];
}
'';
};
};
hcloud.export.nix = toString ./plops/generated/nixos-machines.nix;
resource.local_file.sshConfig = {
filename = "${toString ./plops/generated/ssh-configuration}";
content = with lib;
let
configPart = name: ''
Host ''${ hcloud_server.nixserver-${name}.ipv4_address }
IdentityFile ${toString ./sshkey}
ServerAliveInterval 60
ServerAliveCountMax 3
'';
2021-11-01 19:30:41 +01:00
in
concatStringsSep "\n"
(map configPart (attrNames config.hcloud.nixserver));
2020-12-30 01:18:37 +01:00
};
}