EC2 amazon instances available vs current version

Hello.

I have a following question:

I have an EC2 instance of NixOS in amazon that I created with the link "https://sa-east-1.console.aws.amazon.com/ec2/home?region=sa-east-1#LaunchInstanceWizard:ami=ami- 0e4a8a47fd6db6112 “, which appears on the NixOS page in the” Amazon EC2 AMIs "section.

Then I installed in a virtual box a version 18.09.1985.749a3a0d00b

The EC instance is 18.09.910.c15e342304a

I need to have the same version. What do I do?

I compiled an exe on 18.09.1985.749a3a0d00b, but did not run on instance 18.09.910.c15e342304a. Can not compile in the same instance because I have a t2.micro and the memory is not sufuciente.

P.S.

I searched for version 18.09.910.c15e342304a for download, but I did not find it at all.

I tried the docker, but the version installed with 18.09.910.c15e342304a is different from the version with 18.09.1985.749a3a0d00b

And I do not know how to install without using

virtualisation.docker.enable = true;

because then I do not know how to enable the service, so I have not used nix-env -iA nixos.docker

If you build the program with Nix, you can nix copy --to ssh://user@server ... to install the program on the server without having to worry about the version of NixOS on it.

I built using haskell stack with pure option in stack.yaml:

nix:
enable: true

Basically a simple application to test deployments on the EC2 instance.

As far as I know with the pure stack option it does everything within a nix-shell environment. But I think stack does not create a store for it. Anyway I’m new to nix and NixOS.

You can pin NixOS to the same commit in both machines.

Not likely good enough. They’ll still need to make sure that whatever deps stack downloaded via nix are present on the remote machine.

My difficulty now is to build the project stack with nix. I’ve tried stack2nix, but there’s not much information out there, and since I’m new to nix, some things have gone dark.

Does anyone know how to do it?