nixos/hosts/nixos-test/configuration.nix

84 lines
1.7 KiB
Nix
Raw Normal View History

2023-08-20 00:48:31 +02:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
2024-10-28 21:20:06 +01:00
{ ... }:
2023-08-20 00:48:31 +02:00
{
imports =
[
../../modules/system
2023-08-20 00:48:31 +02:00
# Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader = {
grub = {
enable = true;
device = "/dev/vda";
efiSupport = false;
useOSProber = true;
};
};
networking.hostName = "nixos-vm"; # Define your hostname.
2024-05-24 23:31:04 +02:00
users.users.florian.initialPassword = "test";
# Configure for testing in vm
2024-05-24 23:31:04 +02:00
virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm
virtualisation = {
memorySize = 8192; # Use 8192MiB memory.
2024-10-25 14:59:46 +02:00
cores = 8;
forwardPorts = [
{ from = "host"; host.port = 8888; guest.port = 80; }
];
sharedDirectories = {
home = {
source = "/home/florian";
target = "/mnt/shared_home";
};
};
2024-05-24 23:31:04 +02:00
};
};
modules.system = {
server = {
docker.enable = true;
openssh.enable = true;
};
desktop = {
plasma = {
enable = true;
};
};
hardware = {
keymaps.layout = "us";
2024-10-25 14:46:44 +02:00
};
};
# Run containers
virtualisation.oci-containers.containers."hello" = {
image = "docker.io/nginxdemos/hello:latest";
ports = [
"9000:80/tcp"
];
};
services.nginx = {
enable = true;
virtualHosts."hello.local" = {
locations."/" = {
proxyPass = "http://127.0.0.1:9000";
};
};
};
2024-10-25 14:59:46 +02:00
networking.firewall.allowedTCPPorts = [ 80 ]; # Opens port 80 for HTTP traffic.
2023-08-20 00:48:31 +02:00
}