{ description = "Albatros"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, flake-utils }: with flake-utils.lib; let archmap = { aarch64-linux = { GOOS = "linux"; GOARCH = "arm64"; }; x86_64-linux = { GOOS = "linux"; GOARCH = "amd64"; }; i686-linux = { GOOS = "linux"; GOARCH = "386"; }; armv6l-linux = { GOOS = "linux"; GOARCH = "arm"; }; }; in eachSystem [ # supported systems system.x86_64-linux system.i686-linux system.armv6l-linux system.aarch64-linux ] (targetHost: let # Should be configurable buildSystem = system.x86_64-linux; # generic config albaVersion = "0.9"; # nix repository pkgs = import nixpkgs { system = buildSystem; # we don't use nixos cross environment as it is slow and not required #crossSystem = { # config = targetHost; #}; overlays = [ ]; # we dropped the overlay we had, keep it as "skeleton". }; # declare the go module of this package albatrosProject = (pkgs.buildGoModule rec { pname = "albatros-go-module"; version = albaVersion; src = ./.; CGO_ENABLED = 0; vendorSha256 = "sha256-KYjXb882jWLFO6zilQXlrZorL9tw/+6njQNkB6E9Er4="; dontCheck=true; buildPhase = '' go build bin/ci.go go build -tags containers_image_docker_daemon_stub,containers_image_storage_stub,containers_image_openpgp bin/alba.go ''; installPhase = '' mkdir -p $out cp alba ci $out/ ''; meta = with pkgs.lib; { description = "albatros is a collection of tools to build your software supply chain"; homepage = "https://git.deuxfleurs.fr/Deuxfleurs/albatros"; license = licenses.agpl3; platforms = platforms.linux; }; }).overrideAttrs (old: old // (builtins.getAttr targetHost archmap)); # get only a statically compiled ci ci = pkgs.stdenv.mkDerivation { pname = "albatros-ci"; version = albaVersion; dontUnpack = true; dontBuild = true; installPhase = '' cp ${albatrosProject}/ci $out ''; }; # get only a statically compiled alba tool alba = pkgs.stdenv.mkDerivation { pname = "albatros-alba"; version = albaVersion; dontUnpack = true; dontBuild = true; installPhase = '' cp ${albatrosProject}/alba $out ''; }; # logic to build docker containers container = pkgs.dockerTools.buildImage { name = "dxflrs/albatros-ci"; architecture = (builtins.getAttr targetHost archmap).GOARCH; config = { Cmd = [ "${ci}" ]; }; }; # Exposed content in { packages = { inherit ci alba container; default = ci; }; }); }