From 8ef843fa94071b7f55584fba550b7602fe84e0d9 Mon Sep 17 00:00:00 2001 From: Fern Garden Date: Sun, 24 Aug 2025 20:55:23 +0800 Subject: [PATCH 1/5] First docker changes --- hosts/musicbrainz/default.nix | 18 ++++++++++-------- suites/server/docker/default.nix | 16 ++++++++++------ suites/server/vm/default.nix | 5 +---- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/hosts/musicbrainz/default.nix b/hosts/musicbrainz/default.nix index fd44584..b529bd9 100644 --- a/hosts/musicbrainz/default.nix +++ b/hosts/musicbrainz/default.nix @@ -1,18 +1,20 @@ -{pkgs, ...}: { +{pkgs, ...}: let + rootDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi2"; + rootPart = "/dev/disk/by-uuid/0804a690-0dbe-493d-9f2c-5db091569649"; + dockerPart = "/dev/disk/by-uuid/0eb05c79-7765-4b7e-bf22-c3a53f516db5"; +in { + boot.loader.grub.device = rootDisk; + fileSystems."/" = { - device = "/dev/disk/by-uuid/5d71cc16-f1ee-4b87-87b2-00fdf98442bd"; + device = rootPart; fsType = "ext4"; }; - fileSystems."/home/fern/docker/data" = { - device = "/dev/disk/by-uuid/0eb05c79-7765-4b7e-bf22-c3a53f516db5"; + fileSystems."/home/fern/docker" = { + device = dockerPart; fsType = "ext4"; }; - swapDevices = [ - {device = "/dev/disk/by-uuid/b2456f94-1a8b-4de4-bd49-a9909d7487ec";} - ]; - # Update Musicbrainz search indexes once a week. systemd.timers."musicbrainz-update-indexes" = { wantedBy = ["timers.target"]; diff --git a/suites/server/docker/default.nix b/suites/server/docker/default.nix index 4e43145..af46ad8 100644 --- a/suites/server/docker/default.nix +++ b/suites/server/docker/default.nix @@ -7,12 +7,16 @@ # Enable docker. virtualisation.docker = { enable = true; + autoPrune.enable = true; liveRestore = true; - daemon.settings.default-address-pools = [ - { - base = "172.20.0.0/12"; - size = 24; - } - ]; + daemon.settings = { + data-root = "/home/fern/docker/daemon"; + default-address-pools = [ + { + base = "172.20.0.0/12"; + size = 24; + } + ]; + }; }; } diff --git a/suites/server/vm/default.nix b/suites/server/vm/default.nix index 1cfb78f..22b57e7 100644 --- a/suites/server/vm/default.nix +++ b/suites/server/vm/default.nix @@ -16,10 +16,7 @@ boot.kernelModules = ["kvm-intel"]; # Configure the bootloader. - boot.loader.grub = { - enable = true; - device = "/dev/sda"; - }; + boot.loader.grub.enable = true; # Enable QEMU guest agent services.qemuGuest.enable = true; From fa8f67bc4b6361244c2cad0f12afe0f4c98919b6 Mon Sep 17 00:00:00 2001 From: Fern Garden Date: Sun, 24 Aug 2025 21:28:03 +0800 Subject: [PATCH 2/5] Disk paths --- hosts/musicbrainz/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts/musicbrainz/default.nix b/hosts/musicbrainz/default.nix index b529bd9..37d4fc7 100644 --- a/hosts/musicbrainz/default.nix +++ b/hosts/musicbrainz/default.nix @@ -1,6 +1,6 @@ {pkgs, ...}: let - rootDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi2"; - rootPart = "/dev/disk/by-uuid/0804a690-0dbe-493d-9f2c-5db091569649"; + rootDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0"; + rootPart = "/dev/disk/by-uuid/d90b9f44-42fb-4ccc-8b8d-05375d953742"; dockerPart = "/dev/disk/by-uuid/0eb05c79-7765-4b7e-bf22-c3a53f516db5"; in { boot.loader.grub.device = rootDisk; From c07ac78becf6732624678d3bf2bf64c6c83f3266 Mon Sep 17 00:00:00 2001 From: Fern Garden Date: Sun, 24 Aug 2025 22:13:47 +0800 Subject: [PATCH 3/5] Start on minecraft VM --- hosts/minecraft/default.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hosts/minecraft/default.nix b/hosts/minecraft/default.nix index ec2d423..349af5c 100644 --- a/hosts/minecraft/default.nix +++ b/hosts/minecraft/default.nix @@ -1,18 +1,20 @@ -{ +let + rootDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi2"; + rootPart = "f59330d9-0315-43c0-90a1-d9b13c6298f9"; + dockerPart = "/dev/disk/by-uuid/3730e48a-8784-4c49-8692-473c9b4bc8c3"; +in { + # Bootloader. + boot.loader.grub.device = rootDisk; + # Root filesystem. fileSystems."/" = { - device = "/dev/disk/by-uuid/cbd70e61-fcdc-4b1f-af03-d3da8a2866ea"; + device = rootPart; fsType = "ext4"; }; # Docker data directory. fileSystems."/home/fern/docker/data" = { - device = "/dev/disk/by-uuid/3730e48a-8784-4c49-8692-473c9b4bc8c3"; + device = dockerPart; fsType = "ext4"; }; - - # Swap. - swapDevices = [ - {device = "/dev/disk/by-uuid/45cafadd-90f2-4b65-82fc-60d59eb75786";} - ]; } From 20afd1b93e7c232f7d5c57e1f253edc519252c5c Mon Sep 17 00:00:00 2001 From: Fern Garden Date: Sun, 24 Aug 2025 22:35:48 +0800 Subject: [PATCH 4/5] Finish minecraft --- hosts/minecraft/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hosts/minecraft/default.nix b/hosts/minecraft/default.nix index 349af5c..9a15107 100644 --- a/hosts/minecraft/default.nix +++ b/hosts/minecraft/default.nix @@ -1,6 +1,6 @@ let - rootDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi2"; - rootPart = "f59330d9-0315-43c0-90a1-d9b13c6298f9"; + rootDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0"; + rootPart = "/dev/disk/by-uuid/f59330d9-0315-43c0-90a1-d9b13c6298f9"; dockerPart = "/dev/disk/by-uuid/3730e48a-8784-4c49-8692-473c9b4bc8c3"; in { # Bootloader. @@ -13,7 +13,7 @@ in { }; # Docker data directory. - fileSystems."/home/fern/docker/data" = { + fileSystems."/home/fern/docker" = { device = dockerPart; fsType = "ext4"; }; From d19c81dfb48b0d9c33fffc443b5a085c3928414c Mon Sep 17 00:00:00 2001 From: Fern Garden Date: Mon, 25 Aug 2025 16:22:40 +0800 Subject: [PATCH 5/5] docker.local --- hosts/docker/default.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hosts/docker/default.nix b/hosts/docker/default.nix index f9bf070..388e1de 100644 --- a/hosts/docker/default.nix +++ b/hosts/docker/default.nix @@ -1,21 +1,23 @@ -{pkgs, ...}: { +{pkgs, ...}: let + rootDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0"; + rootPart = "/dev/disk/by-uuid/5dc8ca3b-177a-458e-b8a8-89309168d0fc"; + dockerPart = "/dev/disk/by-uuid/95461a94-ad91-43b9-b502-2b5d4496b84e"; +in { + # Boot loader. + boot.loader.grub.device = rootDisk; + # Root filesystem. fileSystems."/" = { - device = "/dev/disk/by-uuid/cac60222-9b38-4938-8b17-5fddd67e8e26"; + device = rootPart; fsType = "ext4"; }; # Docker data directory fileSystems."/home/fern/docker/data" = { - device = "/dev/disk/by-uuid/95461a94-ad91-43b9-b502-2b5d4496b84e"; + device = dockerPart; fsType = "ext4"; }; - # Swap. - swapDevices = [ - {device = "/dev/disk/by-uuid/55dfb275-75de-4519-8f98-3491cefed32b";} - ]; - # Media HDDs. fileSystems."/mnt/hdd0" = { device = "/dev/disk/by-uuid/fcee0188-8ca1-4fda-81b7-f5920c79ab48"; @@ -35,8 +37,6 @@ # Install some packages. environment.systemPackages = with pkgs; [ mergerfs - ansible - (python3.withPackages (ps: [ps.ansible ps.pip ps.requests])) ]; # MergerFS.