NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.84k stars 363 forks source link

How to packageOverrides for the entire fleet #687

Open nh2 opened 7 years ago

nh2 commented 7 years ago

Is there a way to specify nixpkgs.packageOverrides for the entire fleet (network)?

I can't figure out from the documentation how to do that.

domenkozar commented 7 years ago

I'm not following the question, this is part of NixOS module configuration which is modular and you can import it for each machine using the NixOS imports directive like any other configuration. As per https://nixos.org/nixos/manual/#sec-customising-packages

nh2 commented 7 years ago

What I mean is, currently each of my machines is a function of form { pkgs, config, ... }.

For example:

{
  network.enableRollback = true;

  machine1 = { pkgs, config, ... }: {
    ...
  }
  machine2 = { pkgs, config, ... }: {
    ...
  }
}

Currently if I want to override packages for all machines, I do nixpkgs.config.packageOverries = pkgs: { ... } for each machine (or with some wrapper function to not repeat myself).

What I'm wondering is: Can I override the nixpkgs globally / at the network level, so that the pkgs passed to each machine already contains my overridden package set?

domenkozar commented 7 years ago

So the question you are really asking: Can I tell nixops to apply a NixOS module to all machines? I don't think we support that currently. We could have something like network.imports for such purposes.

EDIT: closed the issue by mistake

domenkozar commented 7 years ago

You can do this with defaults: https://github.com/NixOS/nixops/commit/84b9518f88fd7744a2ea38af9ec769b8291c48f6#diff-bca12c48d3713afd322ee4022b4f2e2eR1718