Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

lukebfox/nixops-plugged

 
 

Repository files navigation

⚠️ lukebfox/nixops-plugged is obsolete

You can now get a modern, plugged-in, nixops, directly in nixpkgs with nixpkgs.nixopsUnstable thanks to work from other authors, therefore I am archiving this repo.

You can still fork it if you have some need not satisfied by upstream but I would recommend to file a ticket in the appropriate place.

This repo was always a short term solution, and it's day has come.

NixOps 2.0 with batteries included.

Essentially just a wrapper around nixops and some plugins. This flake aims to include any compatible plugins as they become available.

Use from the command line.

Clone this repository and you can run nixops from inside the project root. This flake exports a Nix App, so running nix run . -- <args> is equivalent to running nixops <args>.

Use as a flake input.

You can refer to this flake as input for another flake, i.e. inside the development environment for some flake packaging a NixOps network.

{
  description = "Your awesome flake";

  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  inputs.nixops-plugged.url = "github:lukebfox/nixops-plugged";
  inputs.utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, nixops-plugged, utils, ... }: {
      nixopsConfigurations.default = { ... }; # your network definition
    } // utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs { inherit system; };
    in {
      devShell = pkgs.mkShell {
        nativeBuildInputs = [ nixops-plugged.defaultPackage.${system} ];
      };
    });
}

While inside the development shell for your flake you will now have access to a fully(ish) featured nixops.

λ nix develop
λ nixops list-plugins

If you only care about one plugin, this flake exports packages for this use case, i.e nixops-plugged.packages.nixops-aws to get a nixops with the nixops-aws plugin.

withPlugins

If you want to mix and match from any supported plugins then use this function

devShell = pkgs.mkShell {
  nativeBuildInputs = [ 
    (nixops-plugged.lib.withPlugins (ps: [ps.nixops-aws ps.nixops-hetznercloud])
  ];
};

Supported plugins (wip)

Plugins Included
AWS ✔️
DigitalOcean ✔️
GCE ✔️
Hetzner Cloud ✔️
VBox ✔️
Hetzner Robot
Proxmox
Virtd

Adding new plugins goes like this:

λ nix develop
λ vim pyproject.toml # add plugin to dependencies
λ vim flake.nix      # add plugin to defaultPackage and/or packages
λ poetry lock

You can run nix run . -- list-plugins to verify your changes.

Use from legacy nix.

The legacy commands nix-build and nix-shell should still work thanks to the compatability shim from flake-compat, although I don't use these so YMMV.

Languages

  • Nix 100.0%