87 lines
2.0 KiB
Nix
87 lines
2.0 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
let
|
|
cfg = config.modules.profiles.vm;
|
|
in
|
|
{
|
|
options.modules.profiles.vm = {
|
|
enable = mkEnableOption "Base VM profile";
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
# Enabled modules
|
|
modules = {
|
|
profiles.base.enable = true;
|
|
disko = {
|
|
enable = true;
|
|
profile = "vm";
|
|
};
|
|
impermanence = {
|
|
enable = true;
|
|
resetScript = ''
|
|
# Revert to the blank state for the root directory
|
|
zfs rollback -r tank/root@blank
|
|
'';
|
|
};
|
|
ssh.enable = true;
|
|
};
|
|
|
|
# Local user
|
|
modules.secrets.secrets."passwords/local-hashed".neededForUsers = true;
|
|
services.getty.autologinUser = "local";
|
|
security.sudo.wheelNeedsPassword = false;
|
|
users.mutableUsers = false;
|
|
users.users.local = {
|
|
hashedPasswordFile = config.sops.secrets."passwords/local-hashed".path;
|
|
extraGroups = [ "wheel" ];
|
|
openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq Admin"
|
|
];
|
|
};
|
|
|
|
# System packages
|
|
environment.systemPackages = with pkgs; [
|
|
# TODO: Make module for utilities/scripts
|
|
(writeShellScriptBin "system-update" "nixos-rebuild switch --flake git+https://git.bulthuis.dev/Jan/nixos-config")
|
|
];
|
|
|
|
# Enable qemu guest agent
|
|
services.qemuGuest.enable = true;
|
|
|
|
# Machine platform
|
|
nixpkgs.hostPlatform = "x86_64-linux";
|
|
|
|
# Set hostid for ZFS
|
|
networking.hostId = "deadbeef";
|
|
|
|
# Hardware configuration
|
|
hardware.enableRedistributableFirmware = true;
|
|
boot.initrd.availableKernelModules = [
|
|
"ata_piix"
|
|
"uhci_hcd"
|
|
"virtio_pci"
|
|
"virtio_scsi"
|
|
"sd_mod"
|
|
"sr_mod"
|
|
];
|
|
boot.initrd.kernelModules = [ ];
|
|
boot.kernelModules = [ "kvm-intel" ];
|
|
boot.extraModulePackages = [ ];
|
|
hardware.cpu.intel.updateMicrocode = true;
|
|
|
|
# Swapfile
|
|
swapDevices = [
|
|
{
|
|
device = "/var/lib/swapfile";
|
|
size = 6 * 1024;
|
|
}
|
|
];
|
|
};
|
|
}
|