diff --git a/flake.nix b/flake.nix index 178f7f6e..bc01533f 100644 --- a/flake.nix +++ b/flake.nix @@ -2,9 +2,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; snf.url = "git+https://git.fediversity.eu/fediversity/simple-nixos-fediverse.git"; + disko.url = "github:nix-community/disko"; }; - outputs = { self, nixpkgs, snf }: + outputs = { self, nixpkgs, snf, disko }: let vmName = "vm02186"; @@ -14,11 +15,16 @@ modules = [ ./procolix-configuration.nix - ./hardware-configuration.nix ./gitea-runner.nix + + ## Hardware configuration + disko.nixosModules.default + ./hardware-configuration.nix ]; }; + ## An ISO that will prepare the machine, format it, and install the above + ## configuration in an automated way. isoInstallers.${vmName} = snf.mkInstaller nixpkgs self.nixosConfigurations.${vmName}; }; } diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 08ef493b..fe84add3 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -1,30 +1,48 @@ -# 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, ... }: +{ lib, modulesPath, ... }: { - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = [ (modulesPath + "/profiles/qemu-guest.nix")]; boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/833ac0f9-ad8c-45ae-a9bf-5844e378c44a"; - fsType = "ext4"; + disko.devices.disk.main = { + device = "/dev/sda"; + type = "disk"; + + content = { + type = "gpt"; + + partitions = { + MBR = { + priority = 0; + size = "1M"; + type = "EF02"; + }; + + ESP = { + priority = 1; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + + root = { + priority = 2; + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/B4D5-3AF9"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - swapDevices = [ ]; + }; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's