tritonshell/flake.nix

78 lines
3.0 KiB
Nix

{
description = "devshell nix module for triton DevOps shell environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
devshell.inputs.flake-utils.follows = "flake-utils";
};
outputs = { self, flake-utils, devshell, nixpkgs }:
# defaultSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
devshell.overlays.default
(import ./overlay.nix)
];
};
in
{
devshellModules.tritonshell = { config, lib, ... }:
with lib;
{
options = {
environment = {
enable = mkEnableOption "triton DevOps shell environment";
# options used to set triton env vars in tritonshell
# adjust to suit your Triton Data Center setup
# take a look at ./pkgs/triton-docker-env-shell.nix to see how these get used
cnsBaseDomain = mkOption {
description = "Base domain for generated CNS domain records";
type = types.nullOr types.str;
default = "greenbaum.zone";
};
dataCenters = mkOption {
description = "List of available triton data centers";
type = types.listOf types.str;
default = [ "cgn-1" "lev-1" ];
};
mantaDomain = mkOption {
description = "Domain for manta object storage service";
type = types.nullOr types.str;
default = "eu-central.manta.greenbaum.cloud";
};
tritonApiDomain = mkOption {
description = "Domain for triton API";
type = types.nullOr types.str;
default = "api.greenbaum.cloud";
};
};
};
config =
lib.mkIf config.environment.enable
(import ./tritonshell.nix { inherit config devshell pkgs self system; });
};
# Internal utility package with shell function and env vars helper.
# These get source'd in devshell.bash.extra when starting tritonshell
packages = {
triton-utils = import ./pkgs/triton-utils.nix { inherit pkgs; };
triton-docker-env = import ./pkgs/triton-docker-env.nix { inherit pkgs; };
};
}
) // {
defaultTemplate = {
description = "nix flake new --template 'git+https://git.greenbaum.cloud/greenbaum.cloud/tritonshell?ref=main' ./tritonshell";
path = ./template;
};
};
}