https://github.com/alyraffauf/nynx
A Flake-native deployment tool using nix-eval-jobs for distributed NixOS and Darwin clusters.
https://github.com/alyraffauf/nynx
automation deployment flake golang nix nix-darwin nixos
Last synced: 10 months ago
JSON representation
A Flake-native deployment tool using nix-eval-jobs for distributed NixOS and Darwin clusters.
- Host: GitHub
- URL: https://github.com/alyraffauf/nynx
- Owner: alyraffauf
- License: gpl-3.0
- Created: 2025-07-10T01:23:07.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-07-28T20:17:59.000Z (11 months ago)
- Last Synced: 2025-07-28T22:20:29.062Z (11 months ago)
- Topics: automation, deployment, flake, golang, nix, nix-darwin, nixos
- Language: Go
- Homepage:
- Size: 95.7 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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](https://aly.codes/blog/2025-05-19-mildly-better-flake-deployments/)), 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 --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.
```nix
{
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.