mirror of
https://github.com/moons-14/dotfiles.git
synced 2026-10-07 08:34:07 +09:00
nix-builder disko
This commit is contained in:
@@ -653,7 +653,8 @@ A host registry may use a specification like this:
|
|||||||
|
|
||||||
The current role assignment is intentional: nix-example is the development VM;
|
The current role assignment is intentional: nix-example is the development VM;
|
||||||
ops is the remote-access VM with host-specific static networking;
|
ops is the remote-access VM with host-specific static networking;
|
||||||
internal-app-01 is the container server VM; and installer builds the minimal
|
internal-app-01 is the container server VM; nix-builder is the remote Nix build
|
||||||
|
VM with dedicated build and store disks; and installer builds the minimal
|
||||||
installation ISO without Home Manager. x1g9 is a full NixOS desktop with niri,
|
installation ISO without Home Manager. x1g9 is a full NixOS desktop with niri,
|
||||||
labwc, ly, the shared Linux desktop applications, and the personal workload.
|
labwc, ly, the shared Linux desktop applications, and the personal workload.
|
||||||
x1g13 is the secure NixOS development and personal ThinkPad, with the same
|
x1g13 is the secure NixOS development and personal ThinkPad, with the same
|
||||||
@@ -692,6 +693,10 @@ configuration fragments. For example:
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
hosts/
|
hosts/
|
||||||
|
├── nix-builder/
|
||||||
|
│ ├── disko.nix
|
||||||
|
│ ├── hardware-configuration.nix
|
||||||
|
│ └── nixos.nix
|
||||||
├── installer/
|
├── installer/
|
||||||
│ └── nixos.nix
|
│ └── nixos.nix
|
||||||
├── internal-app-01/
|
├── internal-app-01/
|
||||||
@@ -721,12 +726,15 @@ hosts/
|
|||||||
```
|
```
|
||||||
|
|
||||||
`hosts/x1g9/nixos.nix` explicitly loads `hardware-configuration.nix` with the
|
`hosts/x1g9/nixos.nix` explicitly loads `hardware-configuration.nix` with the
|
||||||
normal top-level Nix module `imports`. `hosts/x1g13/nixos.nix` loads its
|
normal top-level Nix module `imports`. `hosts/nix-builder/nixos.nix` and
|
||||||
generated hardware configuration and host-local `disko.nix` the same way. Do
|
`hosts/x1g13/nixos.nix` load their generated hardware configuration and
|
||||||
not confuse these host imports with the prohibition on top-level `imports` in
|
host-local `disko.nix` the same way. The nix-builder Disko definition mounts its
|
||||||
unit configuration fragments. `hosts/galleria/disko.nix` manages only the two
|
existing VM filesystems by stable QEMU SCSI IDs and does not take destructive
|
||||||
dedicated NixOS partitions by PARTUUID and deliberately excludes the Windows
|
ownership of them. Do not confuse these host imports with the prohibition on
|
||||||
disk, Windows partitions, and the Windows EFI System Partition.
|
top-level `imports` in unit configuration fragments. `hosts/galleria/disko.nix`
|
||||||
|
manages only the two dedicated NixOS partitions by PARTUUID and deliberately
|
||||||
|
excludes the Windows disk, Windows partitions, and the Windows EFI System
|
||||||
|
Partition.
|
||||||
|
|
||||||
Derive the system class from the host's `system`:
|
Derive the system class from the host's `system`:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
_:
|
||||||
|
let
|
||||||
|
osDisk = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
disko.enableConfig = true;
|
||||||
|
|
||||||
|
# The VM disks already contain live filesystems. Model each existing
|
||||||
|
# filesystem without giving Disko ownership of their partitioning or data.
|
||||||
|
disko.devices.disk = {
|
||||||
|
boot = {
|
||||||
|
type = "disk";
|
||||||
|
device = "${osDisk}-part1";
|
||||||
|
destroy = false;
|
||||||
|
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
root = {
|
||||||
|
type = "disk";
|
||||||
|
device = "${osDisk}-part2";
|
||||||
|
destroy = false;
|
||||||
|
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nix-build = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1";
|
||||||
|
destroy = false;
|
||||||
|
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/var/lib/nix-build";
|
||||||
|
mountOptions = [ "noatime" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nix-store = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi2";
|
||||||
|
destroy = false;
|
||||||
|
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/nix/store";
|
||||||
|
mountOptions = [ "noatime" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/nix/store".neededForBoot = true;
|
||||||
|
nix.settings.build-dir = "/var/lib/nix-build";
|
||||||
|
services.fstrim.enable = true;
|
||||||
|
}
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
fileSystems."/nix/store" = {
|
|
||||||
device = "/dev/disk/by-label/nix-store";
|
|
||||||
fsType = "ext4";
|
|
||||||
|
|
||||||
options = [
|
|
||||||
"noatime"
|
|
||||||
];
|
|
||||||
|
|
||||||
neededForBoot = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/var/lib/nix-build" = {
|
|
||||||
device = "/dev/disk/by-label/nix-build";
|
|
||||||
fsType = "ext4";
|
|
||||||
|
|
||||||
options = [
|
|
||||||
"noatime"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
nix.settings.build-dir = "/var/lib/nix-build";
|
|
||||||
|
|
||||||
services.fstrim.enable = true;
|
|
||||||
}
|
|
||||||
@@ -20,20 +20,6 @@
|
|||||||
boot.kernelModules = [ ];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-uuid/49fc2e1c-7909-41cc-ac78-55b4d9a01e62";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-uuid/40D4-ABBE";
|
|
||||||
fsType = "vfat";
|
|
||||||
options = [
|
|
||||||
"fmask=0077"
|
|
||||||
"dmask=0077"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [ ];
|
swapDevices = [ ];
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./filesystem.nix
|
./disko.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user