cross compile and docker image
This commit is contained in:
parent
9591374838
commit
0b3c704fab
1 changed files with 18 additions and 6 deletions
24
flake.nix
24
flake.nix
|
@ -16,8 +16,8 @@
|
|||
inherit system;
|
||||
overlays = [ nixuniverse ];
|
||||
};
|
||||
albatros = pkgs.buildGoModule rec {
|
||||
pname = "albatros";
|
||||
gopkg = arch: (pkgs.buildGoModule rec {
|
||||
pname = "albatros-go-module";
|
||||
version = "0.9";
|
||||
src = ./.;
|
||||
CGO_ENABLED = 0;
|
||||
|
@ -29,17 +29,29 @@
|
|||
license = licenses.agpl3;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}).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
|
||||
'';
|
||||
};
|
||||
docker = pkgs.dockerTools.buildImage {
|
||||
docker = staticBin: pkgs.dockerTools.buildImage {
|
||||
name = "dxflrs/albatros";
|
||||
config = {
|
||||
Cmd = [ "${albatros}/bin/albatros" ];
|
||||
Cmd = [ "${staticBin}" ];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.x86_64-linux.albatros = albatros;
|
||||
packages.x86_64-linux.docker.albatros = docker;
|
||||
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;
|
||||
packages.x86_64-linux.default = self.packages.x86_64-linux.albatros;
|
||||
|
||||
devShell.x86_64-linux = pkgs.mkShell { buildInputs = [ pkgs.kaniko pkgs.manifest-tool ]; };
|
||||
|
|
Loading…
Reference in a new issue