diff options
author | Graham Christensen <graham@grahamc.com> | 2022-02-03 11:05:52 -0500 |
---|---|---|
committer | Graham Christensen <graham@grahamc.com> | 2022-04-07 15:28:28 -0400 |
commit | e5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f (patch) | |
tree | 8824b58c4f10baa022f5585adec8d3606d368250 /nixos/modules | |
parent | 80b00ef02a8efc958e2a16a7264c147e2a8ffbf4 (diff) | |
download | nixpkgs-e5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f.tar nixpkgs-e5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f.tar.gz nixpkgs-e5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f.tar.bz2 nixpkgs-e5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f.tar.lz nixpkgs-e5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f.tar.xz nixpkgs-e5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f.tar.zst nixpkgs-e5a7d077c1a1d6a91e40634e9fd4841a91b4bb1f.zip |
openstack-config: support a ZFS root with /boot perhaps coming from an ESP
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/virtualisation/openstack-config.nix | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/nixos/modules/virtualisation/openstack-config.nix b/nixos/modules/virtualisation/openstack-config.nix index d01e0f23aba..a5aa4b38eb6 100644 --- a/nixos/modules/virtualisation/openstack-config.nix +++ b/nixos/modules/virtualisation/openstack-config.nix @@ -1,8 +1,8 @@ -{ pkgs, lib, ... }: - -with lib; +{ config, pkgs, lib, ... }: let + inherit (lib) mkIf mkDefault; + cfg = config.openstack; metadataFetcher = import ./openstack-metadata-fetcher.nix { targetRoot = "/"; wgetExtraOptions = "--retry-connrefused"; @@ -18,16 +18,27 @@ in ]; config = { - fileSystems."/" = { + fileSystems."/" = mkIf (!cfg.zfs.enable) { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; autoResize = true; }; + fileSystems."/boot" = mkIf (cfg.efi || cfg.zfs.enable) { + # The ZFS image uses a partition labeled ESP whether or not we're + # booting with EFI. + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; + }; + boot.growPartition = true; boot.kernelParams = [ "console=ttyS0" ]; - boot.loader.grub.device = "/dev/vda"; - boot.loader.timeout = 0; + boot.loader.grub.device = if (!cfg.efi) then "/dev/vda" else "nodev"; + boot.loader.grub.efiSupport = cfg.efi; + boot.loader.grub.efiInstallAsRemovable = cfg.efi; + + services.zfs.expandOnBoot = mkIf cfg.zfs.enable "all"; + boot.zfs.devNodes = mkIf cfg.zfs.enable "/dev/"; # Allow root logins services.openssh = { @@ -43,7 +54,7 @@ in path = [ pkgs.wget ]; description = "Fetch Metadata on startup"; wantedBy = [ "multi-user.target" ]; - before = [ "apply-ec2-data.service" "amazon-init.service"]; + before = [ "apply-ec2-data.service" "amazon-init.service" ]; wants = [ "network-online.target" ]; after = [ "network-online.target" ]; script = metadataFetcher; |