feat: vm setup

This commit is contained in:
2024-08-17 01:06:26 +08:00
parent f49c8a5a7a
commit c2d5ea6060
10 changed files with 249 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
{ config, meta, pkgs, ... }:
{
imports = [../common/users.nix];
nix = {
settings.experimental-features = ["nix-command" "flakes"];
};
networking.hostName = meta.hostname;
age.secrets.tailscale.file = ../secrets/tailscale.age;
services.tailscale = {
enable = true;
authKeyFile = config.age.secrets.tailscale.path;
extraUpFlags = [ "--login-server" "http://ts.yadunut.com:444" ];
};
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
services.openssh.enable = true;
services.qemuGuest.enable = true;
environment.systemPackages = with pkgs; [
git
neovim
wget
k3s
];
system.stateVersion = "24.11";
}

View File

@@ -0,0 +1,33 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
type = "EF00";
size = "500M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@@ -0,0 +1,23 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp6s18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}