Skip to content

Make it possible to define modular deployments.#187

Closed
shlevy wants to merge 3 commits into
NixOS:masterfrom
shlevy:modular
Closed

Make it possible to define modular deployments.#187
shlevy wants to merge 3 commits into
NixOS:masterfrom
shlevy:modular

Conversation

@shlevy

@shlevy shlevy commented May 14, 2014

Copy link
Copy Markdown
Member

With the --modular-expressions flag, nixops will now treat the
expressions as a module, with machines and resources being evaluated as
submodules. This allows defining deployment-level options/configuration,
as well as reducing duplication between eval-machine-info.nix and
eval-config.nix.

Machines are now defined as attributes in resources.machines, and the
network.* configuration are now in the top-level config namespace (so
there's an enableRollback option, a description option, etc.). For
convenience, the top-level configuration can be accessed as the
'deployment' argument to each module.

Depends on NixOS/nixpkgs#2540 (though deployments without the
--modular-expressions flag will work without it).

Fixes #78 (see issue for more details on motivation).

@aszlig

aszlig commented May 14, 2014

Copy link
Copy Markdown
Member

👍

This was referenced Jun 10, 2014
@shlevy

shlevy commented Jun 10, 2014

Copy link
Copy Markdown
Member Author

@edolstra @rbvermaa This needs to wait for NixOS/nixpkgs#2540 for the new flag to be usable, but can you comment on any of the design decisions here before then? Anything blocking a merge once nixpkgs is ready?

@edolstra

edolstra commented Jul 2, 2014

Copy link
Copy Markdown
Member

Why is the --modular-expressions flag needed? It seems undesirable to have two distinct modes of evaluation.

@shlevy

shlevy commented Jul 2, 2014

Copy link
Copy Markdown
Member Author

@rbvermaa insisted this be backwards compatible, I can think of many hacky heuristics but no foolproof way to automatically distinguish between modular and non-modular deployments.

@edolstra

edolstra commented Jul 2, 2014

Copy link
Copy Markdown
Member

Do you have examples of modular networks somewhere? I seem to remember so but I can't find them.

@shlevy

shlevy commented Jul 2, 2014

Copy link
Copy Markdown
Member Author

All of the ones we have contain private info currently, I can scrub one and upload it somewhere but essentially it looks like:

{
  imports = [ ./some-module-with-options.nix ];

  # environment is an option that for example defaults all machines to vbox when "development"
  zalora.environment = "development";

  description = "My network";

  resources.machines.machine = { pkgs, ... }: {
    environment.systemPackages = [ pkgs.hello ];
  };
}

@shlevy

shlevy commented Jul 2, 2014

Copy link
Copy Markdown
Member Author

Also in addition to the normal config, options, lib arguments each deployment-level module gets passed a deployment argument as an alias for config

shlevy added 3 commits July 8, 2014 12:00
With the --modular-expressions flag, nixops will now treat the
expressions as a module, with machines and resources being evaluated as
submodules. This allows defining deployment-level options/configuration,
as well as reducing duplication between eval-machine-info.nix and
eval-config.nix.

Machines are now defined as attributes in resources.machines, and the
network.* configuration are now in the top-level config namespace (so
there's an enableRollback option, a description option, etc.). For
convenience, the top-level configuration can be accessed as the
'deployment' argument to each module.

Depends on NixOS/nixpkgs#2540 (though deployments without the
--modular-expressions flag will work without it).

Fixes NixOS#78 (see issue for more details on motivation).
@shlevy

shlevy commented Aug 26, 2014

Copy link
Copy Markdown
Member Author

Closing as this doesn't seem wanted.

@shlevy shlevy closed this Aug 26, 2014
@nixos-discourse

Copy link
Copy Markdown

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/colmena-yet-another-nixos-deployment-tool/11506/22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the charon spec a proper module

4 participants