mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-21 15:54:21 +01:00
d630743bf7
Signed-off-by: Magic_RB <magic_rb@redalder.org>
119 lines
4.9 KiB
Nix
119 lines
4.9 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
|
|
|
nixng = {
|
|
url = "github:nix-community/NixNG";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
website = {
|
|
url = "git+https://gitea.redalder.org/Magic_RB/website";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, nixng, ... }@inputs:
|
|
with nixpkgs.lib;
|
|
let
|
|
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
|
forAllSystems' = systems: fun: nixpkgs.lib.genAttrs systems fun;
|
|
forAllSystems = forAllSystems' supportedSystems;
|
|
|
|
pkgsForSystem = system:
|
|
import nixpkgs { inherit system; };
|
|
in
|
|
{
|
|
nixngSystems =
|
|
let base = { nglib = nixng.nglib; inherit nixpkgs; };
|
|
in
|
|
{ hydra = (import ./containers/hydra.nix base).hydra;
|
|
hydraPostgresql = (import ./containers/hydra.nix base).postgresql;
|
|
ingressToothpick = import ./containers/ingress-toothpick.nix base;
|
|
ingressBlowhole = import ./containers/ingress-blowhole.nix base;
|
|
website = import ./containers/website.nix (base // { inherit (inputs.website) website; });
|
|
gitea = import ./containers/gitea.nix base;
|
|
minecraft = import ./containers/minecraft.nix base;
|
|
mosquitto = import ./containers/mosquitto.nix base;
|
|
dovecot = import ./containers/dovecot.nix base;
|
|
getmail = import ./containers/getmail base;
|
|
syncthing = import ./containers/syncthing.nix base;
|
|
zigbee2mqtt = import ./containers/zigbee2mqtt.nix base;
|
|
home-assistant = (import ./containers/home-assistant.nix base).home-assistant;
|
|
home-assistantPostgresql = (import ./containers/home-assistant.nix base).postgresql;
|
|
reicio = import ./containers/reicio.nix base;
|
|
baikal = import ./containers/baikal.nix base;
|
|
conduit = (import ./containers/conduit.nix base).synapse;
|
|
synapseFederationSender = (import ./containers/conduit.nix base).synapseFederationSender;
|
|
synapseFederationReceiver = (import ./containers/conduit.nix base).synapseFederationReceiver;
|
|
synapseClient = (import ./containers/conduit.nix base).synapseClient;
|
|
synapseSync = (import ./containers/conduit.nix base).synapseSync;
|
|
conduitPostgresql = (import ./containers/conduit.nix base).postgresql;
|
|
conduitRedis = (import ./containers/conduit.nix base).redis;
|
|
mautrix-facebook = import ./containers/mautrix-facebook.nix base;
|
|
heisenbridge = import ./containers/heisenbridge.nix base;
|
|
};
|
|
|
|
hydraJobs =
|
|
let
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
|
makeJob = container:
|
|
container.config.system.build.toplevel;
|
|
in
|
|
nixpkgs.lib.mapAttrs (n: v: makeJob v) self.nixngSystems;
|
|
|
|
apps = forAllSystems (system:
|
|
let pkgs = pkgsForSystem system;
|
|
in
|
|
{
|
|
terraform = {
|
|
type = "app";
|
|
program = toString (pkgs.writeShellScript "terraform" ''
|
|
export PATH="${pkgs.lib.makeBinPath (with pkgs; [ terraform bash coreutils jq nix git ])}"
|
|
_rev=$TERRANIX_REV
|
|
: ''${_rev:=$(git rev-parse HEAD)}
|
|
_flake_metadata="$(nix flake metadata git+file://$PWD?rev="''$_rev" --json)"
|
|
export TF_VAR_flake_rev="$(echo "$_flake_metadata" | jq .locked.rev -r)"
|
|
export TF_VAR_flake_sha="$(echo "$_flake_metadata" | jq .locked.narHash -r)"
|
|
export TF_VAR_flake_ref="$(git rev-parse --abbrev-ref HEAD)"
|
|
case "$1" in
|
|
"env")
|
|
shift 1
|
|
env
|
|
;;
|
|
*)
|
|
terraform "$@"
|
|
;;
|
|
esac
|
|
'');
|
|
};
|
|
}
|
|
);
|
|
|
|
|
|
devShell = forAllSystems (system:
|
|
let pkgs = pkgsForSystem system;
|
|
in
|
|
pkgs.mkShell {
|
|
nativeBuildInputs = with pkgs;
|
|
[ nomad_1_3 consul vault packer jq terraform
|
|
(pkgs.buildGoModule {
|
|
name = "csc";
|
|
version = "master";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "rexray";
|
|
repo = "gocsi";
|
|
rev = "632c7b6c58afc49476956fb085a9590bc195b1dd";
|
|
hash = "sha256-c1Ofz8eVEDQEseHRGCETQpBieqSRyoMlWiMpV15prtA=";
|
|
};
|
|
|
|
subPackages = [ "csc" ];
|
|
# sourceRoot = "source/csc";
|
|
vendorHash = "sha256-VUxpX7kR1rgJaWlC4ArLTLOmbRLRKrpq9WV2fvUMV3c=";
|
|
})
|
|
];
|
|
}
|
|
);
|
|
};
|
|
}
|