1 { config, lib, pkgs, ... }:
5 cfg = config.virtualisation.linodeImage;
6 defaultConfigFile = pkgs.writeText "configuration.nix" ''
9 <nixpkgs/nixos/modules/virtualisation/linode-image.nix>
15 imports = [ ./linode-config.nix ];
18 virtualisation.linodeImage.diskSize = mkOption {
19 type = with types; either (enum (singleton "auto")) ints.positive;
23 Size of disk image in MB.
27 virtualisation.linodeImage.configFile = mkOption {
28 type = with types; nullOr str;
31 A path to a configuration file which will be placed at `/etc/nixos/configuration.nix`
32 and be used when switching to a new configuration.
33 If set to `null`, a default configuration is used, where the only import is
34 `<nixpkgs/nixos/modules/virtualisation/linode-image.nix>`
38 virtualisation.linodeImage.compressionLevel = mkOption {
39 type = types.ints.between 1 9;
42 GZIP compression level of the resulting disk image (1-9).
48 system.build.linodeImage = import ../../lib/make-disk-image.nix {
49 name = "linode-image";
50 # NOTE: Linode specifically requires images to be `gzip`-ed prior to upload
51 # See: https://www.linode.com/docs/products/tools/images/guides/upload-an-image/#requirements-and-considerations
53 ${pkgs.gzip}/bin/gzip -${toString cfg.compressionLevel} -c -- $diskImage > \
54 $out/nixos-image-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.img.gz
58 partitionTableType = "none";
59 configFile = if cfg.configFile == null then defaultConfigFile else cfg.configFile;
60 inherit (cfg) diskSize;
61 inherit config lib pkgs;
65 meta.maintainers = with maintainers; [ cyntheticfox ];