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;
|
inherit system;
|
||||||
overlays = [ nixuniverse ];
|
overlays = [ nixuniverse ];
|
||||||
};
|
};
|
||||||
albatros = pkgs.buildGoModule rec {
|
gopkg = arch: (pkgs.buildGoModule rec {
|
||||||
pname = "albatros";
|
pname = "albatros-go-module";
|
||||||
version = "0.9";
|
version = "0.9";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
CGO_ENABLED = 0;
|
CGO_ENABLED = 0;
|
||||||
|
@ -29,17 +29,29 @@
|
||||||
license = licenses.agpl3;
|
license = licenses.agpl3;
|
||||||
platforms = platforms.linux;
|
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";
|
name = "dxflrs/albatros";
|
||||||
config = {
|
config = {
|
||||||
Cmd = [ "${albatros}/bin/albatros" ];
|
Cmd = [ "${staticBin}" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.x86_64-linux.albatros = albatros;
|
packages.aarch64-linux.albatros = albatros "arm64" ;
|
||||||
packages.x86_64-linux.docker.albatros = docker;
|
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;
|
packages.x86_64-linux.default = self.packages.x86_64-linux.albatros;
|
||||||
|
|
||||||
devShell.x86_64-linux = pkgs.mkShell { buildInputs = [ pkgs.kaniko pkgs.manifest-tool ]; };
|
devShell.x86_64-linux = pkgs.mkShell { buildInputs = [ pkgs.kaniko pkgs.manifest-tool ]; };
|
||||||
|
|
Loading…
Reference in a new issue