albatros/flake.nix

60 lines
2 KiB
Nix
Raw Normal View History

2023-03-16 11:24:23 +00:00
{
description = "Albatros";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
nixuniverse = import (builtins.fetchGit {
url = "https://git.deuxfleurs.fr/quentin/nixuniverse.git";
ref = "main";
2023-03-16 11:32:11 +00:00
rev = "e94fa51007c9a51ac233e4fcfca09249102f74c5";
2023-03-16 11:24:23 +00:00
});
pkgs = import nixpkgs {
inherit system;
overlays = [ nixuniverse ];
};
2023-04-06 16:20:30 +00:00
gopkg = arch: (pkgs.buildGoModule rec {
pname = "albatros-go-module";
2023-03-16 11:24:23 +00:00
version = "0.9";
src = ./.;
2023-03-16 11:33:39 +00:00
CGO_ENABLED = 0;
2023-03-16 11:24:23 +00:00
vendorSha256 = "sha256-Q7gImRoJqtcORpHLQoF3TRK2WJu3tKSjSE3Sno6lNNk=";
checkPhase = "true";
meta = with pkgs.lib; {
description = "albatros is a CI for Nomad";
homepage = "https://git.deuxfleurs.fr/quentin/albatros";
license = licenses.agpl3;
platforms = platforms.linux;
};
2023-04-06 16:20:30 +00:00
}).overrideAttrs (old: old // { GOOS = "linux"; GOARCH = arch; });
albatros = arch: pkgs.stdenv.mkDerivation {
pname = "albatros";
version = "0.9";
unpackPhase = "true";
installPhase = ''
cp `find ${gopkg arch}/bin -name albatros` $out
'';
2023-03-16 11:24:23 +00:00
};
2023-04-06 16:20:30 +00:00
docker = staticBin: pkgs.dockerTools.buildImage {
2023-03-16 11:24:23 +00:00
name = "dxflrs/albatros";
config = {
2023-04-06 16:20:30 +00:00
Cmd = [ "${staticBin}" ];
2023-03-16 11:24:23 +00:00
};
};
in
{
2023-04-06 16:20:30 +00:00
packages.aarch64-linux.albatros = albatros "arm64" ;
packages.aarch64-linux.docker.albatros = docker self.packages.aarch64-linux.albatros;
packages.aarch64-linux.default = self.packages.aarch64-linux.albatros;
packages.x86_64-linux.albatros = albatros "amd64";
packages.x86_64-linux.docker.albatros = docker self.packages.x86_64-linux.albatros;
2023-03-16 11:24:23 +00:00
packages.x86_64-linux.default = self.packages.x86_64-linux.albatros;
devShell.x86_64-linux = pkgs.mkShell { buildInputs = [ pkgs.kaniko pkgs.manifest-tool ]; };
};
}