lol

nixos/nova-image: cleanup image builders (#29242)

There are currently two ways to build Openstack image. This just picks
best of both, to keep only one!

- Image is resizable
- Cloudinit is enable
- Password authentication is disable by default
- Use the same layer than other image builders (ec2, gce...)

authored by

lewo and committed by
Jörg Thalheim
3a377e26 99b09a20

+9 -46
+2
nixos/maintainers/scripts/openstack/nova-image.nix
··· 1 + # nix-build '<nixpkgs/nixos>' -A config.system.build.novaImage --arg configuration "{ imports = [ ./nixos/maintainers/scripts/openstack/nova-image.nix ]; }" 2 + 1 3 { config, lib, pkgs, ... }: 2 4 3 5 with lib;
-44
nixos/modules/virtualisation/cloud-image.nix
··· 1 - # Usage: 2 - # $ NIX_PATH=`pwd`:nixos-config=`pwd`/nixpkgs/nixos/modules/virtualisation/cloud-image.nix nix-build '<nixpkgs/nixos>' -A config.system.build.cloudImage 3 - 4 - { config, lib, pkgs, ... }: 5 - 6 - with lib; 7 - 8 - { 9 - system.build.cloudImage = import ../../lib/make-disk-image.nix { 10 - inherit pkgs lib config; 11 - partitioned = true; 12 - diskSize = 1 * 1024; 13 - configFile = pkgs.writeText "configuration.nix" 14 - '' 15 - { config, lib, pkgs, ... }: 16 - 17 - with lib; 18 - 19 - { 20 - imports = [ <nixpkgs/nixos/modules/virtualisation/cloud-image.nix> ]; 21 - } 22 - ''; 23 - }; 24 - 25 - imports = [ ../profiles/qemu-guest.nix ]; 26 - 27 - fileSystems."/".device = "/dev/disk/by-label/nixos"; 28 - 29 - boot = { 30 - kernelParams = [ "console=ttyS0" ]; 31 - loader.grub.device = "/dev/vda"; 32 - loader.timeout = 0; 33 - }; 34 - 35 - networking.hostName = mkDefault ""; 36 - 37 - services.openssh = { 38 - enable = true; 39 - permitRootLogin = "without-password"; 40 - passwordAuthentication = mkDefault false; 41 - }; 42 - 43 - services.cloud-init.enable = true; 44 - }
+7 -2
nixos/modules/virtualisation/nova-config.nix
··· 22 22 boot.loader.timeout = 0; 23 23 24 24 # Allow root logins 25 - services.openssh.enable = true; 26 - services.openssh.permitRootLogin = "prohibit-password"; 25 + services.openssh = { 26 + enable = true; 27 + permitRootLogin = "prohibit-password"; 28 + passwordAuthentication = mkDefault false; 29 + }; 30 + 31 + services.cloud-init.enable = true; 27 32 28 33 # Put /tmp and /var on /ephemeral0, which has a lot more space. 29 34 # Unfortunately we can't do this with the `fileSystems' option