tritonshell/flake.nix

79 lines
2.9 KiB
Nix

{
description = "devshell nix module for triton DevOps shell environment";
inputs.devshell.url = "github:numtide/devshell";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = { self, flake-utils, devshell, nixpkgs }:
flake-utils.lib.eachSystem [
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
]
(
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
devshell.overlay
(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; };
};
outputs = { self }: {
defaultTemplate = {
description = "nix flake new --template 'git+https://git.greenbaum.cloud/greenbaum.cloud/tritonshell?ref=main' ./tritonshell";
path = ./template;
};
};
}
);
}