A Flake deployer for distributed NixOS and Darwin clusters.
Find a file
Aly Raffauf 5bc46bb799
All checks were successful
build / build-nynx (push) Successful in 42s
build / build-devShell (push) Successful in 49s
check / check-eval (push) Successful in 52s
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-parts':
    'github:hercules-ci/flake-parts/644e0fc48951a860279da645ba77fe4a6e814c5e?narHash=sha256-TVcTNvOeWWk1DXljFxVRp%2BE0tzG1LhrVjOGGoMHuXio%3D' (2025-07-21)
  → 'github:hercules-ci/flake-parts/758cf7296bee11f1706a574c77d072b8a7baa881?narHash=sha256-wfG0S7pltlYyZTM%2BqqlhJ7GMw2fTF4mLKCIVhLii/4M%3D' (2025-10-01)
• Updated input 'flake-parts/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/14a40a1d7fb9afa4739275ac642ed7301a9ba1ab?narHash=sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo%3D' (2025-06-29)
  → 'github:nix-community/nixpkgs.lib/a73b9c743612e4244d865a2fdee11865283c04e6?narHash=sha256-x2rJ%2BOvzq0sCMpgfgGaaqgBSwY%2BLST%2BWbZ6TytnT9Rk%3D' (2025-08-10)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/17f6bd177404d6d43017595c5264756764444ab8?narHash=sha256-Znl7rzuxKg/Mdm6AhimcKynM7V3YeNDIcLjBuoBcmNs%3D' (2025-07-26)
  → 'github:NixOS/nixpkgs/c9b6fb798541223bbb396d287d16f43520250518?narHash=sha256-vgPm2xjOmKdZ0xKA6yLXPJpjOtQPHfaZDRtH%2B47XEBo%3D' (2025-10-07)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/2673921c03d6e75fdf4aa93e025772608d1482cf?narHash=sha256-Bv9h1AJegLI8uAhiJ1sZ4XAndYxhgf38tMgCQwiEpmc%3D' (2025-07-25)
  → 'github:numtide/treefmt-nix/5eda4ee8121f97b218f7cc73f5172098d458f1d1?narHash=sha256-ySNJ008muQAds2JemiyrWYbwbG%2BV7S5wg3ZVKGHSFu8%3D' (2025-09-24)
2025-10-10 07:49:21 -04:00
.github/workflows github: don't check fmt 2025-07-22 12:33:26 -04:00
.zed initial commit 2025-07-09 21:21:55 -04:00
flake flake: rewrite, use flake-parts, split flake into flake/ 2025-07-22 12:31:51 -04:00
src nixbuild/deployCLosure: set system profile on nixos 2025-08-02 16:13:13 -04:00
utils initial commit 2025-07-09 21:21:55 -04:00
.envrc initial commit 2025-07-09 21:21:55 -04:00
.gitignore initial commit 2025-07-09 21:21:55 -04:00
flake.lock flake.lock: Update 2025-10-10 07:49:21 -04:00
flake.nix flake: rewrite, use flake-parts, split flake into flake/ 2025-07-22 12:31:51 -04:00
LICENSE.md initial commit 2025-07-09 21:21:55 -04:00
README.md overhaul messaging + add --debug 2025-07-21 20:55:34 -04:00

nynx (nix+sync)

A Flake deployer for distributed NixOS and Darwin clusters. Useful for quickly deploying the same flake revision to multiple machines in parallel.

Mainly a personal project to serve some specific needs of mine (outlined here), but it may be helpful to others as well. Also, it's my first time writing Go (please be gentle).

Usage

Build the tool using Nix:

nix build .#nynx

Run deployments:

nix run .#nynx -- --flake <flake-url> --operation <operation>

Flags

  • --debug: Enable debug output.
  • --skip: Skip a comma-separated subset of jobs.
  • --jobs: Comma-separated subset of jobs to run (default: all jobs).
  • --flake: Specify the flake path or URL (e.g., github:alyraffauf/nixcfg).
  • --build-host: Specify the host on which to build closures (default: localhost).
  • --operation: Operation to perform (switch, or activate for Darwin; boot, test, switch for NixOS).

Example

Deploy a flake to all jobs defined in deployments.nix:

nix run .#nynx -- --flake github:alyraffauf/nixcfg --operation switch

Run specific deployment jobs:

nix run .#nynx -- --flake github:alyraffauf/nixcfg --operation switch --jobs server,workstation

Sample #nynxDeployments

Nynx is configured with a Flake output containing an attrset that defines a set of deployment jobs. Outputs can be declared in the same Flake or in an upstream Flake.

{
  nynxDeployments = {
    evergrande = {
      hostname = "evergrande"; # Will be assumed from deployment name if not specified.
      output = self.inputs.nixcfg.nixosConfigurations.evergrande.config.system.build.toplevel;
      type = "nixos";
      user = "root";
    };

    fortree = {
      output = self.darwinConfigurations.fortree.config.system.build.toplevel;
      user = "aly";
      type = "darwin";
    };
  };
}

Limitations

  • Requires SSH root access or the ability to escalate privileges with sudo without password entry. It won't prompt for a password, it just fails.
  • Does not (yet) support other forms of Nix profiles, such as home-manager.

License

This project is licensed under the GNU General Public License v3.0.

Contribution

Contributions are welcome! Please open issues or submit pull requests for any improvements you make or bugs you encounter.

Contact

You can reach me at aly @ aly dot codes.