Open hlolli opened 2 years ago
I faced the same issue, solved it by adding a line
modules =
existingModules ++ [({...}: { amazonImage.sizeMB = 16 * 1024; })];
This was an issue for me as well, and the above worked. Any reasons why this isn't the default?
I hit this & just wanted to mention that if you're using the nixos module, you can set the amazonImage.sizeMB
attribute inside of formatConfigs.amazon
, e.g.:
{ config, inputs, ... }:
{
imports = [
inputs.nixos-generators.nixosModules.all-formats
];
formatConfigs.amazon = {config, ...}: {
amazonImage.sizeMB = 16 * 1024;
};
}
I hit this & just wanted to mention that if you're using the nixos module, you can set the
amazonImage.sizeMB
attribute inside offormatConfigs.amazon
, e.g.:{ config, inputs, ... }: { imports = [ inputs.nixos-generators.nixosModules.all-formats ]; formatConfigs.amazon = {config, ...}: { amazonImage.sizeMB = 16 * 1024; }; }
Which file did you add that to? None of this makes any sense.
I check out this repo, cd into it, execute "nix-shell" then enter: ./nixos-generate -f amazon -c /home/mraiser/Documents/aws/build_ec2_ami/ec2config.nix -I nixpkgs=channel:nixos-23.11
I've set TMPDIR environment variable to a drive with 3TB free. I've increased /run/user/1000 to 24GB. I've tried passing "--option" flag.
Always the same, "ERROR: cptofs failed. diskSize might be too small for closure."
Very. Frustrating.
In case it is helpful to anyone in the future, here's a step-by-step on building an amazon ami, if you're getting the "ERROR: cptofs failed. diskSize might be too small for closure."
CHANGE: 4096 to number of MB you need to contain your image files CHANGE: /home/mraiser/Documents/aws/build_ec2_ami/ec2config.nix to weherever your config for the new image lives.
I hope it helps someone! Thanks to everyone in this thread for pointing me in the right direction!
In case someone is still having trouble figuring out how to use the workaround for flakes, taking the example from the README.md
:
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixos-generators, ... }: {
packages.x86_64-linux = {
amazon = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [
# ./configuration.nix
({...}: { amazonImage.sizeMB = 16 * 1024; }) # <--------------------------- here
];
format = "amazon";
};
};
};
}
I'm experiencing strange issue with too small diskSize, I'm as far as I see, not using tmpfs under /run, it seems to be using /tmp from the logs. The memory is huge on this machine and plenty of disk space left. I'll add that this build started to break after nixos upgrade I did recently (I'm posting nix-info below).