2021-01-11 18:35:35 +01:00
|
|
|
{
|
|
|
|
inputs = {
|
2021-10-17 22:21:32 +02:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
2021-01-11 18:35:35 +01:00
|
|
|
|
2021-06-09 23:07:43 +02:00
|
|
|
nixng = {
|
2023-05-03 00:57:46 +02:00
|
|
|
url = "github:nix-community/NixNG?ref=develop";
|
2021-06-09 23:07:43 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
website = {
|
|
|
|
url = "git+https://gitea.redalder.org/Magic_RB/website";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2021-01-11 18:35:35 +01:00
|
|
|
};
|
|
|
|
|
2021-05-03 20:30:40 +02:00
|
|
|
outputs = { self, nixpkgs, nixng, ... }@inputs:
|
|
|
|
with nixpkgs.lib;
|
|
|
|
let
|
2021-08-18 22:14:16 +02:00
|
|
|
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
|
|
|
forAllSystems' = systems: fun: nixpkgs.lib.genAttrs systems fun;
|
|
|
|
forAllSystems = forAllSystems' supportedSystems;
|
|
|
|
|
2022-06-01 08:41:51 +02:00
|
|
|
pkgsForSystem = system:
|
|
|
|
import nixpkgs { inherit system; };
|
2021-05-03 20:30:40 +02:00
|
|
|
in
|
2022-06-01 08:41:51 +02:00
|
|
|
{
|
|
|
|
nixngSystems =
|
2023-04-20 11:47:46 +02:00
|
|
|
let base = { nglib = nixng.nglib; inherit nixpkgs; };
|
2022-06-01 08:41:51 +02:00
|
|
|
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;
|
2022-10-27 15:48:38 +02:00
|
|
|
home-assistant = (import ./containers/home-assistant.nix base).home-assistant;
|
|
|
|
home-assistantPostgresql = (import ./containers/home-assistant.nix base).postgresql;
|
2022-06-01 08:41:51 +02:00
|
|
|
reicio = import ./containers/reicio.nix base;
|
2022-06-05 12:59:42 +02:00
|
|
|
baikal = import ./containers/baikal.nix base;
|
2022-10-30 01:21:24 +02:00
|
|
|
conduit = (import ./containers/conduit.nix base).synapse;
|
2023-04-20 11:47:46 +02:00
|
|
|
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;
|
2022-10-30 01:21:24 +02:00
|
|
|
conduitPostgresql = (import ./containers/conduit.nix base).postgresql;
|
2023-04-20 11:47:46 +02:00
|
|
|
conduitRedis = (import ./containers/conduit.nix base).redis;
|
2022-09-19 01:11:59 +02:00
|
|
|
mautrix-facebook = import ./containers/mautrix-facebook.nix base;
|
2022-10-27 11:39:39 +02:00
|
|
|
heisenbridge = import ./containers/heisenbridge.nix base;
|
2022-06-01 08:41:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2022-10-11 07:56:46 +02:00
|
|
|
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 ])}"
|
2023-05-03 00:30:57 +02:00
|
|
|
_rev=$TERRANIX_REV
|
|
|
|
: ''${_rev:=$(git rev-parse HEAD)}
|
|
|
|
_flake_metadata="$(nix flake metadata git+file://$PWD?rev="''$_rev" --json)"
|
2022-10-11 07:56:46 +02:00
|
|
|
export TF_VAR_flake_rev="$(echo "$_flake_metadata" | jq .locked.rev -r)"
|
|
|
|
export TF_VAR_flake_sha="$(echo "$_flake_metadata" | jq .locked.narHash -r)"
|
2023-04-23 23:20:18 +02:00
|
|
|
export TF_VAR_flake_ref="$(git rev-parse --abbrev-ref HEAD)"
|
2022-10-11 07:56:46 +02:00
|
|
|
case "$1" in
|
|
|
|
"env")
|
|
|
|
shift 1
|
|
|
|
env
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
terraform "$@"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
'');
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2022-06-01 08:41:51 +02:00
|
|
|
|
|
|
|
devShell = forAllSystems (system:
|
|
|
|
let pkgs = pkgsForSystem system;
|
|
|
|
in
|
|
|
|
pkgs.mkShell {
|
|
|
|
nativeBuildInputs = with pkgs;
|
2022-09-18 18:24:43 +02:00
|
|
|
[ nomad_1_3 consul vault packer jq terraform
|
2023-05-03 00:57:46 +02:00
|
|
|
(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=";
|
|
|
|
})
|
2022-06-01 08:41:51 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
2021-01-11 18:35:35 +01:00
|
|
|
}
|