Initial virtualisation server setup

This commit is contained in:
Erwin Boskma 2023-01-17 13:45:37 +01:00
parent b89bc56846
commit dac5c2a1a8
Signed by: erwin
SSH key fingerprint: SHA256:CyeNoWXd3kjX2Nwu6pDxxdS7OqmPVOy0NavA/KU/ntU
7 changed files with 205 additions and 15 deletions

View file

@ -24,6 +24,26 @@
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1673488360,
"narHash": "sha256-oqYrGBGA3HfZD9E2LSa+WHGJy40DfHgc3Z3oe0Mnstk=",
"owner": "nix-community",
"repo": "disko",
"rev": "d4ad9595432959440984b2ba33064cfe3399d0e3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"emacs-overlay": {
"inputs": {
"flake-utils": [
@ -34,11 +54,11 @@
]
},
"locked": {
"lastModified": 1673602276,
"narHash": "sha256-MdtgFTSRTxWQtZAsv061haJh1iRKwORtUl2V6vWA9CY=",
"lastModified": 1673630223,
"narHash": "sha256-0ZmQaImsdtJ8KKIuV0BuxM85nKE7FtagrV3ACuuf4k4=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "0e8abd1a198a954a1206b0306c10285da76a1d1a",
"rev": "b14ac8cc285517482b2fd8e20db355a3980f59f0",
"type": "github"
},
"original": {
@ -179,11 +199,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1673526825,
"narHash": "sha256-GukJtWwrkkf3ApkBTc7tW7DcsS1gKHWWs7OJYnv9om8=",
"lastModified": 1673609484,
"narHash": "sha256-kVaUV1RZ6k4/Re2/IEsnwz/SVhU4ptWrpVbE1qArSY8=",
"owner": "Hyprwm",
"repo": "Hyprland",
"rev": "cbd31ba481c5be65e015647851eef4b396869073",
"rev": "9c77415cda40eb334dd9306c504c0003dc14b53f",
"type": "github"
},
"original": {
@ -378,11 +398,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1673281605,
"narHash": "sha256-v6U0G3pJe0YaIuD1Ijhz86EhTgbXZ4f/2By8sLqFk4c=",
"lastModified": 1673627351,
"narHash": "sha256-oppRxEg/7ICcG67ErBvu1UlXt3su6zMcNoQmKaHPs5I=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "f8992fb404c7e79638192a10905b7ea985818050",
"rev": "496e4505c2ddf5f205242eae8064d7d89cd976c0",
"type": "github"
},
"original": {
@ -394,6 +414,7 @@
"root": {
"inputs": {
"deploy-rs": "deploy-rs",
"disko": "disko",
"emacs-overlay": "emacs-overlay",
"flake-utils": "flake-utils",
"ha-now-playing": "ha-now-playing",

View file

@ -59,6 +59,11 @@
inputs.rust-overlay.follows = "rust-overlay";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nomachine = {
url = "github:rytec-nl/nixpkgs/submit/add-nomachine-server";
};

View file

@ -21,6 +21,9 @@ inputs: {
minio = {
config = import ./minio/configuration.nix inputs;
};
odin = {
config = import ./odin/configuration.nix inputs;
};
proxy = {
config = import ./proxy/configuration.nix inputs;
};

View file

@ -0,0 +1,57 @@
{ nixos-hardware, disko, ... }:
{ modulesPath, ... }:
{
imports = [
"${modulesPath}/nixos/virtualisation/qemu-guest-agent.nix"
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-pc-ssd
disko.nixosModules.disko
./storage.nix
];
eboskma = {
users.erwin = {
enable = true;
};
base = {
plymouth.enable = true;
};
nix-common = {
enable = true;
remote-builders = true;
};
# libvirt.enable = true;
systemd.enable = true;
};
networking.hostName = "odin";
boot = {
loader = {
systemd-boot = {
enable = true;
configurationLimit = 10;
};
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
kernelModules = [ ];
};
kernelModules = [ "kvm-intel" ];
};
hardware.enableAllFirmware = true;
services.qemuGuest = {
enable = true;
};
}

104
machines/odin/storage.nix Normal file
View file

@ -0,0 +1,104 @@
{ disko, ... }:
{
disko.devices = {
disk = {
sda = {
device = "/dev/vda";
type = "disk";
content = {
type = "table";
format = "gpt";
partitions = [
{
type = "partition";
name = "boot";
start = "1MiB";
end = "512MiB";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
}
{
type = "partition";
name = "root_pv_sda";
start = "512MiB";
end = "100%";
content = {
type = "lvm_pv";
vg = "pool";
};
}
];
};
};
sdb = {
device = "/dev/sdb";
type = "disk";
content = {
type = "table";
format = "gpt";
partitions = [
{
type = "partition";
name = "root_pv_sdb";
start = "0%";
end = "100%";
content = {
type = "lvm_pv";
vg = "pool";
};
}
];
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "32GiB";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [ "defaults" ];
};
};
swap = {
size = "8GiB";
content = {
type = "swap";
randomEncryption = false;
};
};
data = {
size = "100%FREE";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/data";
mountOptions = [ "defaults" ];
};
};
};
};
};
};
# fileSystems."/" = {
# device = "/dev/disk/by-label/nixos";
# fsType = "ext4";
# };
# fileSystems."/data" = {
# device = "/dev/disk/by-label/data";
# fsType = "btrfs";
# };
}

View file

@ -11,11 +11,11 @@ stdenv.mkDerivation {
phases = [ "installPhase" ];
installPhase = ''
install -Dm 0644 *.png $out/share/plymouth/themes/nixos-blur/images/
install -Dm 0644 nixos-blur.script $out/share/plymouth/themes/nixos-blur/
install -Dm 0644 nixos-blur.plymouth $out/share/plymouth/themes/nixos-blur/
sed -i 's/@OUT@/${placeholder "out"}/' $out/share/plymouth/themes/nixos-blur/nixos-blur.plymouth
install -Dm 0644 -t $out/share/plymouth/themes/nixos-blur/images/ $src/*.png
install -Dm 0644 $src/nixos-blur.script $out/share/plymouth/themes/nixos-blur/nixos-blur.script
install -Dm 0644 $src/nixos-blur.plymouth $out/share/plymouth/themes/nixos-blur/nixos-blur.plymouth
'';
# substituteInPlace $out/share/plymouth/themes/nixos-blur/nixos-blur.plymouth --replace '@OUT@' $out
meta = with lib; {
description = "Plymouth theme nixos-blur";

View file

@ -5,5 +5,5 @@ Comment=created By Gurkan (gurkan.in)
ModuleName=script
[script]
ImageDir=@OUT@/plymouth/themes/nixos-blur/images
ScriptFile=@OUT@/plymouth/themes/nixos-blur/nixos-blur.script
ImageDir=/etc/plymouth/themes/nixos-blur/images
ScriptFile=/etc/plymouth/themes/nixos-blur/nixos-blur.script