add vm proxmox
This commit is contained in:
18
README.md
18
README.md
@@ -11,6 +11,8 @@ nixos-config/
|
|||||||
├── hosts/
|
├── hosts/
|
||||||
│ └── laptop/
|
│ └── laptop/
|
||||||
│ └── configuration.nix # Configuration matérielle spécifique au laptop
|
│ └── configuration.nix # Configuration matérielle spécifique au laptop
|
||||||
|
│ └── vmgaming/
|
||||||
|
│ └── configuration.nix # Configuration matérielle VM Proxmox (VMGaming)
|
||||||
└── modules/
|
└── modules/
|
||||||
├── laptop/ # Modules spécifiques au laptop
|
├── laptop/ # Modules spécifiques au laptop
|
||||||
│ ├── default.nix # Secrets management (sops-nix) et config de base
|
│ ├── default.nix # Secrets management (sops-nix) et config de base
|
||||||
@@ -112,11 +114,27 @@ cd ~/src/nixos-config
|
|||||||
nixos-rebuild build --flake .#laptop
|
nixos-rebuild build --flake .#laptop
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Build et test de la VM gaming (Proxmox)
|
||||||
|
```bash
|
||||||
|
cd ~/src/nixos-config
|
||||||
|
nixos-rebuild build --flake .#VMGaming
|
||||||
|
```
|
||||||
|
|
||||||
### Activer la configuration
|
### Activer la configuration
|
||||||
```bash
|
```bash
|
||||||
sudo nixos-rebuild switch --flake .#laptop
|
sudo nixos-rebuild switch --flake .#laptop
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Activer la configuration VM gaming
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake .#VMGaming
|
||||||
|
```
|
||||||
|
|
||||||
|
### GPU passthrough pour VMGaming
|
||||||
|
- La configuration `VMGaming` est optimisée pour une VM Proxmox avec GPU passthrough.
|
||||||
|
- Le profil actuel active les drivers **NVIDIA** dans `configuration-vmgaming.nix`.
|
||||||
|
- Si tu passes une carte AMD, remplace `services.xserver.videoDrivers = [ "nvidia" ];` par `services.xserver.videoDrivers = [ "amdgpu" ];` et retire le bloc `hardware.nvidia`.
|
||||||
|
|
||||||
### Mettre à jour les inputs
|
### Mettre à jour les inputs
|
||||||
```bash
|
```bash
|
||||||
nix flake update
|
nix flake update
|
||||||
|
|||||||
71
configuration-vmgaming.nix
Normal file
71
configuration-vmgaming.nix
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hosts/vmgaming/configuration.nix
|
||||||
|
|
||||||
|
./modules/nixos/base.nix
|
||||||
|
./modules/nixos/desktop-i3.nix
|
||||||
|
./modules/nixos/parsec.nix
|
||||||
|
|
||||||
|
./modules/laptop/users.nix
|
||||||
|
./modules/laptop/gaming.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "VMGaming";
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
# Proxmox VM: boot in UEFI mode without touching host EFI variables.
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
efiSupport = true;
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
device = "nodev";
|
||||||
|
};
|
||||||
|
boot.loader.efi.canTouchEfiVariables = false;
|
||||||
|
|
||||||
|
services.spice-vdagentd.enable = true;
|
||||||
|
services.qemuGuest.enable = true;
|
||||||
|
|
||||||
|
# Gaming VM guest optimizations
|
||||||
|
programs.gamemode.enable = true;
|
||||||
|
programs.gamescope.enable = true;
|
||||||
|
security.rtkit.enable = true;
|
||||||
|
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
alsa.support32Bit = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
};
|
||||||
|
services.pulseaudio.enable = false;
|
||||||
|
|
||||||
|
hardware.graphics = {
|
||||||
|
enable = true;
|
||||||
|
enable32Bit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# NVIDIA passthrough guest defaults.
|
||||||
|
# If you pass through an AMD GPU instead, replace with:
|
||||||
|
# services.xserver.videoDrivers = [ "amdgpu" ];
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
hardware.nvidia = {
|
||||||
|
modesetting.enable = true;
|
||||||
|
powerManagement.enable = false;
|
||||||
|
open = false;
|
||||||
|
nvidiaSettings = true;
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
|
};
|
||||||
|
|
||||||
|
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
mangohud
|
||||||
|
goverlay
|
||||||
|
vkbasalt
|
||||||
|
gamemode
|
||||||
|
];
|
||||||
|
|
||||||
|
custom.gaming.enable = true;
|
||||||
|
custom.gaming.enableXpadneo = false;
|
||||||
|
}
|
||||||
12
flake.nix
12
flake.nix
@@ -52,5 +52,17 @@
|
|||||||
claude-desktop = claude-desktop;
|
claude-desktop = claude-desktop;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixosConfigurations.VMGaming = nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
./configuration-vmgaming.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
specialArgs = {
|
||||||
|
inherit customConfig;
|
||||||
|
parsec-cloud-nix = parsec-cloud-nix;
|
||||||
|
claude-desktop = claude-desktop;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
33
hosts/vmgaming/configuration.nix
Normal file
33
hosts/vmgaming/configuration.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Do not modify this file directly on every rebuild. It should contain host
|
||||||
|
# specific hardware/VM configuration for VMGaming (Proxmox guest).
|
||||||
|
{ lib, modulesPath, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sr_mod" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
# Update these labels to match your VM disks if they differ.
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-label/nixos";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-label/boot";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [ "fmask=0077" "dmask=0077" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [ ];
|
||||||
|
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
services.qemuGuest.enable = true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user