fruitbasket/modules/vm.nix

44 lines
1.2 KiB
Nix
Raw Normal View History

2022-11-11 16:37:17 +01:00
{ config, lib, pkgs, buildVM, ... }:
{
assertions = [
{ assertion = buildVM; message = "this module may only be used when building a VM!"; }
];
users.users.root.hashedPassword = "";
2022-11-11 16:39:48 +01:00
users.users.root.initialPassword = "";
2022-11-11 16:37:17 +01:00
users.mutableUsers = false;
networking.useDHCP = lib.mkForce false;
networking.interfaces = lib.mkForce {
eth0.useDHCP = true;
};
networking.defaultGateway = lib.mkForce null;
2022-11-11 16:39:48 +01:00
sops.defaultSopsFile = lib.mkForce ../secrets/test.yaml;
2022-11-11 16:37:17 +01:00
sops.age.sshKeyPaths = lib.mkForce [ ];
sops.gnupg.sshKeyPaths = lib.mkForce [ ];
2022-11-11 16:39:48 +01:00
sops.age.keyFile = lib.mkForce "${../keys/test.age}";
2022-11-11 16:37:17 +01:00
sops.age.generateKey = lib.mkForce false;
2022-11-11 16:39:48 +01:00
2022-11-11 16:37:17 +01:00
# don't use production endpoint for test vm, to avoid rate limiting
security.acme.defaults.server = "https://acme-staging-v02.api.letsencrypt.org/directory";
# Set VM disk size (in MB)
virtualisation.diskSize = 2048;
# Set VM ram amount (in MB)
virtualisation.memorySize = 2048;
virtualisation.forwardPorts = [
{ from = "host"; host.port = 2222; guest.port = 22; }
];
virtualisation.graphics = false;
# show systemd logs on console
services.journald.extraConfig = ''
ForwardToConsole=yes
'';
}