Creating kvm test server
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
system.stateVersion = "25.11";
|
||||
|
||||
system.stateVersion = "25.05";
|
||||
|
||||
imports = [
|
||||
./disk-config.nix
|
||||
./hardware-configuration.nix
|
||||
@@ -83,6 +83,7 @@
|
||||
pkgs.nixos-anywhere
|
||||
pkgs.nixos-generators
|
||||
pkgs.ssh-to-age
|
||||
pkgs.htop
|
||||
];
|
||||
|
||||
services.openssh.enable = true;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
device = "/dev/vda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
@@ -23,42 +23,88 @@
|
||||
};
|
||||
SYS = {
|
||||
size = "100%";
|
||||
type = "8309";
|
||||
type = "8300";
|
||||
name = "SYS";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "rootfs";
|
||||
settings = {
|
||||
allowDiscards = true;
|
||||
};
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f --nodiscard --label root" ];
|
||||
subvolumes = {
|
||||
"@" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ];
|
||||
};
|
||||
"@root" = {
|
||||
mountpoint = "/root";
|
||||
mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ];
|
||||
};
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ];
|
||||
};
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ];
|
||||
};
|
||||
"@var" = {
|
||||
mountpoint = "/var";
|
||||
mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ];
|
||||
};
|
||||
"@games" = {
|
||||
mountpoint = "/games";
|
||||
mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ];
|
||||
};
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f --nodiscard --label root" ];
|
||||
subvolumes = {
|
||||
"@" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@root" = {
|
||||
mountpoint = "/root";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@var" = {
|
||||
mountpoint = "/var";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@data" = {
|
||||
mountpoint = "/games";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@backups" = {
|
||||
mountpoint = "/games";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{
|
||||
pkgs,
|
||||
username,
|
||||
hostname,
|
||||
modulesPath,
|
||||
inputs,
|
||||
@@ -8,7 +6,7 @@
|
||||
}:
|
||||
{
|
||||
system.stateVersion = "25.11";
|
||||
|
||||
|
||||
imports = builtins.trace "${inputs.mysecrets}" [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./disk-config.nix
|
||||
@@ -16,4 +14,4 @@
|
||||
../../modules/core
|
||||
../../modules/optionnals/hosts/${hostname}.nix
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,50 +7,13 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
system.stateVersion = "25.11";
|
||||
system.stateVersion = "25.05";
|
||||
|
||||
imports = builtins.trace "${inputs.mysecrets}" [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./network.nix
|
||||
./disk-config.nix
|
||||
./hardware-configuration.nix
|
||||
../../modules/core
|
||||
../../modules/optionnals/hosts/${hostname}.nix
|
||||
];
|
||||
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
time.timeZone = "Europe/Paris";
|
||||
|
||||
nix = {
|
||||
settings = {
|
||||
## Enable flakes
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
## Users trusted to use flake command
|
||||
trusted-users = [
|
||||
"root"
|
||||
"${username}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
## Enable virtualisation guest settings
|
||||
services.qemuGuest.enable = true;
|
||||
services.spice-vdagentd.enable = true;
|
||||
services.xserver = {
|
||||
videoDrivers = [ "modesetting" ]; # Driver vidéo optimisé pour QEMU/KVM
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.spice-gtk # Outils SPICE
|
||||
pkgs.spice-protocol # Protocoles SPICE
|
||||
];
|
||||
|
||||
#fileSystems."/" = {
|
||||
# device = "/dev/vda2"; # Disque virtuel typique
|
||||
# fsType = "btrfs";
|
||||
#};
|
||||
}
|
||||
|
||||
@@ -10,22 +10,103 @@
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
EFI = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
name = "EFI";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
SYS = {
|
||||
size = "100%";
|
||||
type = "8300";
|
||||
name = "SYS";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "btrfs";
|
||||
mountpoint = "/";
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f --nodiscard --label root" ];
|
||||
subvolumes = {
|
||||
"@" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@root" = {
|
||||
mountpoint = "/root";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@var" = {
|
||||
mountpoint = "/var";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@data" = {
|
||||
mountpoint = "/games";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
"@backups" = {
|
||||
mountpoint = "/games";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
"ssd"
|
||||
"compress=zstd"
|
||||
"autodefrag"
|
||||
"noatime"
|
||||
"nodiscard"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,38 +1,16 @@
|
||||
# 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,
|
||||
...
|
||||
}:
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ahci"
|
||||
"xhci_pci"
|
||||
"virtio_pci"
|
||||
"sr_mod"
|
||||
"virtio_blk"
|
||||
"virtio_scsi"
|
||||
"virtio_net"
|
||||
"virtio_blk"
|
||||
];
|
||||
boot.initrd.kernelModules = [
|
||||
"virtio_balloon"
|
||||
"virtio_console"
|
||||
"virtio_rng"
|
||||
];
|
||||
boot.kernelModules = [
|
||||
"kvm-intel"
|
||||
"virtio-gpu"
|
||||
];
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{
|
||||
pkgs,
|
||||
username,
|
||||
hostname,
|
||||
modulesPath,
|
||||
inputs,
|
||||
|
||||
Reference in New Issue
Block a user