diff --git a/configurations/nixos/tofu/configuration.nix b/configurations/nixos/tofu/configuration.nix index c8dcd00..07354af 100644 --- a/configurations/nixos/tofu/configuration.nix +++ b/configurations/nixos/tofu/configuration.nix @@ -1,6 +1,5 @@ { config, pkgs, ... }: { - disko.devices.disk.main.device = "/dev/vda"; services.tty-ips.enable = true; networking.yggdrasil = { diff --git a/configurations/nixos/tofu/disko.nix b/configurations/nixos/tofu/disko.nix deleted file mode 100644 index 804896c..0000000 --- a/configurations/nixos/tofu/disko.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - lib, - config, - ... -}: -{ - boot.loader.grub.efiSupport = lib.mkDefault true; - boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true; - disko.devices = { - disk = { - "main" = { - # suffix is to prevent disk name collisions - name = "main-" + config.networking.hostName; - type = "disk"; - # device = ; - content = { - type = "gpt"; - partitions = { - "boot" = { - size = "1M"; - type = "EF02"; # for grub MBR - priority = 1; - }; - "ESP" = { - size = "512M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "nofail" ]; - }; - }; - "root" = { - size = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/configurations/nixos/tofu/hardware-configuration.nix b/configurations/nixos/tofu/hardware-configuration.nix deleted file mode 100644 index 3876427..0000000 --- a/configurations/nixos/tofu/hardware-configuration.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... -}: - -{ - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; - - boot.initrd.availableKernelModules = [ - "ahci" - "xhci_pci" - "virtio_pci" - "virtio_scsi" - "sr_mod" - "virtio_blk" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - # virtualisation.qemu.guestAgent.enable = true; - services.qemuGuest.enable = true; - # 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 - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; - # networking.interfaces.tailscale0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} diff --git a/modules/nixos/common/disko.nix b/modules/nixos/common/disko.nix new file mode 100644 index 0000000..39caceb --- /dev/null +++ b/modules/nixos/common/disko.nix @@ -0,0 +1,52 @@ +{ + lib, + config, + ... +}: +{ + + # disko.devices.disk.main.device = "/dev/vda"; + options.internal.disko.default.enable = lib.mkEnableOption ""; + config = lib.mkIf config.internal.disko.enable { + boot.loader.grub.efiSupport = lib.mkDefault true; + boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true; + disko.devices = { + disk = { + "main" = { + # suffix is to prevent disk name collisions + name = "main-" + config.networking.hostName; + type = "disk"; + # device = ; + content = { + type = "gpt"; + partitions = { + "boot" = { + size = "1M"; + type = "EF02"; # for grub MBR + priority = 1; + }; + "ESP" = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "nofail" ]; + }; + }; + "root" = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; + }; +}