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...)

lewo 3a377e26 99b09a20

Changed files
+9 -46
nixos
maintainers
scripts
openstack
modules
+2
nixos/maintainers/scripts/openstack/nova-image.nix
···
+
# nix-build '<nixpkgs/nixos>' -A config.system.build.novaImage --arg configuration "{ imports = [ ./nixos/maintainers/scripts/openstack/nova-image.nix ]; }"
+
{ config, lib, pkgs, ... }:
with lib;
-44
nixos/modules/virtualisation/cloud-image.nix
···
-
# Usage:
-
# $ NIX_PATH=`pwd`:nixos-config=`pwd`/nixpkgs/nixos/modules/virtualisation/cloud-image.nix nix-build '<nixpkgs/nixos>' -A config.system.build.cloudImage
-
-
{ config, lib, pkgs, ... }:
-
-
with lib;
-
-
{
-
system.build.cloudImage = import ../../lib/make-disk-image.nix {
-
inherit pkgs lib config;
-
partitioned = true;
-
diskSize = 1 * 1024;
-
configFile = pkgs.writeText "configuration.nix"
-
''
-
{ config, lib, pkgs, ... }:
-
-
with lib;
-
-
{
-
imports = [ <nixpkgs/nixos/modules/virtualisation/cloud-image.nix> ];
-
}
-
'';
-
};
-
-
imports = [ ../profiles/qemu-guest.nix ];
-
-
fileSystems."/".device = "/dev/disk/by-label/nixos";
-
-
boot = {
-
kernelParams = [ "console=ttyS0" ];
-
loader.grub.device = "/dev/vda";
-
loader.timeout = 0;
-
};
-
-
networking.hostName = mkDefault "";
-
-
services.openssh = {
-
enable = true;
-
permitRootLogin = "without-password";
-
passwordAuthentication = mkDefault false;
-
};
-
-
services.cloud-init.enable = true;
-
}
+7 -2
nixos/modules/virtualisation/nova-config.nix
···
boot.loader.timeout = 0;
# Allow root logins
-
services.openssh.enable = true;
-
services.openssh.permitRootLogin = "prohibit-password";
+
services.openssh = {
+
enable = true;
+
permitRootLogin = "prohibit-password";
+
passwordAuthentication = mkDefault false;
+
};
+
+
services.cloud-init.enable = true;
# Put /tmp and /var on /ephemeral0, which has a lot more space.
# Unfortunately we can't do this with the `fileSystems' option