nixos/cloud-image: add module
The module creates an image for an openstack-based cloud using the cloud-init package.
This commit is contained in:
		
							parent
							
								
									f152749c99
								
							
						
					
					
						commit
						a0a4bea2a6
					
				
							
								
								
									
										44
									
								
								nixos/modules/virtualisation/cloud-image.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								nixos/modules/virtualisation/cloud-image.nix
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
			
		||||
# 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;
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user