Move defaults/base-vm to nixos-modules/system/virtual-machine.nix
This commit is contained in:
parent
94510a8cd9
commit
24b4b04df9
7 changed files with 66 additions and 42 deletions
|
@ -1,38 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
modulesPath,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.loader.grub.enable = true;
|
|
||||||
|
|
||||||
system.autoUpgrade.allowReboot = true;
|
|
||||||
|
|
||||||
services.qemuGuest.enable = true;
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
|
||||||
"ahci"
|
|
||||||
"xhci_pci"
|
|
||||||
"sr_mod"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Taken from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/minimal.nix
|
|
||||||
documentation.enable = lib.mkDefault false;
|
|
||||||
|
|
||||||
documentation.doc.enable = lib.mkDefault false;
|
|
||||||
|
|
||||||
documentation.info.enable = lib.mkDefault false;
|
|
||||||
|
|
||||||
documentation.man.enable = lib.mkDefault false;
|
|
||||||
|
|
||||||
documentation.nixos.enable = lib.mkDefault false;
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../defaults/base-vm
|
|
||||||
../../defaults/meta
|
../../defaults/meta
|
||||||
|
|
||||||
./applications
|
./applications
|
||||||
|
@ -10,6 +9,7 @@
|
||||||
./networking.nix
|
./networking.nix
|
||||||
./secrets.nix
|
./secrets.nix
|
||||||
];
|
];
|
||||||
|
qois.system.virtual-machine.enable = true;
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "Europe/Amsterdam";
|
time.timeZone = "Europe/Amsterdam";
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../defaults/base-vm
|
|
||||||
../../defaults/meta
|
../../defaults/meta
|
||||||
./applications
|
./applications
|
||||||
./backup.nix
|
./backup.nix
|
||||||
./secrets.nix
|
./secrets.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
qois.system.virtual-machine.enable = true;
|
||||||
|
|
||||||
boot.loader.grub.device = "/dev/vda";
|
boot.loader.grub.device = "/dev/vda";
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
device = "/dev/disk/by-uuid/5b6823ec-921f-400a-a7c0-3fe34d56ae12";
|
device = "/dev/disk/by-uuid/5b6823ec-921f-400a-a7c0-3fe34d56ae12";
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../../defaults/base-vm
|
|
||||||
../../defaults/meta
|
../../defaults/meta
|
||||||
|
|
||||||
./applications
|
./applications
|
||||||
|
@ -11,6 +10,8 @@
|
||||||
./secrets.nix
|
./secrets.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
qois.system.virtual-machine.enable = true;
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "Europe/Amsterdam";
|
time.timeZone = "Europe/Amsterdam";
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ let
|
||||||
in
|
in
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
|
|
||||||
options.qois.cloud = {
|
options.qois.cloud = {
|
||||||
enable = mkEnableOption "Enable qois cloud service";
|
enable = mkEnableOption "Enable qois cloud service";
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,11 @@
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./unfree.nix
|
|
||||||
./applications.nix
|
./applications.nix
|
||||||
./overlays.nix
|
./overlays.nix
|
||||||
./security.nix
|
./security.nix
|
||||||
|
./unfree.nix
|
||||||
|
./virtual-machine.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.loader.timeout = 2;
|
boot.loader.timeout = 2;
|
||||||
|
|
58
nixos-modules/system/virtual-machine.nix
Normal file
58
nixos-modules/system/virtual-machine.nix
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.qois.system.virtual-machine;
|
||||||
|
in
|
||||||
|
with lib;
|
||||||
|
{
|
||||||
|
options.qois.system.virtual-machine.enable =
|
||||||
|
mkEnableOption "Enable qois system vm default configuration";
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
|
boot.loader.grub.enable = true;
|
||||||
|
|
||||||
|
system.autoUpgrade.allowReboot = true;
|
||||||
|
|
||||||
|
services.qemuGuest.enable = true;
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules =
|
||||||
|
[
|
||||||
|
"ahci"
|
||||||
|
"xhci_pci"
|
||||||
|
"sr_mod"
|
||||||
|
]
|
||||||
|
++
|
||||||
|
# Taken from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/qemu-guest.nix
|
||||||
|
[
|
||||||
|
"virtio_net"
|
||||||
|
"virtio_pci"
|
||||||
|
"virtio_mmio"
|
||||||
|
"virtio_blk"
|
||||||
|
"virtio_scsi"
|
||||||
|
"9p"
|
||||||
|
"9pnet_virtio"
|
||||||
|
];
|
||||||
|
boot.initrd.kernelModules = [
|
||||||
|
"virtio_balloon"
|
||||||
|
"virtio_console"
|
||||||
|
"virtio_rng"
|
||||||
|
"virtio_gpu"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Taken from https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/minimal.nix
|
||||||
|
documentation.enable = lib.mkDefault false;
|
||||||
|
|
||||||
|
documentation.doc.enable = lib.mkDefault false;
|
||||||
|
|
||||||
|
documentation.info.enable = lib.mkDefault false;
|
||||||
|
|
||||||
|
documentation.man.enable = lib.mkDefault false;
|
||||||
|
|
||||||
|
documentation.nixos.enable = lib.mkDefault false;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue