How Deployments tools works

Hi!
I’m currently trying to learn nix, and i’ am especially interested in remote deployments tools, like
NixOps, morph, deploy-rs and so on.
I tried to grasp how they works reading the source code, but i’ am definitely not enough confident with the language.
So How those tools “parse” the configuration.nix files, provide ulterior options, and trigger rebuild/rollback ecc. ecc ?
I know that differently tools, but i guess that they’re using the same underlying concept

P.S: After completing the nix-pills where should i look?

1 Like

They all use nix-build or nix build under the hood to build an expression. Either they SSH into the remote and build there, or the build locally and use nix copy-store or equivalent to push the built pathes to the remote.

Then they SSH into the remote and run the activation script there.

Rolling back is just running the previous activation script

@NobbZ So basically they’re fancy wrapper around nix-build/nix build. Fine.
And what about parsing they’re own options? I mean, Morph, for example, has some more options
like:

network = {
    nixConfig = {
        "extra-sandbox-paths" = "/foo/bar";
    };
};

machine1 = { ... }: {
    deployment.buildOnly = true;
};

machine2 = { ... }: {
    deployment.substituteOnDestination = true;
};

That has to be defined somewhere right?

For example there is this nix file that defines some options :

And then there’s this one that I’m not clear on how it works: