Add vm config

This commit is contained in:
Fern Garden 2025-07-02 13:36:02 +08:00
parent 4b28169cbe
commit 90906c8209
3 changed files with 97 additions and 1 deletions

87
configuration/vm.nix Executable file
View file

@ -0,0 +1,87 @@
{
pkgs,
...
}:
{
# NixOS version.
system.stateVersion = "25.05";
# Enable flakes.
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Allow unfree packages.
nixpkgs.config.allowUnfree = true;
# Configure the bootloader.
boot.loader.grub = {
enable = true;
device = "/dev/sda";
};
# Set time zone.
time.timeZone = "Australia/Perth";
# Select internationalisation properties.
i18n.defaultLocale = "en_AU.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_AU.UTF-8";
LC_IDENTIFICATION = "en_AU.UTF-8";
LC_MEASUREMENT = "en_AU.UTF-8";
LC_MONETARY = "en_AU.UTF-8";
LC_NAME = "en_AU.UTF-8";
LC_NUMERIC = "en_AU.UTF-8";
LC_PAPER = "en_AU.UTF-8";
LC_TELEPHONE = "en_AU.UTF-8";
LC_TIME = "en_AU.UTF-8";
};
# Configure keymap in X11.
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Define a user account.
users.users.docker = {
isNormalUser = true;
extraGroups = [
"wheel"
"docker"
];
};
# Install some packages.
programs.git.enable = true;
programs.neovim = {
enable = true;
defaultEditor = true; # Use neovim as default terminal editor.
configure = {
customRC = ''
set expandtab
set shiftwidth=2
set tabstop=8
set softtabstop=2
set number
colorscheme kanagawa-dragon
'';
packages.myVimPackage = with pkgs.vimPlugins; {
start = [ kanagawa-nvim ];
};
};
};
# Enable SSH server
services.openssh.enable = true;
# Enable avahi hostname resolution.
services.avahi = {
enable = true;
nssmdns4 = true;
};
}

View file

@ -34,9 +34,18 @@
lanzaboote.nixosModules.lanzaboote lanzaboote.nixosModules.lanzaboote
nixos-hardware.nixosModules.lenovo-thinkpad-t480 nixos-hardware.nixosModules.lenovo-thinkpad-t480
./configuration.nix ./configuration/desktop.nix
./hardware-configuration/muskduck.nix # Include the results of the hardware scan. ./hardware-configuration/muskduck.nix # Include the results of the hardware scan.
]; ];
}; };
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration/vm.nix
./hardware-configuration/vm.nix # Include the results of the hardware scan.
];
};
}; };
} }