mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-25 09:36:14 +01:00
1698a0cbc8
Signed-off-by: Magic_RB <magic_rb@redalder.org>
66 lines
2.1 KiB
Nix
66 lines
2.1 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-21.05";
|
|
|
|
nixng = {
|
|
url = "github:MagicRB/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;
|
|
|
|
containers = {
|
|
hydra = (import ./containers/hydra.nix nixng.lib).hydra;
|
|
hydraPostgresql = (import ./containers/hydra.nix nixng.lib).postgresql;
|
|
ingress = (import ./containers/ingress.nix nixng.lib);
|
|
website = (import ./containers/website.nix inputs.website.website nixng.lib);
|
|
};
|
|
in
|
|
{
|
|
ociImages = mapAttrs (n: v: v.config.system.build.ociImage) containers;
|
|
|
|
hydraJobs =
|
|
let
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
|
makeJob = container:
|
|
pkgs.runCommandNoCCLocal "${container.stream.imageName}-hydra-job"
|
|
{}
|
|
''
|
|
mkdir -p $out/nix-support
|
|
ln -s ${container.build} $out/image.tar.gz
|
|
ln -s ${container.stream} $out/stream
|
|
echo "file docker-image $out/image.tar.gz" >> $out/nix-support/hydra-build-products
|
|
echo "file image-stream $out/stream" >> $out/nix-support/hydra-build-products
|
|
'';
|
|
in
|
|
{
|
|
website = makeJob self.ociImages.website;
|
|
hydra = makeJob self.ociImages.hydra;
|
|
hydraPostgresql = makeJob self.ociImages.hydraPostgresql;
|
|
ingress = makeJob self.ociImages.ingress;
|
|
};
|
|
|
|
|
|
devShell = forAllSystems (system:
|
|
let
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
|
in
|
|
pkgs.mkShell {
|
|
nativeBuildInputs = with pkgs;
|
|
[ nomad_1_1 consul vault
|
|
];
|
|
}
|
|
);
|
|
};
|
|
}
|