diff options
author | Alexander Gall <alexander.gall@gmail.com> | 2017-08-07 12:27:55 +0200 |
---|---|---|
committer | Alexander Gall <alexander.gall@gmail.com> | 2017-08-07 13:03:02 +0200 |
commit | a0a4bea2a6a5ccf4c367e7f71df824c44b2d547b (patch) | |
tree | aca1c06939dc099461ec1fbf0f020e9e274fb8f5 /nixos | |
parent | f152749c9940cda448153aa4d36dcaea538af8b1 (diff) | |
download | nixlib-a0a4bea2a6a5ccf4c367e7f71df824c44b2d547b.tar nixlib-a0a4bea2a6a5ccf4c367e7f71df824c44b2d547b.tar.gz nixlib-a0a4bea2a6a5ccf4c367e7f71df824c44b2d547b.tar.bz2 nixlib-a0a4bea2a6a5ccf4c367e7f71df824c44b2d547b.tar.lz nixlib-a0a4bea2a6a5ccf4c367e7f71df824c44b2d547b.tar.xz nixlib-a0a4bea2a6a5ccf4c367e7f71df824c44b2d547b.tar.zst nixlib-a0a4bea2a6a5ccf4c367e7f71df824c44b2d547b.zip |
nixos/cloud-image: add module
The module creates an image for an openstack-based cloud using the cloud-init package.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/virtualisation/cloud-image.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/cloud-image.nix b/nixos/modules/virtualisation/cloud-image.nix new file mode 100644 index 000000000000..0f0141abfb16 --- /dev/null +++ b/nixos/modules/virtualisation/cloud-image.nix @@ -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; +} |